mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
stylo: Preserve the variant of scale() values in computed transforms
This commit is contained in:
parent
83e3394904
commit
e74d04c040
4 changed files with 36 additions and 3 deletions
|
@ -3073,6 +3073,9 @@ fn static_assert() {
|
||||||
${transform_function_arm("TranslateY", "translatey", ["lop"])}
|
${transform_function_arm("TranslateY", "translatey", ["lop"])}
|
||||||
${transform_function_arm("TranslateZ", "translatez", ["length"])}
|
${transform_function_arm("TranslateZ", "translatez", ["length"])}
|
||||||
${transform_function_arm("Translate", "translate3d", ["lop", "lop", "length"])}
|
${transform_function_arm("Translate", "translate3d", ["lop", "lop", "length"])}
|
||||||
|
${transform_function_arm("ScaleX", "scalex", ["number"])}
|
||||||
|
${transform_function_arm("ScaleY", "scaley", ["number"])}
|
||||||
|
${transform_function_arm("ScaleZ", "scalez", ["number"])}
|
||||||
${transform_function_arm("Scale", "scale3d", ["number"] * 3)}
|
${transform_function_arm("Scale", "scale3d", ["number"] * 3)}
|
||||||
${transform_function_arm("Rotate", "rotate3d", ["number"] * 3 + ["angle"])}
|
${transform_function_arm("Rotate", "rotate3d", ["number"] * 3 + ["angle"])}
|
||||||
${transform_function_arm("Perspective", "perspective", ["length"])}
|
${transform_function_arm("Perspective", "perspective", ["length"])}
|
||||||
|
@ -3197,6 +3200,9 @@ fn static_assert() {
|
||||||
${computed_operation_arm("TranslateY", "translatey", ["lop"])}
|
${computed_operation_arm("TranslateY", "translatey", ["lop"])}
|
||||||
${computed_operation_arm("TranslateZ", "translatez", ["length"])}
|
${computed_operation_arm("TranslateZ", "translatez", ["length"])}
|
||||||
${computed_operation_arm("Translate", "translate3d", ["lop", "lop", "length"])}
|
${computed_operation_arm("Translate", "translate3d", ["lop", "lop", "length"])}
|
||||||
|
${computed_operation_arm("ScaleX", "scalex", ["number"])}
|
||||||
|
${computed_operation_arm("ScaleY", "scaley", ["number"])}
|
||||||
|
${computed_operation_arm("ScaleZ", "scalez", ["number"])}
|
||||||
${computed_operation_arm("Scale", "scale3d", ["number"] * 3)}
|
${computed_operation_arm("Scale", "scale3d", ["number"] * 3)}
|
||||||
${computed_operation_arm("Rotate", "rotate3d", ["number"] * 3 + ["angle"])}
|
${computed_operation_arm("Rotate", "rotate3d", ["number"] * 3 + ["angle"])}
|
||||||
${computed_operation_arm("Perspective", "perspective", ["length"])}
|
${computed_operation_arm("Perspective", "perspective", ["length"])}
|
||||||
|
|
|
@ -1160,6 +1160,9 @@ impl ToAnimatedZero for TransformOperation {
|
||||||
TransformOperation::Scale(..) => {
|
TransformOperation::Scale(..) => {
|
||||||
Ok(TransformOperation::Scale(1.0, 1.0, 1.0))
|
Ok(TransformOperation::Scale(1.0, 1.0, 1.0))
|
||||||
},
|
},
|
||||||
|
TransformOperation::ScaleX(_) => Ok(TransformOperation::ScaleX(1.)),
|
||||||
|
TransformOperation::ScaleY(_) => Ok(TransformOperation::ScaleY(1.)),
|
||||||
|
TransformOperation::ScaleZ(_) => Ok(TransformOperation::ScaleZ(1.)),
|
||||||
TransformOperation::Rotate(x, y, z, a) => {
|
TransformOperation::Rotate(x, y, z, a) => {
|
||||||
let (x, y, z, _) = TransformList::get_normalized_vector_and_angle(x, y, z, a);
|
let (x, y, z, _) = TransformList::get_normalized_vector_and_angle(x, y, z, a);
|
||||||
Ok(TransformOperation::Rotate(x, y, z, Angle::zero()))
|
Ok(TransformOperation::Rotate(x, y, z, Angle::zero()))
|
||||||
|
|
|
@ -689,6 +689,9 @@ ${helpers.predefined_type(
|
||||||
Translate(computed::LengthOrPercentage,
|
Translate(computed::LengthOrPercentage,
|
||||||
computed::LengthOrPercentage,
|
computed::LengthOrPercentage,
|
||||||
computed::Length),
|
computed::Length),
|
||||||
|
ScaleX(CSSFloat),
|
||||||
|
ScaleY(CSSFloat),
|
||||||
|
ScaleZ(CSSFloat),
|
||||||
Scale(CSSFloat, CSSFloat, CSSFloat),
|
Scale(CSSFloat, CSSFloat, CSSFloat),
|
||||||
Rotate(CSSFloat, CSSFloat, CSSFloat, computed::Angle),
|
Rotate(CSSFloat, CSSFloat, CSSFloat, computed::Angle),
|
||||||
Perspective(computed::Length),
|
Perspective(computed::Length),
|
||||||
|
@ -1292,15 +1295,15 @@ ${helpers.predefined_type(
|
||||||
}
|
}
|
||||||
SpecifiedOperation::ScaleX(sx) => {
|
SpecifiedOperation::ScaleX(sx) => {
|
||||||
let sx = sx.to_computed_value(context);
|
let sx = sx.to_computed_value(context);
|
||||||
result.push(computed_value::ComputedOperation::Scale(sx, 1.0, 1.0));
|
result.push(computed_value::ComputedOperation::ScaleX(sx));
|
||||||
}
|
}
|
||||||
SpecifiedOperation::ScaleY(sy) => {
|
SpecifiedOperation::ScaleY(sy) => {
|
||||||
let sy = sy.to_computed_value(context);
|
let sy = sy.to_computed_value(context);
|
||||||
result.push(computed_value::ComputedOperation::Scale(1.0, sy, 1.0));
|
result.push(computed_value::ComputedOperation::ScaleY(sy));
|
||||||
}
|
}
|
||||||
SpecifiedOperation::ScaleZ(sz) => {
|
SpecifiedOperation::ScaleZ(sz) => {
|
||||||
let sz = sz.to_computed_value(context);
|
let sz = sz.to_computed_value(context);
|
||||||
result.push(computed_value::ComputedOperation::Scale(1.0, 1.0, sz));
|
result.push(computed_value::ComputedOperation::ScaleZ(sz));
|
||||||
}
|
}
|
||||||
SpecifiedOperation::Scale3D(sx, sy, sz) => {
|
SpecifiedOperation::Scale3D(sx, sy, sz) => {
|
||||||
let sx = sx.to_computed_value(context);
|
let sx = sx.to_computed_value(context);
|
||||||
|
@ -1435,6 +1438,18 @@ ${helpers.predefined_type(
|
||||||
ToComputedValue::from_computed_value(ty),
|
ToComputedValue::from_computed_value(ty),
|
||||||
ToComputedValue::from_computed_value(tz)));
|
ToComputedValue::from_computed_value(tz)));
|
||||||
}
|
}
|
||||||
|
computed_value::ComputedOperation::ScaleX(ref sx) => {
|
||||||
|
result.push(SpecifiedOperation::ScaleX(
|
||||||
|
ToComputedValue::from_computed_value(sx)));
|
||||||
|
}
|
||||||
|
computed_value::ComputedOperation::ScaleY(ref sy) => {
|
||||||
|
result.push(SpecifiedOperation::ScaleY(
|
||||||
|
ToComputedValue::from_computed_value(sy)));
|
||||||
|
}
|
||||||
|
computed_value::ComputedOperation::ScaleZ(ref sz) => {
|
||||||
|
result.push(SpecifiedOperation::ScaleZ(
|
||||||
|
ToComputedValue::from_computed_value(sz)));
|
||||||
|
}
|
||||||
computed_value::ComputedOperation::Scale(ref sx, ref sy, ref sz) => {
|
computed_value::ComputedOperation::Scale(ref sx, ref sy, ref sz) => {
|
||||||
result.push(SpecifiedOperation::Scale3D(
|
result.push(SpecifiedOperation::Scale3D(
|
||||||
Number::from_computed_value(sx),
|
Number::from_computed_value(sx),
|
||||||
|
|
|
@ -89,6 +89,15 @@ impl TransformList {
|
||||||
ComputedOperation::Perspective(d) => {
|
ComputedOperation::Perspective(d) => {
|
||||||
Self::create_perspective_matrix(d.px())
|
Self::create_perspective_matrix(d.px())
|
||||||
}
|
}
|
||||||
|
ComputedOperation::ScaleX(sx) => {
|
||||||
|
Transform3D::create_scale(sx, 1., 1.)
|
||||||
|
}
|
||||||
|
ComputedOperation::ScaleY(sy) => {
|
||||||
|
Transform3D::create_scale(1., sy, 1.)
|
||||||
|
}
|
||||||
|
ComputedOperation::ScaleZ(sz) => {
|
||||||
|
Transform3D::create_scale(1., 1., sz)
|
||||||
|
}
|
||||||
ComputedOperation::Scale(sx, sy, sz) => {
|
ComputedOperation::Scale(sx, sy, sz) => {
|
||||||
Transform3D::create_scale(sx, sy, sz)
|
Transform3D::create_scale(sx, sy, sz)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue