mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Don't transfer indefinite height: stretch
to inline axis (#34557)
Consider this testcase: ```html <canvas style="aspect-ratio: 1; height: stretch; background: cyan" width="200" height="100"></canvas> ``` To compute the intrinsic inline sizes we were treating `height: stretch` as the natural height (100px) and then transferring that to the inline axis through the preferred aspect ratio. So the element was 100px wide. However, an indefinite `stretch` should be treated as an automatic size, which wouldn't be transferred to the inline axis. The fix actually makes the code slightly simpler. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
2b8a8f7498
commit
e10e989abb
3 changed files with 26 additions and 15 deletions
|
@ -532,18 +532,15 @@ impl ReplacedContents {
|
|||
// Therefore, we tentatively treat intrinsic block sizing properties as their initial value.
|
||||
let inline_content_size = LazyCell::new(|| {
|
||||
let get_block_size = || {
|
||||
let block_stretch_size = block_stretch_size.unwrap_or_else(get_block_fallback_size);
|
||||
SizeConstraint::new(
|
||||
box_size
|
||||
.block
|
||||
.maybe_resolve_extrinsic(Some(block_stretch_size)),
|
||||
box_size.block.maybe_resolve_extrinsic(block_stretch_size),
|
||||
min_box_size
|
||||
.block
|
||||
.maybe_resolve_extrinsic(Some(block_stretch_size))
|
||||
.maybe_resolve_extrinsic(block_stretch_size)
|
||||
.unwrap_or_default(),
|
||||
max_box_size
|
||||
.block
|
||||
.maybe_resolve_extrinsic(Some(block_stretch_size)),
|
||||
.maybe_resolve_extrinsic(block_stretch_size),
|
||||
)
|
||||
};
|
||||
self.content_size(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue