mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Fix the default behavior of scale:<number>{1}.
The current spec says: "If only the X value is given, the Y value defaults to the same value.", so we should update the behavior. Besides, we also update the serialization, so we serialization both specified and computed value by servo. We enable the preference for all the css-transforms, so some of them are passed now. Differential Revision: https://phabricator.services.mozilla.com/D10638
This commit is contained in:
parent
264a679c50
commit
23f2e99e99
4 changed files with 65 additions and 23 deletions
|
@ -2212,7 +2212,6 @@ impl ComputedScale {
|
|||
Scale::None => (1.0, 1.0, 1.0),
|
||||
Scale::Scale3D(sx, sy, sz) => (sx, sy, sz),
|
||||
Scale::Scale(sx, sy) => (sx, sy, 1.),
|
||||
Scale::ScaleX(sx) => (sx, 1., 1.),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2224,21 +2223,38 @@ impl Animate for ComputedScale {
|
|||
other: &Self,
|
||||
procedure: Procedure,
|
||||
) -> Result<Self, ()> {
|
||||
let from = ComputedScale::resolve(self);
|
||||
let to = ComputedScale::resolve(other);
|
||||
|
||||
// FIXME(emilio, bug 1464791): why does this do something different than
|
||||
// Scale3D / TransformOperation::Scale3D?
|
||||
if procedure == Procedure::Add {
|
||||
// scale(x1,y1,z1)*scale(x2,y2,z2) = scale(x1*x2, y1*y2, z1*z2)
|
||||
return Ok(Scale::Scale3D(from.0 * to.0, from.1 * to.1, from.2 * to.2));
|
||||
match (self, other) {
|
||||
(&Scale::None, &Scale::None) => Ok(Scale::None),
|
||||
(&Scale::Scale3D(_, ..), _) | (_, &Scale::Scale3D(_, ..)) => {
|
||||
let from = ComputedScale::resolve(self);
|
||||
let to = ComputedScale::resolve(other);
|
||||
// FIXME(emilio, bug 1464791): why does this do something different than
|
||||
// Scale3D / TransformOperation::Scale3D?
|
||||
if procedure == Procedure::Add {
|
||||
// scale(x1,y1,z1)*scale(x2,y2,z2) = scale(x1*x2, y1*y2, z1*z2)
|
||||
return Ok(Scale::Scale3D(from.0 * to.0, from.1 * to.1, from.2 * to.2));
|
||||
}
|
||||
Ok(Scale::Scale3D(
|
||||
animate_multiplicative_factor(from.0, to.0, procedure)?,
|
||||
animate_multiplicative_factor(from.1, to.1, procedure)?,
|
||||
animate_multiplicative_factor(from.2, to.2, procedure)?,
|
||||
))
|
||||
},
|
||||
(&Scale::Scale(_, ..), _) | (_, &Scale::Scale(_, ..)) => {
|
||||
let from = ComputedScale::resolve(self);
|
||||
let to = ComputedScale::resolve(other);
|
||||
// FIXME(emilio, bug 1464791): why does this do something different than
|
||||
// Scale / TransformOperation::Scale?
|
||||
if procedure == Procedure::Add {
|
||||
// scale(x1,y1)*scale(x2,y2) = scale(x1*x2, y1*y2)
|
||||
return Ok(Scale::Scale(from.0 * to.0, from.1 * to.1));
|
||||
}
|
||||
Ok(Scale::Scale(
|
||||
animate_multiplicative_factor(from.0, to.0, procedure)?,
|
||||
animate_multiplicative_factor(from.1, to.1, procedure)?,
|
||||
))
|
||||
},
|
||||
}
|
||||
|
||||
Ok(Scale::Scale3D(
|
||||
animate_multiplicative_factor(from.0, to.0, procedure)?,
|
||||
animate_multiplicative_factor(from.1, to.1, procedure)?,
|
||||
animate_multiplicative_factor(from.2, to.2, procedure)?,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue