Skip to content
Snippets Groups Projects
Commit 1ee15cf6 authored by Hiroyuki Ikezoe's avatar Hiroyuki Ikezoe
Browse files

Bug 1615194 - Avoid the conversion to matrix for individual transform properties. r=boris

We can tell the scale value for the properties without the matrix.

Differential Revision: https://phabricator.services.mozilla.com/D62699

--HG--
extra : moz-landing-system : lando
parent a49049ce
No related branches found
No related tags found
No related merge requests found
......@@ -111,23 +111,16 @@ const mozilla::StylePositionOrAuto& AnimationValue::GetOffsetAnchorProperty()
Size AnimationValue::GetScaleValue(const nsIFrame* aFrame) const {
using namespace nsStyleTransformMatrix;
const StyleTranslate* translate = nullptr;
const StyleRotate* rotate = nullptr;
const StyleScale* scale = nullptr;
const StyleTransform* transform = nullptr;
switch (Servo_AnimationValue_GetPropertyId(mServo)) {
case eCSSProperty_scale:
scale = &GetScaleProperty();
break;
case eCSSProperty_translate:
translate = &GetTranslateProperty();
break;
case eCSSProperty_scale: {
const StyleScale& scale = GetScaleProperty();
return scale.IsNone() ? Size(1.0, 1.0)
: Size(scale.AsScale()._0, scale.AsScale()._1);
}
case eCSSProperty_rotate:
rotate = &GetRotateProperty();
break;
case eCSSProperty_translate:
return Size(1.0, 1.0);
case eCSSProperty_transform:
transform = &GetTransformProperty();
break;
default:
MOZ_ASSERT_UNREACHABLE(
......@@ -137,11 +130,9 @@ Size AnimationValue::GetScaleValue(const nsIFrame* aFrame) const {
TransformReferenceBox refBox(aFrame);
Matrix4x4 t =
ReadTransforms(translate ? *translate : StyleTranslate::None(),
rotate ? *rotate : StyleRotate::None(),
scale ? *scale : StyleScale::None(), Nothing(),
transform ? *transform : StyleTransform(), refBox,
aFrame->PresContext()->AppUnitsPerDevPixel());
ReadTransforms(StyleTranslate::None(), StyleRotate::None(),
StyleScale::None(), Nothing(), GetTransformProperty(),
refBox, aFrame->PresContext()->AppUnitsPerDevPixel());
Matrix transform2d;
bool canDraw2D = t.CanDraw2D(&transform2d);
if (!canDraw2D) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment