mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
layout: Floor the max-content size by the min-content size (#36518)
It's typically a given that the min-content size can't exceed the max-content size. However, it was possible to break that assumption when an inline formatting context had contents with a negative outer size (due to margins). This could lead to assert failures. This patch avoids the problem by flooring the max-content size to not be smaller than the min-content size. Note there is no interoperability: https://github.com/w3c/csswg-drafts/issues/12076 Testing: adding new reftest and crashtest Fixes: #36481 Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
7b2fd52992
commit
c7502a99f0
4 changed files with 71 additions and 2 deletions
|
@ -2285,10 +2285,16 @@ impl<'layout_data> ContentSizesComputation<'layout_data> {
|
|||
for inline_item in inline_formatting_context.inline_items.iter() {
|
||||
self.process_item(&inline_item.borrow(), inline_formatting_context);
|
||||
}
|
||||
|
||||
self.forced_line_break();
|
||||
|
||||
// We might get a max-content size which is smaller than the min-content size,
|
||||
// due to negative margins. So we need to adjust to avoid problems down the line.
|
||||
// This is being discussed in <https://github.com/w3c/csswg-drafts/issues/12076>.
|
||||
let mut sizes = self.paragraph;
|
||||
sizes.max_content.max_assign(sizes.min_content);
|
||||
|
||||
InlineContentSizesResult {
|
||||
sizes: self.paragraph,
|
||||
sizes,
|
||||
depends_on_block_constraints: self.depends_on_block_constraints,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue