Skip to content

Commit

Permalink
layout_2020: Avoid decomposing mixed length / percentages in intrinsi…
Browse files Browse the repository at this point in the history
…c sizing.

As that makes no sense in presence of min / max.
  • Loading branch information
emilio committed Feb 12, 2020
1 parent f03026b commit 1754c83
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions components/layout_2020/flow/inline.rs
Expand Up @@ -159,8 +159,12 @@ impl InlineFormattingContext {
}

fn add_lengthpercentage(&mut self, lp: LengthPercentage) {
self.add_length(lp.length_component());
self.current_line_percentages += lp.percentage_component();
if let Some(l) = lp.to_length() {
self.add_length(l);
}
if let Some(p) = lp.to_percentage() {
self.current_line_percentages += p;
}
}

fn add_length(&mut self, l: Length) {
Expand Down
8 changes: 6 additions & 2 deletions components/layout_2020/sizing.rs
Expand Up @@ -148,8 +148,12 @@ impl BoxContentSizes {
let margin = style.margin();
pbm_lengths += border.inline_sum();
let mut add = |x: LengthPercentage| {
pbm_lengths += x.length_component();
pbm_percentages += x.percentage_component();
if let Some(l) = x.to_length() {
pbm_lengths += l;
}
if let Some(p) = x.to_percentage() {
pbm_percentages += p;
}
};
add(padding.inline_start);
add(padding.inline_end);
Expand Down

0 comments on commit 1754c83

Please sign in to comment.