-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Layout floats as children of their inline ancestors #30130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
32bd2a0
to
0de5c89
Compare
} | ||
} | ||
|
||
/// Given the amount of whitespace trimmed from the start of the line and taking into consideration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment here says 'amount of whitespace trimmed from the start of the line' but in code, the value for whitespace_trimmed is set by the 'trim_whitespace_at_end` method. Is the comment here wrong or am I misunderstanding it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's a good point. I've updated this to simply say "the amount of whitespace trimmed from the line."
match text_align { | ||
TextAlign::Start => line_start_position_from_indent, | ||
TextAlign::End => { | ||
containing_block.inline_size - real_line_length_without_indent + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the calculation here correct?
For this test html, both layout 2020 master and legacy-layout have the same output as Firefox and Chrome, but this PR doesn't match those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calculation was incorrect! I have updated this in a way that I think corrects the case you mentioned and also have put a specification link and quote explaining why it's correct now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The text-align: end
case doesn't seem to work similar to the other layouts & master for this case.
IIUC, the spec says 'text-indent' is treated as margin at the 'start' edge of the linebox and 'text-align: end' will align the contents to the 'end' edge of the box, so the margin cannot not influence the end edge unless the margin exceeds the available width.
0de5c89
to
ed5f8a7
Compare
@bors-servo try=wpt-2020 |
🔨 Triggering try run (#5938918429) with platform=linux and layout=2020 |
Test results for linux-wpt-layout-2020 from try job (#5938918429): Flaky unexpected result (7)
Stable unexpected results that are known to be intermittent (30)
|
✨ Try run (#5938918429) succeeded. |
@mukilan Thanks for the review. I think this is ready to look at again, when you have a moment. |
Thanks @mrobinson for updating the PR with the spec and comments! I've found one more case where 'text-end' doesn't work as other browsers. Please let me know if that is not in scope for this PR and needs to fixed separately as part of 'text-indent' stuff. |
ed5f8a7
to
1b4800e
Compare
Thanks for pointing out this issue. I believe I've fixed it and have also added two WPT tests corresponding to the issues your raised above. |
🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#41585) with upstreamable changes. |
1b4800e
to
c8fb806
Compare
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#41585). |
c8fb806
to
59c187e
Compare
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#41585). |
59c187e
to
ef93c51
Compare
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#41585). |
When layout was split into two phases, floats were laid out as direct children of the inline formatting context. This meant that they were positioned properly, but not properly made children of their inline ancestors' stacking contexts. This change maintains the proper positioning of floats, but positions them relatively to their inline ancestors. The big change here is that `text-align` needs to be taken into account before actually laying out LineItems. This has the added benefit of setting inline layout for the implementation of `text-align: full`. Now all line items are laid out at the real final position and we can adjust the `start_corner` property of float `BoxFragments` when their ancestors are laid out.
ef93c51
to
0c00c1a
Compare
It seems that Layout 2013 does not pass this test...it looks like due to line breaking issues. All pipelines are passing in upstream WPT issue. I've updated the result and will send it back to the MQ. |
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#41585). |
When layout was split into two phases, floats were laid out as direct
children of the inline formatting context. This meant that they were
positioned properly, but not properly made children of their inline
ancestors' stacking contexts. This change maintains the proper
positioning of floats, but positions them relatively to their inline
ancestors.
The big change here is that
text-align
needs to be taken into accountbefore actually laying out LineItems. This has the added benefit of
setting inline layout for the implementation of
text-align: full
. Nowall line items are laid out at the real final position and we can adjust
the
start_corner
property of floatBoxFragments
when their ancestorsare laid out.
./mach build -d
does not report any errors./mach test-tidy
does not report any errors