Repository navigation
layout: Consider aspect-ratio block sizes when collapsing margins - #50247
Conversation
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Loirooriol
left a comment
There was a problem hiding this comment.
I think the logic works. But I have realized that there was another problem around here:
<!-- quirks -->
<div style="height: 200px">
<div style="width: 100px; aspect-ratio: 1">
<div style="height: stretch; border: solid"></div>
</div>
</div>has_quirky_block_size becomes true, so we don't resolve stretch.
I guess has_quirky_block_size should be set to false when overriding block_size_for_children due to a ratio.
Probably best for a follow-up PR that adds a new test.
| // A block size that is definite due to the aspect ratio | ||
| // doesn't allow margins to collapse through the box. |
There was a problem hiding this comment.
I would merge this comment with the one above, e.g.
// If there is a preferred aspect ratio, adjust
tentative_block_sizefor margin collapse
// purposes, andblock_size_for_childrenso that children can resolve block percentages.
Note that the aspect ratio can still allow margin collapse if the resulting block size is a definite 0:
<!DOCTYPE html>
<div style="border: solid; width: 50px">
<div style="width: 0px; aspect-ratio: 1; margin: 50px 0"></div>
</div>(in this regard we align with Blink and WebKit, not with Firefox).
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
|
@Loirooriol I have also added compatibility comment in 17b57d2 where we decide margin collapsing. As for quirks, checked with other browsers: https://servo.zulipchat.com/#narrow/channel/263398-general/topic/.E2.9C.94.20Looking.20for.20simple.20WebKit.20test/with/644025073 Probably open an issue and add a tentative test? |
Signed-off-by: Euclid Ye <[email protected]>
This reverts commit 17b57d2. Signed-off-by: Euclid Ye <[email protected]>
…ervo#50271) Testing: - New passing in `/css/css-position/position-relative-aspect-ratio-002.html`, which is a position test in quirks mode about percentage resolution in presence of aspect-ratio. - Add a _tentative_ test `quirks-mode-stretch-block-size.tentative.html` for css-sizing, based on servo#50247 (review). It mimics the above newly passing test. Fixes: Part of servo#32802 --------- Signed-off-by: Euclid Ye <[email protected]>
…rvo#50247) (cherry picked from upstream 6665562 — kept fork's conservative in-flow transfer logic, applied mut binding) Co-Authored-By: Jahanzaib Baigo <[email protected]>
tentative_block_sizeis used to decide margin collapse. Since it was resolved before inline size known,it didn't include block size derived from aspect-ratio.
Testing: Existing tests. Tested with #47980 (comment).
Fixes: Part of #32802