Bug 1416540 - Avoid unnecessary conversion to doubles in ActiveLayerTracker code. r?mstange draft
authorKartikaya Gupta <kgupta@mozilla.com>
Sun, 12 Nov 2017 18:37:33 -0500
changeset 696906 8fe17cd35f04a1386ce047f6a45393e660947e6d
parent 696905 53914fdad8eabcc6654fbfc237a4b93c9a604639
child 696907 1bc7d3dc967d8b4217caf641ed87f75678ada857
push id88821
push userkgupta@mozilla.com
push dateSun, 12 Nov 2017 23:37:55 +0000
reviewersmstange
bugs1416540
milestone58.0a1
Bug 1416540 - Avoid unnecessary conversion to doubles in ActiveLayerTracker code. r?mstange This code was written before the ScaleFactors() function was available on the float-based gfx::Matrix, which I presume is why it was written to convert the matrix to the double-based variant and store the scale as doubles. We don't need to do that any more. MozReview-Commit-ID: EoWLpny8g61
layout/painting/ActiveLayerTracker.cpp
--- a/layout/painting/ActiveLayerTracker.cpp
+++ b/layout/painting/ActiveLayerTracker.cpp
@@ -90,17 +90,17 @@ public:
   // When this property is expired by the layer activity tracker, both mFrame
   // and mContent are nulled-out and the property is deleted.
   nsIFrame* mFrame;
   nsIContent* mContent;
 
   nsExpirationState mState;
 
   // Previous scale due to the CSS transform property.
-  Maybe<gfxSize> mPreviousTransformScale;
+  Maybe<Size> mPreviousTransformScale;
 
   // The scroll frame during for which we most recently received a call to
   // NotifyAnimatedFromScrollHandler.
   WeakFrame mAnimatingScrollHandlerFrame;
   // The set of activities that were triggered during
   // mAnimatingScrollHandlerFrame's scroll event handler.
   EnumSet<ActivityIndex> mScrollHandlerInducedActivity;
 
@@ -270,17 +270,17 @@ IncrementScaleRestyleCountIfNeeded(nsIFr
   Matrix transform2D;
   if (!transform.Is2D(&transform2D)) {
     // We don't attempt to handle 3D transforms; just assume the scale changed.
     aActivity->mPreviousTransformScale = Nothing();
     IncrementMutationCount(&aActivity->mRestyleCounts[LayerActivity::ACTIVITY_SCALE]);
     return;
   }
 
-  gfxSize scale = ThebesMatrix(transform2D).ScaleFactors(true);
+  Size scale = transform2D.ScaleFactors(true);
   if (aActivity->mPreviousTransformScale == Some(scale)) {
     return;  // Nothing changed.
   }
 
   aActivity->mPreviousTransformScale = Some(scale);
   IncrementMutationCount(&aActivity->mRestyleCounts[LayerActivity::ACTIVITY_SCALE]);
 }