Bug 1471437 - Part 2: Reset mPaintRect only when the new building rect is different, and update mPaintRectValid when it is. r=mattwoodrow draft
authorBas Schouten <bschouten@mozilla.com>
Wed, 27 Jun 2018 03:46:26 +0200
changeset 811158 619afb2eec650572c13e48ff094e34fd856391bb
parent 811156 a23427916397d1adf10ceca4ee56d128d78c58e2
push id114211
push userbschouten@mozilla.com
push dateWed, 27 Jun 2018 02:24:46 +0000
reviewersmattwoodrow
bugs1471437
milestone62.0a1
Bug 1471437 - Part 2: Reset mPaintRect only when the new building rect is different, and update mPaintRectValid when it is. r=mattwoodrow MozReview-Commit-ID: 5djSr7eNk8W
layout/painting/nsDisplayList.h
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -2636,17 +2636,23 @@ public:
   /**
    * Returns the building rectangle used by nsDisplayListBuilder when
    * this item was constructed.
    */
   const nsRect& GetBuildingRect() const { return mBuildingRect; }
 
   void SetBuildingRect(const nsRect& aBuildingRect)
   {
+    if (aBuildingRect == mBuildingRect) {
+      // Avoid unnecessary paint rect recompution when the
+      // building rect is staying the same.
+      return;
+    }
     mPaintRect = mBuildingRect = aBuildingRect;
+    mPaintRectValid = false;
   }
 
   void SetPaintRect(const nsRect& aPaintRect) {
     mPaintRect = aPaintRect;
     mPaintRectValid = true;
   }
   bool HasPaintRect() const { return mPaintRectValid; }