style: Fix computed value clamping.

Differential Revision: https://phabricator.services.mozilla.com/D21268
This commit is contained in:
Emilio Cobos Álvarez 2019-02-26 23:34:25 +00:00
parent 52db71c0bf
commit 4496411edc

View file

@ -203,12 +203,7 @@ impl LengthPercentage {
return None; return None;
} }
if self.clamping_mode.clamp(self.percentage.0) != self.percentage.0 { Some(Percentage(self.clamping_mode.clamp(self.percentage.0)))
debug_assert!(self.was_calc);
return None;
}
Some(self.percentage)
} }
/// Convert the computed value into used value. /// Convert the computed value into used value.
@ -433,14 +428,13 @@ impl ToComputedValue for specified::LengthPercentage {
} }
fn from_computed_value(computed: &LengthPercentage) -> Self { fn from_computed_value(computed: &LengthPercentage) -> Self {
let length = computed.unclamped_length();
if let Some(p) = computed.as_percentage() { if let Some(p) = computed.as_percentage() {
return specified::LengthPercentage::Percentage(p); return specified::LengthPercentage::Percentage(p);
} }
if !computed.has_percentage && computed.clamping_mode.clamp(length.px()) == length.px() { if !computed.has_percentage {
return specified::LengthPercentage::Length(ToComputedValue::from_computed_value( return specified::LengthPercentage::Length(ToComputedValue::from_computed_value(
&length, &computed.length(),
)); ));
} }