mirror of
https://github.com/servo/servo.git
synced 2025-08-11 16:35:33 +01:00
style: Fix computed value clamping.
Differential Revision: https://phabricator.services.mozilla.com/D21268
This commit is contained in:
parent
52db71c0bf
commit
4496411edc
1 changed files with 3 additions and 9 deletions
|
@ -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(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue