aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/sizing.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2020-02-11 23:05:37 -0500
committerGitHub <noreply@github.com>2020-02-11 23:05:37 -0500
commit6d6d16f7f492e6346f0391e352015226a4444806 (patch)
treed991c986a7f83be25157934e93c248ea86ee4b00 /components/layout_2020/sizing.rs
parentbaac1e2c69d3b6e840ced2be4b5e03bb39bd40d5 (diff)
parentd1f8d576f83714fe674a36c5b718341c236312e6 (diff)
downloadservo-6d6d16f7f492e6346f0391e352015226a4444806.tar.gz
servo-6d6d16f7f492e6346f0391e352015226a4444806.zip
Auto merge of #25717 - emilio:gecko-sync, r=emilio,nox
style: Sync changes from mozilla-central. See individual commits for details. https://bugzilla.mozilla.org/show_bug.cgi?id=1614394
Diffstat (limited to 'components/layout_2020/sizing.rs')
-rw-r--r--components/layout_2020/sizing.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/components/layout_2020/sizing.rs b/components/layout_2020/sizing.rs
index dc7513a7859..f5dac929b84 100644
--- a/components/layout_2020/sizing.rs
+++ b/components/layout_2020/sizing.rs
@@ -117,12 +117,12 @@ impl BoxContentSizes {
.auto_is(Length::zero);
let max_inline_size = match style.max_box_size().inline {
MaxSize::None => None,
- MaxSize::LengthPercentage(ref lp) => lp.as_length(),
+ MaxSize::LengthPercentage(ref lp) => lp.to_length(),
};
let clamp = |l: Length| l.clamp_between_extremums(min_inline_size, max_inline_size);
// Percentages for 'width' are treated as 'auto'
- let inline_size = inline_size.map(|lp| lp.as_length());
+ let inline_size = inline_size.map(|lp| lp.to_length());
// The (inner) min/max-content are only used for 'auto'
let mut outer = match inline_size.non_auto().flatten() {
None => {
@@ -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);