Bug 1471437 - Part 2: Reset mPaintRect only when the new building rect is different, and update mPaintRectValid when it is. r=mattwoodrow a=lizzard
authorBas Schouten <bschouten@mozilla.com>
Wed, 27 Jun 2018 16:47:55 +0200
changeset 480595 acc7133a29fba3797e11c89869ba235b0e9f990d
parent 480594 7c3840f0769f4b7383225dff12ae222e24d0bea6
child 480596 d8d3fca29016566df5d798d0709f51a4036f40c7
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, lizzard
bugs1471437
milestone62.0
Bug 1471437 - Part 2: Reset mPaintRect only when the new building rect is different, and update mPaintRectValid when it is. r=mattwoodrow a=lizzard MozReview-Commit-ID: 5djSr7eNk8W
layout/painting/nsDisplayList.h
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -2651,17 +2651,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; }