layout_2020: Avoid decomposing mixed length / percentages in intrinsic sizing.

As that makes no sense in presence of min / max.
This commit is contained in:
Emilio Cobos Álvarez 2020-02-10 17:36:49 +01:00
parent f03026b869
commit 1754c832d8
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
2 changed files with 12 additions and 4 deletions

View file

@ -159,8 +159,12 @@ impl InlineFormattingContext {
} }
fn add_lengthpercentage(&mut self, lp: LengthPercentage) { fn add_lengthpercentage(&mut self, lp: LengthPercentage) {
self.add_length(lp.length_component()); if let Some(l) = lp.to_length() {
self.current_line_percentages += lp.percentage_component(); self.add_length(l);
}
if let Some(p) = lp.to_percentage() {
self.current_line_percentages += p;
}
} }
fn add_length(&mut self, l: Length) { fn add_length(&mut self, l: Length) {

View file

@ -148,8 +148,12 @@ impl BoxContentSizes {
let margin = style.margin(); let margin = style.margin();
pbm_lengths += border.inline_sum(); pbm_lengths += border.inline_sum();
let mut add = |x: LengthPercentage| { let mut add = |x: LengthPercentage| {
pbm_lengths += x.length_component(); if let Some(l) = x.to_length() {
pbm_percentages += x.percentage_component(); pbm_lengths += l;
}
if let Some(p) = x.to_percentage() {
pbm_percentages += p;
}
}; };
add(padding.inline_start); add(padding.inline_start);
add(padding.inline_end); add(padding.inline_end);