From 75200fdf13ff4ffddae3123a252ad9698442a1e2 Mon Sep 17 00:00:00 2001 From: peter chang Date: Thu, 7 Sep 2017 11:50:41 +0800 Subject: [PATCH] Bug 1394308 - Pass perspective transform attribute to compositor for OMTA, r=kats MozReview-Commit-ID: EjyuCfnswqu --HG-- extra : rebase_source : 556db00f7c58b8b49bdafe9ca77785bce819a000 --- gfx/layers/wr/StackingContextHelper.cpp | 8 ++++++++ gfx/layers/wr/StackingContextHelper.h | 3 ++- layout/painting/nsDisplayList.cpp | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gfx/layers/wr/StackingContextHelper.cpp b/gfx/layers/wr/StackingContextHelper.cpp index e20a0714336b..8e8c4a24b90c 100644 --- a/gfx/layers/wr/StackingContextHelper.cpp +++ b/gfx/layers/wr/StackingContextHelper.cpp @@ -14,6 +14,7 @@ namespace layers { StackingContextHelper::StackingContextHelper() : mBuilder(nullptr) + , mHasPerspectiveTransform(false) , mXScale(1.0f) , mYScale(1.0f) { @@ -26,6 +27,7 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen const Maybe& aTransform, const nsTArray& aFilters) : mBuilder(&aBuilder) + , mHasPerspectiveTransform(false) , mXScale(1.0f) , mYScale(1.0f) { @@ -51,6 +53,7 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen gfx::Matrix4x4* aTransformPtr, const nsTArray& aFilters) : mBuilder(&aBuilder) + , mHasPerspectiveTransform(false) , mXScale(1.0f) , mYScale(1.0f) { @@ -83,6 +86,7 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen const nsTArray& aFilters, const gfx::CompositionOp& aMixBlendMode) : mBuilder(&aBuilder) + , mHasPerspectiveTransform(false) , mXScale(1.0f) , mYScale(1.0f) { @@ -92,6 +96,10 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen mTransform = *aTransformPtr; } + if (aPerspectivePtr) { + mHasPerspectiveTransform = true; + } + bool is2d = !aTransformPtr || (aTransformPtr->Is2D() && !aPerspectivePtr); if (is2d) { nsRect itemBounds = aDisplayList->GetClippedBoundsWithRespectToASR(aDisplayListBuilder, aItem->GetActiveScrolledRoot()); diff --git a/gfx/layers/wr/StackingContextHelper.h b/gfx/layers/wr/StackingContextHelper.h index ce1d3dba5a12..df2a543580e0 100644 --- a/gfx/layers/wr/StackingContextHelper.h +++ b/gfx/layers/wr/StackingContextHelper.h @@ -96,12 +96,13 @@ public: } bool IsBackfaceVisible() const { return mTransform.IsBackfaceVisible(); } + bool HasPerspectiveTransform() const { return mHasPerspectiveTransform; } private: wr::DisplayListBuilder* mBuilder; LayerPoint mOrigin; gfx::Matrix4x4 mTransform; - + bool mHasPerspectiveTransform; float mXScale; float mYScale; }; diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 8a517ec40cb4..cb49374ccf17 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -7841,6 +7841,7 @@ nsDisplayTransform::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu TransformData& transformData = animation.data().get_TransformData(); transformData.inheritedXScale() = scale.width; transformData.inheritedYScale() = scale.height; + transformData.hasPerspectiveParent() = aSc.HasPerspectiveTransform(); } }