Commit 62ade40d authored by George Steel's avatar George Steel Committed by Commit Bot

make translate and scale interpolations return z-preserving OperationType

Set the OperationType in TransformOperation::Blend() according so that
it is a 3D operation type iff either of the blended values are
(previous behavior was to use the second value and ignore the first).
This makes Is3DOperation() work for interpolated operations stops
z values getting dropped during serialization.

Bug: 1057307
Change-Id: Ibcbb3125660ab172a0f65f08b8ccd67534cdd665
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2102640Reviewed-by: default avatarKevin Ellis <kevers@chromium.org>
Reviewed-by: default avatarRobert Flack <flackr@chromium.org>
Reviewed-by: default avatarIan Vollick <vollick@chromium.org>
Commit-Queue: George Steel <gtsteel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752071}
parent 4e8b1f31
...@@ -76,9 +76,11 @@ scoped_refptr<TransformOperation> ScaleTransformOperation::Blend( ...@@ -76,9 +76,11 @@ scoped_refptr<TransformOperation> ScaleTransformOperation::Blend(
double from_x = from_op ? from_op->x_ : 1.0; double from_x = from_op ? from_op->x_ : 1.0;
double from_y = from_op ? from_op->y_ : 1.0; double from_y = from_op ? from_op->y_ : 1.0;
double from_z = from_op ? from_op->z_ : 1.0; double from_z = from_op ? from_op->z_ : 1.0;
bool is_3d = Is3DOperation() || (from && from->Is3DOperation());
return ScaleTransformOperation::Create( return ScaleTransformOperation::Create(
blink::Blend(from_x, x_, progress), blink::Blend(from_y, y_, progress), blink::Blend(from_x, x_, progress), blink::Blend(from_y, y_, progress),
blink::Blend(from_z, z_, progress), type_); blink::Blend(from_z, z_, progress), is_3d ? kScale3D : kScale);
} }
bool ScaleTransformOperation::CanBlendWith( bool ScaleTransformOperation::CanBlendWith(
......
...@@ -46,15 +46,15 @@ TransformOperation::OperationType GetTypeForTranslate(const Length& x, ...@@ -46,15 +46,15 @@ TransformOperation::OperationType GetTypeForTranslate(const Length& x,
bool x_zero = x.IsZero(); bool x_zero = x.IsZero();
bool y_zero = x.IsZero(); bool y_zero = x.IsZero();
bool z_zero = !z; bool z_zero = !z;
if (!x_zero && !y_zero && !z_zero)
return TransformOperation::kTranslate3D;
if (y_zero && z_zero) if (y_zero && z_zero)
return TransformOperation::kTranslateX; return TransformOperation::kTranslateX;
if (x_zero && z_zero) if (x_zero && z_zero)
return TransformOperation::kTranslateY; return TransformOperation::kTranslateY;
if (x_zero && y_zero) if (x_zero && y_zero)
return TransformOperation::kTranslateZ; return TransformOperation::kTranslateZ;
return TransformOperation::kTranslate; if (z_zero)
return TransformOperation::kTranslate;
return TransformOperation::kTranslate3D;
} }
} // namespace } // namespace
...@@ -89,10 +89,12 @@ scoped_refptr<TransformOperation> TranslateTransformOperation::Blend( ...@@ -89,10 +89,12 @@ scoped_refptr<TransformOperation> TranslateTransformOperation::Blend(
const Length& from_x = from_op ? from_op->x_ : zero_length; const Length& from_x = from_op ? from_op->x_ : zero_length;
const Length& from_y = from_op ? from_op->y_ : zero_length; const Length& from_y = from_op ? from_op->y_ : zero_length;
double from_z = from_op ? from_op->z_ : 0; double from_z = from_op ? from_op->z_ : 0;
bool is_3d = Is3DOperation() || (from && from->Is3DOperation());
return TranslateTransformOperation::Create( return TranslateTransformOperation::Create(
x_.Blend(from_x, progress, kValueRangeAll), x_.Blend(from_x, progress, kValueRangeAll),
y_.Blend(from_y, progress, kValueRangeAll), y_.Blend(from_y, progress, kValueRangeAll),
blink::Blend(from_z, z_, progress), type_); blink::Blend(from_z, z_, progress), is_3d ? kTranslate3D : kTranslate);
} }
bool TranslateTransformOperation::CanBlendWith( bool TranslateTransformOperation::CanBlendWith(
......
This is a testharness.js-based test. This is a testharness.js-based test.
Found 87 tests; 29 PASS, 58 FAIL, 0 TIMEOUT, 0 NOTRUN. Found 87 tests; 34 PASS, 53 FAIL, 0 TIMEOUT, 0 NOTRUN.
FAIL Interpolation between translateX(0px) and translateX(50px) gives the correct computed value halfway according to computedStyleMap. assert_equals: The value at 50% progress is as expected expected "translateX(25px)" but got "translate(25px, 0px)" FAIL Interpolation between translateX(0px) and translateX(50px) gives the correct computed value halfway according to computedStyleMap. assert_equals: The value at 50% progress is as expected expected "translateX(25px)" but got "translate(25px, 0px)"
FAIL Interpolation between translateX(0px) and translateX(50px) gives the correct computed value halfway according to computedStyleMap with zoom active. assert_equals: The value at 50% progress is as expected expected "translateX(25px)" but got "translate(25px, 0px)" FAIL Interpolation between translateX(0px) and translateX(50px) gives the correct computed value halfway according to computedStyleMap with zoom active. assert_equals: The value at 50% progress is as expected expected "translateX(25px)" but got "translate(25px, 0px)"
FAIL Interpolation between translateX(0px) and translateX(50px) gives the correct computed value halfway according to commitStyles. assert_equals: The value at 50% progress is as expected expected "translateX(25px)" but got "matrix(1, 0, 0, 1, 25, 0)" FAIL Interpolation between translateX(0px) and translateX(50px) gives the correct computed value halfway according to commitStyles. assert_equals: The value at 50% progress is as expected expected "translateX(25px)" but got "matrix(1, 0, 0, 1, 25, 0)"
...@@ -15,8 +15,8 @@ FAIL Interpolation between translateX(50px) and translateY(50px) gives the corre ...@@ -15,8 +15,8 @@ FAIL Interpolation between translateX(50px) and translateY(50px) gives the corre
PASS Interpolation between translateX(50px) and translateZ(50px) gives the correct computed value halfway according to computedStyleMap. PASS Interpolation between translateX(50px) and translateZ(50px) gives the correct computed value halfway according to computedStyleMap.
FAIL Interpolation between translateX(50px) and translateZ(50px) gives the correct computed value halfway according to computedStyleMap with zoom active. assert_equals: The value at 50% progress is as expected expected "translate3d(25px, 0px, 25px)" but got "translate3d(25px, 0px, 31.25px)" FAIL Interpolation between translateX(50px) and translateZ(50px) gives the correct computed value halfway according to computedStyleMap with zoom active. assert_equals: The value at 50% progress is as expected expected "translate3d(25px, 0px, 25px)" but got "translate3d(25px, 0px, 31.25px)"
FAIL Interpolation between translateX(50px) and translateZ(50px) gives the correct computed value halfway according to commitStyles. assert_equals: The value at 50% progress is as expected expected "translate3d(25px, 0px, 25px)" but got "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 25, 0, 25, 1)" FAIL Interpolation between translateX(50px) and translateZ(50px) gives the correct computed value halfway according to commitStyles. assert_equals: The value at 50% progress is as expected expected "translate3d(25px, 0px, 25px)" but got "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 25, 0, 25, 1)"
FAIL Interpolation between translateZ(50px) and translateX(50px) gives the correct computed value halfway according to computedStyleMap. assert_equals: The value at 50% progress is as expected expected "translate3d(25px, 0px, 25px)" but got "translate(25px, 0px)" PASS Interpolation between translateZ(50px) and translateX(50px) gives the correct computed value halfway according to computedStyleMap.
FAIL Interpolation between translateZ(50px) and translateX(50px) gives the correct computed value halfway according to computedStyleMap with zoom active. assert_equals: The value at 50% progress is as expected expected "translate3d(25px, 0px, 25px)" but got "translate(25px, 0px)" FAIL Interpolation between translateZ(50px) and translateX(50px) gives the correct computed value halfway according to computedStyleMap with zoom active. assert_equals: The value at 50% progress is as expected expected "translate3d(25px, 0px, 25px)" but got "translate3d(25px, 0px, 31.25px)"
FAIL Interpolation between translateZ(50px) and translateX(50px) gives the correct computed value halfway according to commitStyles. assert_equals: The value at 50% progress is as expected expected "translate3d(25px, 0px, 25px)" but got "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 25, 0, 25, 1)" FAIL Interpolation between translateZ(50px) and translateX(50px) gives the correct computed value halfway according to commitStyles. assert_equals: The value at 50% progress is as expected expected "translate3d(25px, 0px, 25px)" but got "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 25, 0, 25, 1)"
FAIL Interpolation between translateZ(-50px) and translateZ(50px) gives the correct computed value halfway according to computedStyleMap. assert_equals: The value at 50% progress is as expected expected "translateZ(0px)" but got "translate3d(0px, 0px, 0px)" FAIL Interpolation between translateZ(-50px) and translateZ(50px) gives the correct computed value halfway according to computedStyleMap. assert_equals: The value at 50% progress is as expected expected "translateZ(0px)" but got "translate3d(0px, 0px, 0px)"
FAIL Interpolation between translateZ(-50px) and translateZ(50px) gives the correct computed value halfway according to computedStyleMap with zoom active. assert_equals: The value at 50% progress is as expected expected "translateZ(0px)" but got "translate3d(0px, 0px, 0px)" FAIL Interpolation between translateZ(-50px) and translateZ(50px) gives the correct computed value halfway according to computedStyleMap with zoom active. assert_equals: The value at 50% progress is as expected expected "translateZ(0px)" but got "translate3d(0px, 0px, 0px)"
...@@ -57,8 +57,8 @@ FAIL Interpolation between scaleX(2) and scaleY(2) gives the correct computed va ...@@ -57,8 +57,8 @@ FAIL Interpolation between scaleX(2) and scaleY(2) gives the correct computed va
PASS Interpolation between scaleX(2) and scaleY(3) gives the correct computed value halfway according to computedStyleMap. PASS Interpolation between scaleX(2) and scaleY(3) gives the correct computed value halfway according to computedStyleMap.
PASS Interpolation between scaleX(2) and scaleY(3) gives the correct computed value halfway according to computedStyleMap with zoom active. PASS Interpolation between scaleX(2) and scaleY(3) gives the correct computed value halfway according to computedStyleMap with zoom active.
FAIL Interpolation between scaleX(2) and scaleY(3) gives the correct computed value halfway according to commitStyles. assert_equals: The value at 50% progress is as expected expected "scale(1.5, 2)" but got "matrix(1.5, 0, 0, 2, 0, 0)" FAIL Interpolation between scaleX(2) and scaleY(3) gives the correct computed value halfway according to commitStyles. assert_equals: The value at 50% progress is as expected expected "scale(1.5, 2)" but got "matrix(1.5, 0, 0, 2, 0, 0)"
FAIL Interpolation between scaleZ(1) and scale(2) gives the correct computed value halfway according to computedStyleMap. assert_equals: The value at 50% progress is as expected expected "scale3d(1.5, 1.5, 1)" but got "scale(1.5, 1.5)" PASS Interpolation between scaleZ(1) and scale(2) gives the correct computed value halfway according to computedStyleMap.
FAIL Interpolation between scaleZ(1) and scale(2) gives the correct computed value halfway according to computedStyleMap with zoom active. assert_equals: The value at 50% progress is as expected expected "scale3d(1.5, 1.5, 1)" but got "scale(1.5, 1.5)" PASS Interpolation between scaleZ(1) and scale(2) gives the correct computed value halfway according to computedStyleMap with zoom active.
FAIL Interpolation between scaleZ(1) and scale(2) gives the correct computed value halfway according to commitStyles. assert_equals: The value at 50% progress is as expected expected "scale3d(1.5, 1.5, 1)" but got "matrix(1.5, 0, 0, 1.5, 0, 0)" FAIL Interpolation between scaleZ(1) and scale(2) gives the correct computed value halfway according to commitStyles. assert_equals: The value at 50% progress is as expected expected "scale3d(1.5, 1.5, 1)" but got "matrix(1.5, 0, 0, 1.5, 0, 0)"
PASS Interpolation between scale(1, 2) and scale(3, 4) gives the correct computed value halfway according to computedStyleMap. PASS Interpolation between scale(1, 2) and scale(3, 4) gives the correct computed value halfway according to computedStyleMap.
PASS Interpolation between scale(1, 2) and scale(3, 4) gives the correct computed value halfway according to computedStyleMap with zoom active. PASS Interpolation between scale(1, 2) and scale(3, 4) gives the correct computed value halfway according to computedStyleMap with zoom active.
...@@ -66,8 +66,8 @@ FAIL Interpolation between scale(1, 2) and scale(3, 4) gives the correct compute ...@@ -66,8 +66,8 @@ FAIL Interpolation between scale(1, 2) and scale(3, 4) gives the correct compute
PASS Interpolation between scale3d(1, 2, 3) and scale3d(4, 5, 6) gives the correct computed value halfway according to computedStyleMap. PASS Interpolation between scale3d(1, 2, 3) and scale3d(4, 5, 6) gives the correct computed value halfway according to computedStyleMap.
PASS Interpolation between scale3d(1, 2, 3) and scale3d(4, 5, 6) gives the correct computed value halfway according to computedStyleMap with zoom active. PASS Interpolation between scale3d(1, 2, 3) and scale3d(4, 5, 6) gives the correct computed value halfway according to computedStyleMap with zoom active.
FAIL Interpolation between scale3d(1, 2, 3) and scale3d(4, 5, 6) gives the correct computed value halfway according to commitStyles. assert_equals: The value at 50% progress is as expected expected "scale3d(2.5, 3.5, 4.5)" but got "matrix3d(2.5, 0, 0, 0, 0, 3.5, 0, 0, 0, 0, 4.5, 0, 0, 0, 0, 1)" FAIL Interpolation between scale3d(1, 2, 3) and scale3d(4, 5, 6) gives the correct computed value halfway according to commitStyles. assert_equals: The value at 50% progress is as expected expected "scale3d(2.5, 3.5, 4.5)" but got "matrix3d(2.5, 0, 0, 0, 0, 3.5, 0, 0, 0, 0, 4.5, 0, 0, 0, 0, 1)"
FAIL Interpolation between scale3d(1, 2, 3) and scale(4, 5) gives the correct computed value halfway according to computedStyleMap. assert_equals: The value at 50% progress is as expected expected "scale3d(2.5, 3.5, 2)" but got "scale(2.5, 3.5)" PASS Interpolation between scale3d(1, 2, 3) and scale(4, 5) gives the correct computed value halfway according to computedStyleMap.
FAIL Interpolation between scale3d(1, 2, 3) and scale(4, 5) gives the correct computed value halfway according to computedStyleMap with zoom active. assert_equals: The value at 50% progress is as expected expected "scale3d(2.5, 3.5, 2)" but got "scale(2.5, 3.5)" PASS Interpolation between scale3d(1, 2, 3) and scale(4, 5) gives the correct computed value halfway according to computedStyleMap with zoom active.
FAIL Interpolation between scale3d(1, 2, 3) and scale(4, 5) gives the correct computed value halfway according to commitStyles. assert_equals: The value at 50% progress is as expected expected "scale3d(2.5, 3.5, 2)" but got "matrix3d(2.5, 0, 0, 0, 0, 3.5, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1)" FAIL Interpolation between scale3d(1, 2, 3) and scale(4, 5) gives the correct computed value halfway according to commitStyles. assert_equals: The value at 50% progress is as expected expected "scale3d(2.5, 3.5, 2)" but got "matrix3d(2.5, 0, 0, 0, 0, 3.5, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1)"
PASS Interpolation between scale(1, 2) and scale3d(3, 4, 5) gives the correct computed value halfway according to computedStyleMap. PASS Interpolation between scale(1, 2) and scale3d(3, 4, 5) gives the correct computed value halfway according to computedStyleMap.
PASS Interpolation between scale(1, 2) and scale3d(3, 4, 5) gives the correct computed value halfway according to computedStyleMap with zoom active. PASS Interpolation between scale(1, 2) and scale3d(3, 4, 5) gives the correct computed value halfway according to computedStyleMap with zoom active.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment