mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Prevent stretch
from producing a negative size (#33951)
Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
afeaff7f1a
commit
8824c90716
4 changed files with 17 additions and 4 deletions
|
@ -1969,11 +1969,12 @@ impl IndependentFormattingContext {
|
|||
let max_box_size = style.content_max_box_size(containing_block, &pbm);
|
||||
let min_box_size = style.content_min_box_size(containing_block, &pbm);
|
||||
|
||||
let available_inline_size = containing_block.inline_size - pbm_sums.inline_sum();
|
||||
let available_inline_size =
|
||||
(containing_block.inline_size - pbm_sums.inline_sum()).max(Au::zero());
|
||||
let available_block_size = containing_block
|
||||
.block_size
|
||||
.non_auto()
|
||||
.map(|block_size| block_size - pbm_sums.block_sum());
|
||||
.map(|block_size| (block_size - pbm_sums.block_sum()).max(Au::zero()));
|
||||
let tentative_block_size = box_size
|
||||
.block
|
||||
.maybe_resolve_extrinsic(available_block_size)
|
||||
|
|
4
tests/wpt/meta/MANIFEST.json
vendored
4
tests/wpt/meta/MANIFEST.json
vendored
|
@ -569290,14 +569290,14 @@
|
|||
]
|
||||
],
|
||||
"keyword-sizes-on-floated-element.html": [
|
||||
"adfffba8061aa983800822746a0cd5fc8f6f0fa8",
|
||||
"42ea7ba26d7e1ffd26f8f12bad37e3b18abba0f6",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"keyword-sizes-on-inline-block.html": [
|
||||
"d91d8e6ed9cd2ab7c7f0e418b7715fc88a03b4e1",
|
||||
"7c41d902aa89c9f46a936dbac1d20b80bb5cdd98",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
|
|
|
@ -119,6 +119,12 @@
|
|||
<div class="test max-height stretch" data-expected-height="90">XXXXX XXXXX</div>
|
||||
</div>
|
||||
|
||||
<!-- Stretch sizes can't result in a negative content size -->
|
||||
<div class="wrapper" style="width: 0px; height: 0px">
|
||||
<div class="test width min-width max-width stretch" data-expected-width="10"></div>
|
||||
<div class="test height min-height max-height stretch" data-expected-height="10"></div>
|
||||
</div>
|
||||
|
||||
<!-- Indefinite stretch -->
|
||||
<div style="width: 100px; max-height: 100px">
|
||||
<div class="test height stretch indefinite" data-expected-height="30">X X</div>
|
||||
|
|
|
@ -125,6 +125,12 @@
|
|||
<div class="test max-height stretch" data-expected-height="90">XXXXX XXXXX</div>
|
||||
</div>
|
||||
|
||||
<!-- Stretch sizes can't result in a negative content size -->
|
||||
<div class="wrapper" style="width: 0px; height: 0px">
|
||||
<div class="test width min-width max-width stretch" data-expected-width="10"></div>
|
||||
<div class="test height min-height max-height stretch" data-expected-height="10"></div>
|
||||
</div>
|
||||
|
||||
<!-- Indefinite stretch -->
|
||||
<div class="wrapper" style="width: 100px; max-height: 100px">
|
||||
<div class="test height stretch indefinite" data-expected-height="30">X X</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue