зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1500107 - Fix the default behavior of scale:<number>{1}. r=birtles
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 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3765945097
Коммит
d781fa81ce
|
@ -1,90 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Individual transform: compare individual transform with transform functions</title>
|
||||
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#individual-transforms">
|
||||
<meta name="assert" content="Tests whether individaul transform works correctlyi by compare the rendering result with transfrom functions of the 'transform' property."/>
|
||||
<style>
|
||||
div {
|
||||
position: fixed;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
transform-origin: 0 0;
|
||||
border-style: solid;
|
||||
border-width: 10px 0px 10px 0px;
|
||||
border-color: lime;
|
||||
}
|
||||
.row_1 {
|
||||
top: 100px;
|
||||
}
|
||||
.scale_1{
|
||||
left: 100px;
|
||||
width: 50px;
|
||||
height: 100px;
|
||||
transform: scaleX(2);
|
||||
}
|
||||
.translate_1 {
|
||||
left: 150px;
|
||||
transform: translateX(150px);
|
||||
}
|
||||
.rotate_1 {
|
||||
left: 450px;
|
||||
transform-origin: 50% 50%;
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.row_2 {
|
||||
top: 250px;
|
||||
}
|
||||
.scale_2{
|
||||
left: 100px;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
transform: scale(2, 2);
|
||||
}
|
||||
.translate_2 {
|
||||
left: 150px;
|
||||
top: 200px;
|
||||
transform: translate(150px, 50px);
|
||||
}
|
||||
.rotate_2 {
|
||||
left: 450px;
|
||||
transform-origin: 50% 50%;
|
||||
transform: rotate3d(0, 0, 1, 90deg);
|
||||
}
|
||||
.row_3 {
|
||||
transform: perspective(500px);
|
||||
top: 400px;
|
||||
}
|
||||
.scale_3{
|
||||
left: 100px;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
transform: scale3d(2, 2, 2);
|
||||
}
|
||||
.translate_3 {
|
||||
left: 150px;
|
||||
transform: translate3d(150px, 10px, 10px);
|
||||
}
|
||||
.rotate_3 {
|
||||
left: 450px;
|
||||
transform-origin: 50% 50%;
|
||||
transform: rotate3d(0, 1, 0, 45deg);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="scale_1 row_1"></div>
|
||||
<div class="translate_1 row_1"></div>
|
||||
<div class="rotate_1 row_1"></div>
|
||||
<div class="scale_2 row_2"></div>
|
||||
<div class="translate_2 row_2"></div>
|
||||
<div class="rotate_2 row_2"></div>
|
||||
<div class="scale_3 row_3"></div>
|
||||
<div class="translate_3 row_3"></div>
|
||||
<div class="rotate_3 row_3"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,100 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Individual transform: compare individual transform with transform functions</title>
|
||||
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#individual-transforms">
|
||||
<meta name="assert" content="Tests whether individaul transform works correctlyi by compare the rendering result with transfrom functions of the 'transform' property."/>
|
||||
<link rel="match" href="individual-transform-1-ref.html">
|
||||
<style>
|
||||
div {
|
||||
position: fixed;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
transform-origin: 0 0;
|
||||
border-style: solid;
|
||||
border-width: 10px 0px 10px 0px;
|
||||
border-color: lime;
|
||||
}
|
||||
.row_1 {
|
||||
top: 100px;
|
||||
}
|
||||
.scale_1{
|
||||
left: 100px;
|
||||
width: 50px;
|
||||
height: 100px;
|
||||
/* test 'scale: <number>' */
|
||||
scale: 2;
|
||||
}
|
||||
.translate_1 {
|
||||
left: 150px;
|
||||
/* test 'translate: <length-percentage>' */
|
||||
translate: 150px;
|
||||
}
|
||||
.rotate_1 {
|
||||
left: 450px;
|
||||
transform-origin: 50% 50%;
|
||||
/* test 'rota: te<angle>' */
|
||||
rotate: 90deg;
|
||||
}
|
||||
|
||||
.row_2 {
|
||||
top: 250px;
|
||||
}
|
||||
.scale_2{
|
||||
left: 100px;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
/* test 'scale: <number>{2}'' */
|
||||
scale: 2 2;
|
||||
}
|
||||
.translate_2 {
|
||||
left: 150px;
|
||||
top: 200px;
|
||||
/* test 'translate: <length-percentage><length-percentage>' */
|
||||
translate: 150px 50px;
|
||||
}
|
||||
.rotate_2 {
|
||||
left: 450px;
|
||||
transform-origin: 50% 50%;
|
||||
/* test 'rotate: <number>{3}<angle>'*/
|
||||
rotate: 0 0 1 90deg;
|
||||
}
|
||||
.row_3 {
|
||||
transform: perspective(500px);
|
||||
top: 400px;
|
||||
}
|
||||
.scale_3{
|
||||
left: 100px;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
/* test 'scale: <number>{3}'' */
|
||||
scale: 2 2 2;
|
||||
}
|
||||
.translate_3 {
|
||||
left: 150px;
|
||||
/* test 'translate: <length-percentage><length>' */
|
||||
translate: 150px 10px 10px;
|
||||
}
|
||||
.rotate_3 {
|
||||
left: 450px;
|
||||
transform-origin: 50% 50%;
|
||||
/* test 'rotate: <number>{3}<angle>'*/
|
||||
rotate: 0 1 0 45deg;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="scale_1 row_1"></div>
|
||||
<div class="translate_1 row_1"></div>
|
||||
<div class="rotate_1 row_1"></div>
|
||||
<div class="scale_2 row_2"></div>
|
||||
<div class="translate_2 row_2"></div>
|
||||
<div class="rotate_2 row_2"></div>
|
||||
<div class="scale_3 row_3"></div>
|
||||
<div class="translate_3 row_3"></div>
|
||||
<div class="rotate_3 row_3"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,30 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Individual transform: combine individual transform properties</title>
|
||||
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#individual-transforms">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#ctm">
|
||||
<meta name="assert" content="Tests that we combine transforms in the correct order."/>
|
||||
<style>
|
||||
div {
|
||||
position: fixed;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
top: 200px;
|
||||
left: 200px;
|
||||
transform-origin: 0 0;
|
||||
border-style: solid;
|
||||
border-width: 10px 0px 10px 0px;
|
||||
border-color: lime;
|
||||
transform: translate(50px, 50px) rotate(45deg) scale(2, 2);
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,32 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Individual transform: combine individual transform properties</title>
|
||||
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#individual-transforms">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#ctm">
|
||||
<meta name="assert" content="Tests that we combine transforms in the correct order."/>
|
||||
<link rel="match" href="individual-transform-2-ref.html">
|
||||
<style>
|
||||
div {
|
||||
position: fixed;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
top: 200px;
|
||||
left: 200px;
|
||||
transform-origin: 0 0;
|
||||
border-style: solid;
|
||||
border-width: 10px 0px 10px 0px;
|
||||
border-color: lime;
|
||||
translate: 50px 50px;
|
||||
rotate: 45deg;
|
||||
scale: 2 2;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,32 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Individual transform: combine individual transform properties</title>
|
||||
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#individual-transforms">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#ctm">
|
||||
<meta name="assert" content="Tests that we combine transforms in the correct order."/>
|
||||
<link rel="match" href="individual-transform-2-ref.html">
|
||||
<style>
|
||||
div {
|
||||
position: fixed;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
top: 200px;
|
||||
left: 200px;
|
||||
transform-origin: 0 0;
|
||||
border-style: solid;
|
||||
border-width: 10px 0px 10px 0px;
|
||||
border-color: lime;
|
||||
rotate: 45deg;
|
||||
scale: 2 2;
|
||||
translate: 50px 50px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,32 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Individual transform: combine individual transform properties</title>
|
||||
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#individual-transforms">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#ctm">
|
||||
<meta name="assert" content="Tests that we combine transforms in the correct order."/>
|
||||
<link rel="match" href="individual-transform-2-ref.html">
|
||||
<style>
|
||||
div {
|
||||
position: fixed;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
top: 200px;
|
||||
left: 200px;
|
||||
transform-origin: 0 0;
|
||||
border-style: solid;
|
||||
border-width: 10px 0px 10px 0px;
|
||||
border-color: lime;
|
||||
translate: 50px 50px;
|
||||
rotate: 45deg;
|
||||
transform: scale(2, 2);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,31 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Individual transform: combine individual transform properties</title>
|
||||
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#individual-transforms">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#ctm">
|
||||
<meta name="assert" content="Tests that we combine transforms in the correct order."/>
|
||||
<link rel="match" href="individual-transform-2-ref.html">
|
||||
<style>
|
||||
div {
|
||||
position: fixed;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
top: 200px;
|
||||
left: 200px;
|
||||
transform-origin: 0 0;
|
||||
border-style: solid;
|
||||
border-width: 10px 0px 10px 0px;
|
||||
border-color: lime;
|
||||
translate: 50px 50px;
|
||||
transform: rotate(45deg) scale(2, 2);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,31 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Individual transform: combine individual transform properties</title>
|
||||
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#individual-transforms">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transforms-2/#ctm">
|
||||
<meta name="assert" content="Tests that we combine transforms in the correct order."/>
|
||||
<link rel="match" href="individual-transform-2-ref.html">
|
||||
<style>
|
||||
div {
|
||||
position: fixed;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
top: 200px;
|
||||
left: 200px;
|
||||
transform-origin: 0 0;
|
||||
border-style: solid;
|
||||
border-width: 10px 0px 10px 0px;
|
||||
border-color: lime;
|
||||
translate: 0px 50px;
|
||||
transform: translateX(50px) rotate(45deg) scale(2, 2);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div></div>
|
||||
</body>
|
||||
</html>
|
|
@ -5,11 +5,3 @@
|
|||
== perspective-zero.html reference/green.html
|
||||
== perspective-zero-2.html perspective-zero-2-ref.html
|
||||
== perspective-untransformable-no-stacking-context.html perspective-untransformable-no-stacking-context-ref.html
|
||||
|
||||
default-preferences pref(layout.css.individual-transform.enabled,true)
|
||||
== individual-transform-1.html individual-transform-1-ref.html
|
||||
== individual-transform-2a.html individual-transform-2-ref.html
|
||||
== individual-transform-2b.html individual-transform-2-ref.html
|
||||
== individual-transform-2c.html individual-transform-2-ref.html
|
||||
== individual-transform-2d.html individual-transform-2-ref.html
|
||||
== individual-transform-2e.html individual-transform-2-ref.html
|
||||
|
|
|
@ -104,6 +104,7 @@ SERIALIZED_PREDEFINED_TYPES = [
|
|||
"Opacity",
|
||||
"Quotes",
|
||||
"Resize",
|
||||
"Scale",
|
||||
"TextAlign",
|
||||
"TimingFunction",
|
||||
"TransformStyle",
|
||||
|
|
|
@ -1373,53 +1373,6 @@ nsComputedDOMStyle::DoGetTranslate()
|
|||
});
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetScale()
|
||||
{
|
||||
return ReadIndividualTransformValue(StyleDisplay()->mSpecifiedScale,
|
||||
[](const nsCSSValue::Array* aData, nsString& aResult) {
|
||||
switch (nsStyleTransformMatrix::TransformFunctionOf(aData)) {
|
||||
/* scale : <number> */
|
||||
case eCSSKeyword_scalex:
|
||||
MOZ_ASSERT(aData->Count() == 2, "Invalid array!");
|
||||
aResult.AppendFloat(aData->Item(1).GetFloatValue());
|
||||
break;
|
||||
/* scale : <number> <number>*/
|
||||
case eCSSKeyword_scale: {
|
||||
MOZ_ASSERT(aData->Count() == 3, "Invalid array!");
|
||||
aResult.AppendFloat(aData->Item(1).GetFloatValue());
|
||||
|
||||
float sy = aData->Item(2).GetFloatValue();
|
||||
if (sy != 1.) {
|
||||
aResult.AppendLiteral(" ");
|
||||
aResult.AppendFloat(sy);
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* scale : <number> <number> <number> */
|
||||
case eCSSKeyword_scale3d: {
|
||||
MOZ_ASSERT(aData->Count() == 4, "Invalid array!");
|
||||
aResult.AppendFloat(aData->Item(1).GetFloatValue());
|
||||
|
||||
float sy = aData->Item(2).GetFloatValue();
|
||||
float sz = aData->Item(3).GetFloatValue();
|
||||
|
||||
if (sy != 1. || sz != 1.) {
|
||||
aResult.AppendLiteral(" ");
|
||||
aResult.AppendFloat(sy);
|
||||
}
|
||||
if (sz != 1.) {
|
||||
aResult.AppendLiteral(" ");
|
||||
aResult.AppendFloat(sz);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Unexpected CSS keyword.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetRotate()
|
||||
{
|
||||
|
|
|
@ -367,7 +367,6 @@ private:
|
|||
already_AddRefed<CSSValue> DoGetTransform();
|
||||
already_AddRefed<CSSValue> DoGetTranslate();
|
||||
already_AddRefed<CSSValue> DoGetRotate();
|
||||
already_AddRefed<CSSValue> DoGetScale();
|
||||
already_AddRefed<CSSValue> DoGetTransformOrigin();
|
||||
already_AddRefed<CSSValue> DoGetPerspective();
|
||||
already_AddRefed<CSSValue> DoGetPerspectiveOrigin();
|
||||
|
|
|
@ -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)?,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -367,8 +367,9 @@ impl Scale {
|
|||
pub fn to_transform_operation(&self) -> Option<TransformOperation> {
|
||||
match *self {
|
||||
generic::Scale::None => None,
|
||||
generic::Scale::ScaleX(sx) => Some(generic::TransformOperation::ScaleX(sx)),
|
||||
generic::Scale::Scale(sx, sy) => Some(generic::TransformOperation::Scale(sx, Some(sy))),
|
||||
generic::Scale::Scale(sx, sy) => {
|
||||
Some(generic::TransformOperation::Scale(sx, Some(sy)))
|
||||
},
|
||||
generic::Scale::Scale3D(sx, sy, sz) => {
|
||||
Some(generic::TransformOperation::Scale3D(sx, sy, sz))
|
||||
},
|
||||
|
@ -378,8 +379,8 @@ impl Scale {
|
|||
/// Convert Scale to TransformOperation.
|
||||
pub fn from_transform_operation(operation: &TransformOperation) -> Scale {
|
||||
match *operation {
|
||||
generic::TransformOperation::ScaleX(sx) => generic::Scale::ScaleX(sx),
|
||||
generic::TransformOperation::Scale(sx, Some(sy)) => generic::Scale::Scale(sx, sy),
|
||||
generic::TransformOperation::Scale(sx, None) => generic::Scale::Scale(sx, sx),
|
||||
generic::TransformOperation::Scale3D(sx, sy, sz) => generic::Scale::Scale3D(sx, sy, sz),
|
||||
_ => unreachable!("Found unexpected value for scale"),
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
use app_units::Au;
|
||||
use euclid::{self, Rect, Transform3D};
|
||||
use num_traits::Zero;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ToCss};
|
||||
use values::{computed, CSSFloat};
|
||||
use values::computed::length::Length as ComputedLength;
|
||||
use values::computed::length::LengthOrPercentage as ComputedLengthOrPercentage;
|
||||
|
@ -560,7 +562,6 @@ pub enum Rotate<Number, Angle> {
|
|||
SpecifiedValueInfo,
|
||||
ToAnimatedZero,
|
||||
ToComputedValue,
|
||||
ToCss,
|
||||
)]
|
||||
/// A value of the `Scale` property
|
||||
///
|
||||
|
@ -568,14 +569,38 @@ pub enum Rotate<Number, Angle> {
|
|||
pub enum Scale<Number> {
|
||||
/// 'none'
|
||||
None,
|
||||
/// '<number>'
|
||||
ScaleX(Number),
|
||||
/// '<number>{2}'
|
||||
/// '<number>{1,2}'
|
||||
Scale(Number, Number),
|
||||
/// '<number>{3}'
|
||||
Scale3D(Number, Number, Number),
|
||||
}
|
||||
|
||||
impl<Number: ToCss + PartialEq> ToCss for Scale<Number> {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: fmt::Write,
|
||||
{
|
||||
match self {
|
||||
&Scale::None => dest.write_str("none"),
|
||||
&Scale::Scale(ref x, ref y) => {
|
||||
x.to_css(dest)?;
|
||||
if x != y {
|
||||
dest.write_char(' ')?;
|
||||
y.to_css(dest)?;
|
||||
}
|
||||
Ok(())
|
||||
},
|
||||
&Scale::Scale3D(ref x, ref y, ref z) => {
|
||||
x.to_css(dest)?;
|
||||
dest.write_char(' ')?;
|
||||
y.to_css(dest)?;
|
||||
dest.write_char(' ')?;
|
||||
z.to_css(dest)
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
Clone,
|
||||
ComputeSquaredDistance,
|
||||
|
|
|
@ -423,6 +423,6 @@ impl Parse for Scale {
|
|||
}
|
||||
|
||||
// 'scale: <number>'
|
||||
Ok(generic::Scale::ScaleX(sx))
|
||||
Ok(generic::Scale::Scale(sx, sx))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
prefs: [layout.css.individual-transform.enabled:true]
|
|
@ -1,49 +1,7 @@
|
|||
[rotate-interpolation.html]
|
||||
["100deg" and "180deg" are valid rotate values]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "100deg" and "180deg" at progress -1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "100deg" and "180deg" at progress 0]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "100deg" and "180deg" at progress 0.125]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "100deg" and "180deg" at progress 0.875]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "100deg" and "180deg" at progress 1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "100deg" and "180deg" at progress 2]
|
||||
expected: FAIL
|
||||
|
||||
["45deg" and "-1 1 0 60deg" are valid rotate values]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "45deg" and "-1 1 0 60deg" at progress -1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "45deg" and "-1 1 0 60deg" at progress 0]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "45deg" and "-1 1 0 60deg" at progress 0.125]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "45deg" and "-1 1 0 60deg" at progress 0.875]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "45deg" and "-1 1 0 60deg" at progress 1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "45deg" and "-1 1 0 60deg" at progress 2]
|
||||
expected: FAIL
|
||||
|
||||
["none" and "7 -8 9 400grad" are valid rotate values]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "7 -8 9 400grad" at progress -1]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -62,9 +20,6 @@
|
|||
[Animation between "none" and "7 -8 9 400grad" at progress 2]
|
||||
expected: FAIL
|
||||
|
||||
["none" and "none" are valid rotate values]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "none" at progress -1]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,106 +1,9 @@
|
|||
[scale-interpolation.html]
|
||||
["2 30 400" and "10 110 1200" are valid scale values]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "2 30 400" and "10 110 1200" at progress -1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "2 30 400" and "10 110 1200" at progress 0]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "2 30 400" and "10 110 1200" at progress 0.125]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "2 30 400" and "10 110 1200" at progress 0.875]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "2 30 400" and "10 110 1200" at progress 1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "2 30 400" and "10 110 1200" at progress 2]
|
||||
expected: FAIL
|
||||
|
||||
["26 17 9" and "2" are valid scale values]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "26 17 9" and "2" at progress -1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "26 17 9" and "2" at progress 0]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "26 17 9" and "2" at progress 0.125]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "26 17 9" and "2" at progress 0.875]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "26 17 9" and "2" at progress 1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "26 17 9" and "2" at progress 2]
|
||||
expected: FAIL
|
||||
|
||||
["none" and "4 3 2" are valid scale values]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "4 3 2" at progress -1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "4 3 2" at progress 0]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "4 3 2" at progress 0.125]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "4 3 2" at progress 0.875]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "4 3 2" at progress 1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "4 3 2" at progress 2]
|
||||
expected: FAIL
|
||||
|
||||
["none" and "none" are valid scale values]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "none" at progress -1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "none" at progress 0]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "none" at progress 0.125]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "none" at progress 0.875]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "none" at progress 1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "none" at progress 2]
|
||||
expected: FAIL
|
||||
|
||||
["26 17 9" and "2 1" are valid scale values]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "26 17 9" and "2 1" at progress -1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "26 17 9" and "2 1" at progress 0]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "26 17 9" and "2 1" at progress 0.125]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "26 17 9" and "2 1" at progress 0.875]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "26 17 9" and "2 1" at progress 1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "26 17 9" and "2 1" at progress 2]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,70 +1,7 @@
|
|||
[translate-interpolation.html]
|
||||
["220px 240px 260px" and "300px 400px 500px" are valid translate values]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "220px 240px 260px" and "300px 400px 500px" at progress -1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "220px 240px 260px" and "300px 400px 500px" at progress 0]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "220px 240px 260px" and "300px 400px 500px" at progress 0.125]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "220px 240px 260px" and "300px 400px 500px" at progress 0.875]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "220px 240px 260px" and "300px 400px 500px" at progress 1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "220px 240px 260px" and "300px 400px 500px" at progress 2]
|
||||
expected: FAIL
|
||||
|
||||
["480px 400px 320px" and "240% 160%" are valid translate values]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "480px 400px 320px" and "240% 160%" at progress -1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "480px 400px 320px" and "240% 160%" at progress 0]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "480px 400px 320px" and "240% 160%" at progress 0.125]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "480px 400px 320px" and "240% 160%" at progress 0.875]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "480px 400px 320px" and "240% 160%" at progress 1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "480px 400px 320px" and "240% 160%" at progress 2]
|
||||
expected: FAIL
|
||||
|
||||
["none" and "8px 80% 800px" are valid translate values]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "8px 80% 800px" at progress -1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "8px 80% 800px" at progress 0]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "8px 80% 800px" at progress 0.125]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "8px 80% 800px" at progress 0.875]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "8px 80% 800px" at progress 1]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "8px 80% 800px" at progress 2]
|
||||
expected: FAIL
|
||||
|
||||
["none" and "none" are valid translate values]
|
||||
expected: FAIL
|
||||
|
||||
[Animation between "none" and "none" at progress -1]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[individual-transform-1.html]
|
||||
type: reftest
|
||||
prefs: [layout.css.individual-transform.enabled:true]
|
||||
expected: FAIL
|
|
@ -1,3 +0,0 @@
|
|||
[individual-transform-2a.html]
|
||||
type: reftest
|
||||
prefs: [layout.css.individual-transform.enabled:true]
|
|
@ -1,3 +0,0 @@
|
|||
[individual-transform-2b.html]
|
||||
type: reftest
|
||||
prefs: [layout.css.individual-transform.enabled:true]
|
|
@ -1,3 +0,0 @@
|
|||
[individual-transform-2c.html]
|
||||
type: reftest
|
||||
prefs: [layout.css.individual-transform.enabled:true]
|
|
@ -1,3 +0,0 @@
|
|||
[individual-transform-2d.html]
|
||||
type: reftest
|
||||
prefs: [layout.css.individual-transform.enabled:true]
|
|
@ -1,3 +0,0 @@
|
|||
[individual-transform-2e.html]
|
||||
type: reftest
|
||||
prefs: [layout.css.individual-transform.enabled:true]
|
|
@ -19,13 +19,3 @@
|
|||
|
||||
[e.style['rotate'\] = "400grad z" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['rotate'\] = "none" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['rotate'\] = "0deg" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['rotate'\] = "100 200 300 400grad" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
[scale-parsing-valid.html]
|
||||
[e.style['scale'\] = "none" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['scale'\] = "1" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['scale'\] = "100 200" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['scale'\] = "100 200 300" should set the property value]
|
||||
expected: FAIL
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
[translate-parsing-valid.html]
|
||||
[Serialization should round-trip after setting e.style['translate'\] = "0"]
|
||||
expected: FAIL
|
||||
|
||||
[Serialization should round-trip after setting e.style['translate'\] = "1px 2px 0"]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['translate'\] = "0" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['translate'\] = "1px 2px 0" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['translate'\] = "none" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['translate'\] = "0px" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['translate'\] = "100%" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['translate'\] = "100px 200%" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['translate'\] = "100% 200px" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['translate'\] = "100px 200px 300px" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['translate'\] = "100% 200% 300px" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['translate'\] = "calc(10% + 10px) calc(20% + 20px) calc(30em + 30px)" should set the property value]
|
||||
expected: FAIL
|
||||
|
|
@ -1,10 +1,3 @@
|
|||
[transforms-support-calc.html]
|
||||
[translate supports calc]
|
||||
expected: FAIL
|
||||
|
||||
[rotate supports calc]
|
||||
expected: FAIL
|
||||
|
||||
[scale supports calc]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -16,8 +16,10 @@ test_valid_value("scale", "none");
|
|||
|
||||
test_valid_value("scale", "1");
|
||||
|
||||
test_valid_value("scale", "100 100", "100");
|
||||
test_valid_value("scale", "100 200");
|
||||
|
||||
test_valid_value("scale", "100 200 1");
|
||||
test_valid_value("scale", "100 200 300");
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -1976,7 +1976,7 @@ const scaleListType = {
|
|||
1000);
|
||||
|
||||
testAnimationSamples(animation, idlName,
|
||||
[{ time: 500, expected: '4 4' }]);
|
||||
[{ time: 500, expected: '4' }]);
|
||||
}, `${property} with one unspecified value`);
|
||||
|
||||
test(t => {
|
||||
|
@ -2012,8 +2012,8 @@ const scaleListType = {
|
|||
composite: 'add' });
|
||||
|
||||
testAnimationSamples(animation, idlName,
|
||||
[{ time: 0, expected: '-6 -6' },
|
||||
{ time: 1000, expected: '10 10' }]);
|
||||
[{ time: 0, expected: '-6' },
|
||||
{ time: 1000, expected: '10' }]);
|
||||
}, `${property} with one unspecified value`);
|
||||
|
||||
test(t => {
|
||||
|
@ -2052,8 +2052,8 @@ const scaleListType = {
|
|||
composite: 'accumulate' });
|
||||
|
||||
testAnimationSamples(animation, idlName,
|
||||
[{ time: 0, expected: '-2 -2' },
|
||||
{ time: 1000, expected: '6 6' }]);
|
||||
[{ time: 0, expected: '-2' },
|
||||
{ time: 1000, expected: '6' }]);
|
||||
}, `${property} with one unspecified value`);
|
||||
|
||||
test(t => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче