diff --git a/gfx/layers/wr/StackingContextHelper.cpp b/gfx/layers/wr/StackingContextHelper.cpp index 1c790e5761ae..570b305929cc 100644 --- a/gfx/layers/wr/StackingContextHelper.cpp +++ b/gfx/layers/wr/StackingContextHelper.cpp @@ -16,6 +16,7 @@ StackingContextHelper::StackingContextHelper() : mBuilder(nullptr) , mScale(1.0f, 1.0f) , mAffectsClipPositioning(false) + , mIsPreserve3D(false) { // mOrigin remains at 0,0 } @@ -36,10 +37,14 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen : mBuilder(&aBuilder) , mScale(1.0f, 1.0f) , mTransformForScrollData(aTransformForScrollData) + , mIsPreserve3D(aIsPreserve3D) { - // Compute scale for fallback rendering. + // Compute scale for fallback rendering. We don't try to guess a scale for 3d + // transformed items gfx::Matrix transform2d; - if (aBoundTransform && aBoundTransform->CanDraw2D(&transform2d)) { + if (aBoundTransform && aBoundTransform->CanDraw2D(&transform2d) + && !aPerspectivePtr + && !aParentSC.mIsPreserve3D) { mInheritedTransform = transform2d * aParentSC.mInheritedTransform; mScale = mInheritedTransform.ScaleFactors(true); } diff --git a/gfx/layers/wr/StackingContextHelper.h b/gfx/layers/wr/StackingContextHelper.h index 1ec06cc6fd28..0c9a8e0aa8c1 100644 --- a/gfx/layers/wr/StackingContextHelper.h +++ b/gfx/layers/wr/StackingContextHelper.h @@ -85,6 +85,7 @@ private: gfx::Matrix mInheritedTransform; bool mAffectsClipPositioning; Maybe mTransformForScrollData; + bool mIsPreserve3D; }; } // namespace layers diff --git a/layout/reftests/transform-3d/preserve3d-scale.html b/layout/reftests/transform-3d/preserve3d-scale.html new file mode 100644 index 000000000000..5a3694fa1aeb --- /dev/null +++ b/layout/reftests/transform-3d/preserve3d-scale.html @@ -0,0 +1,63 @@ + + + + + +
+ + + + + + + + + + + + + +
+ diff --git a/layout/reftests/transform-3d/reftest.list b/layout/reftests/transform-3d/reftest.list index a14df210976b..490f385ee8db 100644 --- a/layout/reftests/transform-3d/reftest.list +++ b/layout/reftests/transform-3d/reftest.list @@ -91,3 +91,4 @@ fuzzy-if(winWidget,150,120) == component-alpha-1.html component-alpha-1-ref.html == transform-geometry-1.html transform-geometry-1-ref.html == intermediate-1.html intermediate-1-ref.html == preserves3d-nested-filter-1.html preserves3d-nested-filter-1-ref.html +!= preserve3d-scale.html about:blank