mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Handle rotate, rotate{x|y|z}, and skew{x|y} properly when cloning transforms.
This commit is contained in:
parent
52c81a0a84
commit
3a29c63250
1 changed files with 30 additions and 1 deletions
|
@ -3081,6 +3081,13 @@ fn static_assert() {
|
|||
};
|
||||
|
||||
unsafe {
|
||||
use gecko_bindings::structs::nsCSSKeyword;
|
||||
use values::computed::Angle;
|
||||
|
||||
let get_array_angle = || -> Angle {
|
||||
bindings::Gecko_CSSValue_GetArrayItemConst(gecko_value, 1).get_angle()
|
||||
};
|
||||
|
||||
match transform_function {
|
||||
${computed_operation_arm("Matrix", "matrix3d", ["number"] * 16)}
|
||||
${computed_operation_arm("Skew", "skew", ["angle"] * 2)}
|
||||
|
@ -3092,7 +3099,29 @@ fn static_assert() {
|
|||
["list"] * 2 + ["percentage"])}
|
||||
${computed_operation_arm("AccumulateMatrix", "accumulatematrix",
|
||||
["list"] * 2 + ["percentage_to_integer"])}
|
||||
_ => panic!("We shouldn't set any other transform function types"),
|
||||
// FIXME: Bug 1391145 will introduce new types for these keywords. For now, we
|
||||
// temporarily don't use |computed_operation_arm| because these are special cases
|
||||
// for compositor animations when we use Gecko style backend on the main thread,
|
||||
// and I don't want to add too many special cases in |computed_operation_arm|.
|
||||
//
|
||||
// Note: Gecko only converts translate and scale into the corresponding primitive
|
||||
// functions, so we still need to handle the following functions.
|
||||
nsCSSKeyword::eCSSKeyword_skewx => {
|
||||
ComputedOperation::Skew(get_array_angle(), Angle::zero())
|
||||
},
|
||||
nsCSSKeyword::eCSSKeyword_skewy => {
|
||||
ComputedOperation::Skew(Angle::zero(), get_array_angle())
|
||||
},
|
||||
nsCSSKeyword::eCSSKeyword_rotatex => {
|
||||
ComputedOperation::Rotate(1.0, 0.0, 0.0, get_array_angle())
|
||||
},
|
||||
nsCSSKeyword::eCSSKeyword_rotatey => {
|
||||
ComputedOperation::Rotate(0.0, 1.0, 0.0, get_array_angle())
|
||||
},
|
||||
nsCSSKeyword::eCSSKeyword_rotatez | nsCSSKeyword::eCSSKeyword_rotate => {
|
||||
ComputedOperation::Rotate(0.0, 0.0, 1.0, get_array_angle())
|
||||
},
|
||||
_ => panic!("{:?} is not an acceptable transform function", transform_function),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue