Repository navigation
layout: Add experimental aspect-ratio support for non-replaced boxes - #47980
Conversation
There was a problem hiding this comment.
- You can just reopen #47969 instead of opening a new PR
- Please rebase and force push instead of "merge main into.."
- Please use proper title and description. Refer to https://book.servo.org/contributing/making-a-pull-request.html and some examples, such as #47852.
a5542e6 to
35cdb23
Compare
7d52cf0 to
af59c7c
Compare
|
🔨 Triggering try run (#34577752509) for Linux (WPT) |
|
Test results for linux-wpt from try job (#34577752509): Flaky unexpected result (10)
Stable unexpected results that are known to be intermittent (8)
Stable unexpected results (18)
|
|
|
| Some((block_size.into(), depends_on_inline_stretch_size)) | ||
| }, | ||
| _ => None, | ||
| IndependentFormattingContextContents::Flow(_) => { |
There was a problem hiding this comment.
是不是可以这样写
IndependentFormattingContextContents::Flow()
| IndependentFormattingContextContents::Flex()
| IndependentFormattingContextContents::Grid()
| IndependentFormattingContextContents::Table() => {
let ratio = preferred_aspect_ratio?;
let block_size = ratio.compute_dependent_size(Direction::Block, inline_stretch_size);
Some((block_size.into(), true))
}
There was a problem hiding this comment.
语义上应该是一样的,不过参考同类里其他函数对五种box均分别讨论了,感觉还是分开写对日后扩展更方便些?
|
I haven't checked the code. But next step is to check those new failures in "Stable unexpected results (18)". If they were passing false positively, you can state reasons for these in PR description. |
Loirooriol
left a comment
There was a problem hiding this comment.
I think tentative_block_content_size should continue being None for non-replaced.
Instead, sizing should decouple the transference of sizes thru ratios from inline_content_sizes() (it's fine for replaced but not others, due to automatic minimums)
| }, | ||
| _ => None, | ||
| IndependentFormattingContextContents::Flow(_) => { | ||
| let ratio = preferred_aspect_ratio?; |
There was a problem hiding this comment.
This is common, can be moved above.
| _ => None, | ||
| IndependentFormattingContextContents::Flow(_) => { | ||
| let ratio = preferred_aspect_ratio?; | ||
| let block_size = ratio.compute_dependent_size(Direction::Block, inline_stretch_size); |
There was a problem hiding this comment.
Why are you stretching the intrinsic size of a non-replaced?
104e221 to
50c8cbd
Compare
|
🛠 These changes could not be applied onto the latest upstream WPT. Servo's copy of the Web Platform Tests may be out of sync. |
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#65087). |
1 similar comment
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#65087). |
|
🔨 Triggering try run (#43851940061) for Linux (WPT) |
|
Test results for linux-wpt from try job (#43851940061): Flaky unexpected result (23)
Stable unexpected results that are known to be intermittent (7)
Stable unexpected results (1)
|
|
|
Just wanna say it's been another five days, pls check again. |
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#65087). |
Loirooriol
left a comment
There was a problem hiding this comment.
Sorry for the delay.
I have found some issues, but I don't want to block this even longer. Since it's behind a pref anyway, you can address in follow-ups if you want.
| if let Some(ratio_dependent_block_size) = | ||
| compute_ratio_dependent_block_size(preferred_aspect_ratio, inline_size) | ||
| { | ||
| block_size_for_children = SizeConstraint::Definite(content_box_sizes.block.resolve( |
There was a problem hiding this comment.
This only updates block_size_for_children but not tentative_block_size, which is e.g. checked for margin collapse. Which probably means that the logic for margin collapse should check the ratio.
These margins shouldn't collapse thru:
<!DOCTYPE html>
Should be a square:
<div style="border: solid; width: 200px">
<div style="width: 100px; aspect-ratio: 1; margin: 50px 0"></div>
</div>| block_stretch_size, | ||
| || block_content_size, | ||
| is_table, | ||
| || None, /* ratio_dependent_block_size */ |
There was a problem hiding this comment.
Not handled here for floats and atomic inlines:
<!DOCTYPE html>
<div style="float: left; aspect-ratio: 1; width: 100px; border: solid">
<div style="height: 50%; width: 50px; background: cyan"></div>
</div>
<div style="display: inline-block; aspect-ratio: 1; width: 100px; border: solid">
<div style="height: 50%; width: 50px; background: cyan"></div>
</div>| block_stretch_size, | ||
| || block_content_size, | ||
| is_table, | ||
| || None, /* ratio_dependent_block_size */ |
There was a problem hiding this comment.
Not handled
<!DOCTYPE html>
<div style="position: absolute; aspect-ratio: 1; width: 100px; border: solid">
<div style="height: 50%; width: 50px; background: cyan"></div>
</div>|
🔨 Triggering try run (#45346996167) for Linux (WPT) |
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#65087). |
Signed-off-by: Euclid Ye <[email protected]> Co-authored-by: hhhwsqhhh <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
|
|
Signed-off-by: Euclid Ye <[email protected]>
The ratio is already taken into account when resolving the lazy block size. Using it here would also prevent resolving `auto` minimums in the future. Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
Signed-off-by: Euclid Ye <[email protected]>
|
🔨 Triggering try run (#45347951784) for Linux (WPT) |
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#65087). |
|
Test results for linux-wpt from try job (#45347951784): Flaky unexpected result (18)
Stable unexpected results that are known to be intermittent (9)
|
|
✨ Try run (#45347951784) succeeded. |
|
✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#65087) title and body. |
Query and usage of preferred_aspect_ratio() on non-replaced boxes (Flow, Flex, Grid).
This is gated behind the experimental
layout_css_aspect_ratio_enabledpreference, since following not implementedtentative_block_sizefor in flow boxes.Aspect-ratio on table boxes themselves is left unsupported due to unclear spec w3c/csswg-drafts#11419.
Testing: New passing. Rest failures are due to above limitations.
Fixes: Part of #32802