layout: Implement block-axis centering for buttons - #46590
Conversation
2bdd8bc to
2533a1c
Compare
|
🔨 Triggering try run (#29577731042) for Linux (WPT) |
|
Test results for linux-wpt from try job (#29577731042): Flaky unexpected result (35)
Stable unexpected results that are known to be intermittent (18)
Stable unexpected results (1)
|
|
|
nicoburns
left a comment
There was a problem hiding this comment.
This looks reasonable to me, although I do not have full context around Servo's layout system to fully review.
Wanted to note that it may be worth looking at implementing align-content in block sooner rather than later: the diff to implement that in Taffy was pretty small https://github.com/DioxusLabs/taffy/pull/959/changes
2533a1c to
d1cd168
Compare
Yes, it doesn't seem too complex, but there is the question of whether it should be done during layout (like flex containers or now buttons), or after layout (like table cells). And it should ideally be the same approach everywhere, or at least if table cells are different, not align the contents twice. |
Loirooriol
left a comment
There was a problem hiding this comment.
@dcoapp recheck
|
🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#61372) with upstreamable changes. |
Loirooriol
left a comment
There was a problem hiding this comment.
@dcoapp recheck
Mark `<button>` elements and `<input>` that lay out as buttons with a new `FragmentFlags::IS_BUTTON` flag. Then, if they contain a block formatting context, center their contents in the block axis. This is done similarly as for `vertical-align` on table cells: we wrap the contents inside a `PositioningFragment`, which is then shifted to appear at the correct place. But unlike table cells, this is done before caching the layout results, not afterwards. In the future, when we implement `align-content` for block containers, we should probably switch to that. Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Oriol Brufau <obrufau@igalia.com>
d1cd168 to
6684f4b
Compare
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#61372). |
Mark
<button>elements and<input>that lay out as buttons with a newFragmentFlags::IS_BUTTONflag. Then, if they contain a block formatting context, center their contents in the block axis.This is done similarly as for
vertical-alignon table cells: we wrap the contents inside aPositioningFragment, which is then shifted to appear at the correct place. But unlike table cells, this is done before caching the layout results, not afterwards.In the future, when we implement
align-contentfor block containers, we should probably switch to that.Testing: 1 tests passes, and adding 3 new tests
Fixes: #41432