mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Make LengthPercentage not copy.
This is needed to support min() / max() / clamp(), etc. Differential Revision: https://phabricator.services.mozilla.com/D57249
This commit is contained in:
parent
a541046147
commit
789ddd9dc1
5 changed files with 58 additions and 49 deletions
|
@ -1373,7 +1373,11 @@ impl ComputedTranslate {
|
|||
LengthPercentage::zero(),
|
||||
Length::zero(),
|
||||
),
|
||||
Translate::Translate(tx, ty, tz) => (tx, ty, tz),
|
||||
Translate::Translate(ref tx, ref ty, ref tz) => (
|
||||
tx.clone(),
|
||||
ty.clone(),
|
||||
tz.clone(),
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ impl ToComputedValue for specified::Length {
|
|||
/// https://drafts.csswg.org/css-values-4/#typedef-length-percentage
|
||||
#[allow(missing_docs)]
|
||||
#[derive(
|
||||
Clone, Copy, Debug, Deserialize, MallocSizeOf, Serialize, ToAnimatedZero, ToResolvedValue,
|
||||
Clone, Debug, Deserialize, MallocSizeOf, Serialize, ToAnimatedZero, ToResolvedValue,
|
||||
)]
|
||||
#[repr(C)]
|
||||
pub struct LengthPercentage {
|
||||
|
@ -543,14 +543,14 @@ impl ToAnimatedValue for NonNegativeLengthPercentage {
|
|||
impl From<NonNegativeLength> for NonNegativeLengthPercentage {
|
||||
#[inline]
|
||||
fn from(length: NonNegativeLength) -> Self {
|
||||
LengthPercentage::new(length.0, None).into()
|
||||
NonNegative(LengthPercentage::new(length.0, None))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<LengthPercentage> for NonNegativeLengthPercentage {
|
||||
#[inline]
|
||||
fn from(lp: LengthPercentage) -> Self {
|
||||
NonNegative::<LengthPercentage>(lp)
|
||||
NonNegative(lp)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue