layout: Fix abspos position when it would be preceded by phantom line#42586
layout: Fix abspos position when it would be preceded by phantom line#42586Loirooriol wants to merge 1 commit intoservo:mainfrom
Conversation
|
🔨 Triggering try run (#21963040078) for Linux (WPT) |
|
🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#57757) with upstreamable changes. |
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#57757). |
|
Test results for linux-wpt from try job (#21963040078): Flaky unexpected result (29)
Stable unexpected results that are known to be intermittent (23)
|
|
✨ Try run (#21963040078) succeeded. |
| block: if absolute.on_phantom_line { | ||
| block_position | ||
| } else { | ||
| block_position + self.line_metrics.block_size | ||
| }, |
There was a problem hiding this comment.
Is there a reason you can't check self.is_phantom_line here? Is it possible for a absolute to be listed as on_phantom_line, but not be taking part in a LineItemLayout for which LineItemLayout::is_phantom_line isn't true?
There was a problem hiding this comment.
The problem is that self.is_phantom_line refers to the final line, so it may be false because of contents after the abspos. But here we need the static position, which depends on whether the preceding contents would produce a phantom line or not. Because in the static position, the abspos behaves as in-flow, and thus it breaks the line.
There was a problem hiding this comment.
I have renamed and added a rustdoc comment for clarity
The static position of an abspos is the hypothetical position that it would have had in the normal flow. If the abspos is inside inline layout and it had a block-level original display, then the static position is computed as if the abspos was a block-level that breaks the inline. Usually this places the static position after the current line. However, if the abspos is not preceded by any text, padding, border, margin, preserved newline or atomic inline, then the static position should be as if the abspos was preceded by a 0px tall phantom line. Previously we weren't taking that into account. Note that browsers aren't completely interoperable in corner cases. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#57757). |
The static position of an abspos is the hypothetical position that it would have had in the normal flow. If the abspos is inside inline layout and it had a block-level original display, then the static position is computed as if the abspos was a block-level that breaks the inline.
Usually this places the static position after the current line. However, if the abspos is not preceded by any text, padding, border, margin, preserved newline or atomic inline, then the static position should be as if the abspos was preceded by a 0px tall phantom line. Previously we weren't taking that into account.
Note that browsers aren't completely interoperable in corner cases.
Testing: Adding 3 new tests. Blink fails the 2nd one and Gecko fails the 3rd one. WebKit and Servo pass them all.
Fixes: #41990