Bug 1207734 - Part 4.b. Use the final combined transform in the nsDisplayTransform. draft
authorcku <cku@mozilla.com>
Wed, 13 Dec 2017 01:21:41 +0800
changeset 720493 fd603c0591ad758e216be11a033734bc36566d88
parent 720492 b46369422bbb20a8986aa321c0d5b7755d36cbc1
child 720494 4815827ed4566374e80d025e1b60eccc1287d404
push id95566
push userbmo:cku@mozilla.com
push dateMon, 15 Jan 2018 18:18:47 +0000
bugs1207734
milestone59.0a1
Bug 1207734 - Part 4.b. Use the final combined transform in the nsDisplayTransform. MozReview-Commit-ID: CDlvzkcae0g
layout/painting/ActiveLayerTracker.cpp
layout/painting/nsDisplayList.cpp
layout/style/StyleAnimationValue.cpp
--- a/layout/painting/ActiveLayerTracker.cpp
+++ b/layout/painting/ActiveLayerTracker.cpp
@@ -243,30 +243,31 @@ ActiveLayerTracker::TransferActivityToFr
   aFrame->AddStateBits(NS_FRAME_HAS_LAYER_ACTIVITY_PROPERTY);
   aFrame->SetProperty(LayerActivityProperty(), layerActivity);
 }
 
 static void
 IncrementScaleRestyleCountIfNeeded(nsIFrame* aFrame, LayerActivity* aActivity)
 {
   const nsStyleDisplay* display = aFrame->StyleDisplay();
-  if (!display->mSpecifiedTransform) {
+  RefPtr<nsCSSValueSharedList> transformList = display->GetCombinedTransform();
+  if (!transformList) {
     // The transform was removed.
     aActivity->mPreviousTransformScale = Nothing();
     IncrementMutationCount(&aActivity->mRestyleCounts[LayerActivity::ACTIVITY_SCALE]);
     return;
   }
 
   // Compute the new scale due to the CSS transform property.
   nsPresContext* presContext = aFrame->PresContext();
   RuleNodeCacheConditions dummy;
   bool dummyBool;
   nsStyleTransformMatrix::TransformReferenceBox refBox(aFrame);
   Matrix4x4 transform =
-    nsStyleTransformMatrix::ReadTransforms(display->mSpecifiedTransform->mHead,
+    nsStyleTransformMatrix::ReadTransforms(transformList->mHead,
                                            aFrame->StyleContext(),
                                            presContext,
                                            dummy, refBox,
                                            presContext->AppUnitsPerCSSPixel(),
                                            &dummyBool);
   Matrix transform2D;
   if (!transform.Is2D(&transform2D)) {
     // We don't attempt to handle 3D transforms; just assume the scale changed.
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -8095,17 +8095,17 @@ nsDisplayTransform::ComputePerspectiveMa
   aOutMatrix.ChangeBasis(Point3D(perspectiveOrigin.x, perspectiveOrigin.y, 0));
   return true;
 }
 
 nsDisplayTransform::FrameTransformProperties::FrameTransformProperties(const nsIFrame* aFrame,
                                                                        float aAppUnitsPerPixel,
                                                                        const nsRect* aBoundsOverride)
   : mFrame(aFrame)
-  , mTransformList(aFrame->StyleDisplay()->mSpecifiedTransform)
+  , mTransformList(aFrame->StyleDisplay()->GetCombinedTransform())
   , mToTransformOrigin(GetDeltaToTransformOrigin(aFrame, aAppUnitsPerPixel, aBoundsOverride))
 {
 }
 
 /* Wraps up the transform matrix in a change-of-basis matrix pair that
  * translates from local coordinate space to transform coordinate space, then
  * hands it back.
  */
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -4631,20 +4631,21 @@ StyleAnimationValue::ExtractComputedValu
                                                       eUnit_Filter);
           break;
         }
 
         case eCSSProperty_transform: {
           const nsStyleDisplay *display =
             static_cast<const nsStyleDisplay*>(styleStruct);
           nsAutoPtr<nsCSSValueList> result;
-          if (display->mSpecifiedTransform) {
+          RefPtr<nsCSSValueSharedList> transformList = display->GetCombinedTransform();
+          if (transformList) {
             // Clone, and convert all lengths (not percents) to pixels.
             nsCSSValueList **resultTail = getter_Transfers(result);
-            for (const nsCSSValueList *l = display->mSpecifiedTransform->mHead;
+            for (const nsCSSValueList *l = transformList->mHead;
                  l; l = l->mNext) {
               nsCSSValueList *clone = new nsCSSValueList;
               *resultTail = clone;
               resultTail = &clone->mNext;
 
               SubstitutePixelValues(aStyleContext, l->mValue, clone->mValue);
             }
           } else {