Bug 770058. InvalidateFrame doesn't need flags, we can just avoid calling ScheduleRepaint if we find any ancestor frame with a descendant that needs invalidation. r=mattwoodrow
☠☠ backed out by 4fb1de24239d ☠ ☠
authorRobert O'Callahan <robert@ocallahan.org>
Tue, 03 Jul 2012 14:24:14 +1200
changeset 98155 071d6332729b9feb5bb322e730b0707eda2593c6
parent 98154 4e29b12a5d255f8af07e53b3ee6d04e6c43edd4c
child 98156 6266a1336e2ddba0aff503a563cfbb34423cd95d
push id23029
push useremorley@mozilla.com
push dateTue, 03 Jul 2012 09:10:48 +0000
treeherdermozilla-central@e61399f31505 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs770058
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 770058. InvalidateFrame doesn't need flags, we can just avoid calling ScheduleRepaint if we find any ancestor frame with a descendant that needs invalidation. r=mattwoodrow
layout/generic/nsFrame.cpp
layout/generic/nsIFrame.h
layout/tables/nsTableCellFrame.h
layout/tables/nsTableColFrame.cpp
layout/tables/nsTableColFrame.h
layout/tables/nsTableColGroupFrame.cpp
layout/tables/nsTableColGroupFrame.h
layout/tables/nsTableRowFrame.cpp
layout/tables/nsTableRowFrame.h
layout/tables/nsTableRowGroupFrame.cpp
layout/tables/nsTableRowGroupFrame.h
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -4598,35 +4598,34 @@ nsIFrame::GetTransformMatrix(nsIFrame* a
   PRInt32 scaleFactor = PresContext()->AppUnitsPerDevPixel();
   return gfx3DMatrix().Translation
     (NSAppUnitsToFloatPixels(delta.x, scaleFactor),
      NSAppUnitsToFloatPixels(delta.y, scaleFactor),
      0.0f);
 }
 
 void
-nsIFrame::InvalidateFrameSubtree(PRUint32 aFlags)
-{
-  InvalidateFrame(aFlags);
+nsIFrame::InvalidateFrameSubtree()
+{
+  InvalidateFrame();
 
   if (HasAnyStateBits(NS_FRAME_ALL_DESCENDANTS_NEED_PAINT)) {
     return;
   }
 
   AddStateBits(NS_FRAME_ALL_DESCENDANTS_NEED_PAINT);
   
   nsAutoTArray<nsIFrame::ChildList,4> childListArray;
   GetCrossDocChildLists(&childListArray);
 
   nsIFrame::ChildListArrayIterator lists(childListArray);
   for (; !lists.IsDone(); lists.Next()) {
     nsFrameList::Enumerator childFrames(lists.CurrentList());
     for (; !childFrames.AtEnd(); childFrames.Next()) {
-      childFrames.get()->
-        InvalidateFrameSubtree(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
+      childFrames.get()->InvalidateFrameSubtree();
     }
   }
 }
 
 void
 nsIFrame::ClearInvalidationStateBits()
 {
   if (HasAnyStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT)) {
@@ -4643,25 +4642,25 @@ nsIFrame::ClearInvalidationStateBits()
   }
 
   RemoveStateBits(NS_FRAME_NEEDS_PAINT | 
                   NS_FRAME_DESCENDANT_NEEDS_PAINT | 
                   NS_FRAME_ALL_DESCENDANTS_NEED_PAINT);
 }
 
 void
-nsIFrame::InvalidateFrame(PRUint32 aFlags)
+nsIFrame::InvalidateFrame()
 {
   AddStateBits(NS_FRAME_NEEDS_PAINT);
   nsIFrame *parent = nsLayoutUtils::GetCrossDocParentFrame(this);
   while (parent && !parent->HasAnyStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT)) {
     parent->AddStateBits(NS_FRAME_DESCENDANT_NEEDS_PAINT);
     parent = nsLayoutUtils::GetCrossDocParentFrame(parent);
   }
-  if (!(aFlags & INVALIDATE_DONT_SCHEDULE_PAINT)) {
+  if (!parent) {
     SchedulePaint();
   }
 }
   
 bool 
 nsIFrame::IsInvalid() 
 {
   return HasAnyStateBits(NS_FRAME_NEEDS_PAINT);
@@ -7805,17 +7804,17 @@ nsFrame::SetParent(nsIFrame* aParent)
   } else {
     RemoveInPopupStateBitFromDescendants(this);
   }
   
   // If our new parent only has invalid children, then we just invalidate
   // ourselves too. This is probably faster than clearing the flag all
   // the way up the frame tree.
   if (aParent->HasAnyStateBits(NS_FRAME_ALL_DESCENDANTS_NEED_PAINT)) {
-    InvalidateFrame(INVALIDATE_DONT_SCHEDULE_PAINT);
+    InvalidateFrame();
   }
 }
 
 void
 nsFrame::InitBoxMetrics(bool aClear)
 {
   FrameProperties props = Properties();
   if (aClear) {
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -2121,36 +2121,31 @@ public:
    * nsChangeHint_UpdateOpacityLayer. We return true only if
    * a change in the transform or opacity has been recorded while layers have
    * been marked active for this frame.
    */
   bool AreLayersMarkedActive(nsChangeHint aChangeHint);
 
   /**
    * Marks all display items created by this frame as needing a repaint,
-   * and calls SchedulePaint() if requested.
+   * and calls SchedulePaint() if requested and one is not already pending.
    *
    * This includes all display items created by this frame, including
    * container types.
-   * @param aFlags INVALIDATE_DONT_SCHEDULE_PAINT: Don't call SchedulePaint()
-   * when invalidating.
    */
-  enum {
-    INVALIDATE_DONT_SCHEDULE_PAINT
-  };
-  virtual void InvalidateFrame(PRUint32 aFlags = 0);
+  virtual void InvalidateFrame();
   
   /**
    * Calls InvalidateFrame() on all frames descendant frames (including
    * this one).
    * 
    * This function doesn't walk through placeholder frames to invalidate
    * the out-of-flow frames.
    */
-  void InvalidateFrameSubtree(PRUint32 aFlags = 0);
+  void InvalidateFrameSubtree();
   
   /**
    * Checks if a frame has had InvalidateFrame() called on it since the
    * last paint.
    */
   bool IsInvalid();
  
   /**
--- a/layout/tables/nsTableCellFrame.h
+++ b/layout/tables/nsTableCellFrame.h
@@ -205,21 +205,21 @@ public:
                                nsPoint              aPt,
                                PRUint32             aFlags);
 
   void DecorateForSelection(nsRenderingContext& aRenderingContext,
                             nsPoint              aPt);
 
   virtual bool UpdateOverflow();
   
-  virtual void InvalidateFrame(PRUint32 aFlags = 0)
+  virtual void InvalidateFrame()
   {
-    nsIFrame::InvalidateFrame(aFlags);
+    nsIFrame::InvalidateFrame();
     nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
-    tableFrame->InvalidateFrame(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
+    tableFrame->InvalidateFrame();
   }
 
 protected:
   /** implement abstract method on nsContainerFrame */
   virtual PRIntn GetSkipSides() const;
 
   /**
    * GetBorderOverflow says how far the cell's own borders extend
--- a/layout/tables/nsTableColFrame.cpp
+++ b/layout/tables/nsTableColFrame.cpp
@@ -184,15 +184,15 @@ nsTableColFrame::GetFrameName(nsAString&
 
 nsSplittableType
 nsTableColFrame::GetSplittableType() const
 {
   return NS_FRAME_NOT_SPLITTABLE;
 }
 
 void
-nsTableColFrame::InvalidateFrame(PRUint32 aFlags)
+nsTableColFrame::InvalidateFrame()
 {
-  nsIFrame::InvalidateFrame(aFlags);
+  nsIFrame::InvalidateFrame();
   nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
-  tableFrame->InvalidateFrame(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
+  tableFrame->InvalidateFrame();
 }
 
--- a/layout/tables/nsTableColFrame.h
+++ b/layout/tables/nsTableColFrame.h
@@ -258,17 +258,17 @@ public:
   }
   void SetFinalWidth(nscoord aFinalWidth) {
     mFinalWidth = aFinalWidth;
   }
   nscoord GetFinalWidth() {
     return mFinalWidth;
   }
   
-  virtual void InvalidateFrame(PRUint32 aFlags = 0);
+  virtual void InvalidateFrame();
 
 protected:
 
   nsTableColFrame(nsStyleContext* aContext);
   ~nsTableColFrame();
 
   nscoord mMinCoord;
   nscoord mPrefCoord;
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -458,21 +458,21 @@ NS_IMPL_FRAMEARENA_HELPERS(nsTableColGro
 
 nsIAtom*
 nsTableColGroupFrame::GetType() const
 {
   return nsGkAtoms::tableColGroupFrame;
 }
   
 void 
-nsTableColGroupFrame::InvalidateFrame(PRUint32 aFlags)
+nsTableColGroupFrame::InvalidateFrame()
 {
-  nsIFrame::InvalidateFrame(aFlags);
+  nsIFrame::InvalidateFrame();
   nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
-  tableFrame->InvalidateFrame(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
+  tableFrame->InvalidateFrame();
 }
 
 #ifdef DEBUG
 NS_IMETHODIMP
 nsTableColGroupFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("TableColGroup"), aResult);
 }
--- a/layout/tables/nsTableColGroupFrame.h
+++ b/layout/tables/nsTableColGroupFrame.h
@@ -191,17 +191,17 @@ public:
   void GetContinuousBCBorderWidth(nsMargin& aBorder);
   /**
    * Set full border widths before collapsing with cell borders
    * @param aForSide - side to set; only accepts top and bottom
    */
   void SetContinuousBCBorderWidth(PRUint8     aForSide,
                                   BCPixelSize aPixelValue);
   
-  virtual void InvalidateFrame(PRUint32 aFlags = 0);
+  virtual void InvalidateFrame();
 
 protected:
   nsTableColGroupFrame(nsStyleContext* aContext);
 
   void InsertColsReflow(PRInt32                   aColIndex,
                         const nsFrameList::Slice& aCols);
 
   /** implement abstract method on nsContainerFrame */
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -1345,21 +1345,21 @@ void nsTableRowFrame::InitHasCellWithSty
       AddStateBits(NS_ROW_HAS_CELL_WITH_STYLE_HEIGHT);
       return;
     }
   }
   RemoveStateBits(NS_ROW_HAS_CELL_WITH_STYLE_HEIGHT);
 }
   
 void 
-nsTableRowFrame::InvalidateFrame(PRUint32 aFlags)
+nsTableRowFrame::InvalidateFrame()
 {
-  nsIFrame::InvalidateFrame(aFlags);
+  nsIFrame::InvalidateFrame();
   nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
-  tableFrame->InvalidateFrame(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
+  tableFrame->InvalidateFrame();
 }
 
 /* ----- global methods ----- */
 
 nsIFrame* 
 NS_NewTableRowFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
   return new (aPresShell) nsTableRowFrame(aContext);
--- a/layout/tables/nsTableRowFrame.h
+++ b/layout/tables/nsTableRowFrame.h
@@ -218,17 +218,17 @@ public:
   nscoord GetOuterTopContBCBorderWidth();
   /**
    * Sets full border widths before collapsing with cell borders
    * @param aForSide - side to set; only accepts right, left, and top
    */
   void SetContinuousBCBorderWidth(PRUint8     aForSide,
                                   BCPixelSize aPixelValue);
 
-  virtual void InvalidateFrame(PRUint32 aFlags = 0);
+  virtual void InvalidateFrame();
 
 #ifdef ACCESSIBILITY
   virtual already_AddRefed<Accessible> CreateAccessible();
 #endif
 
 protected:
 
   /** protected constructor.
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -1836,14 +1836,14 @@ nsTableRowGroupFrame::FrameCursorData::A
   nscoord overflowAbove = -overflowRect.y;
   nscoord overflowBelow = overflowRect.YMost() - aFrame->GetSize().height;
   mOverflowAbove = NS_MAX(mOverflowAbove, overflowAbove);
   mOverflowBelow = NS_MAX(mOverflowBelow, overflowBelow);
   return mFrames.AppendElement(aFrame) != nsnull;
 }
   
 void 
-nsTableRowGroupFrame::InvalidateFrame(PRUint32 aFlags)
+nsTableRowGroupFrame::InvalidateFrame()
 {
-  nsIFrame::InvalidateFrame(aFlags);
+  nsIFrame::InvalidateFrame();
   nsTableFrame *tableFrame = nsTableFrame::GetTableFrame(this);
-  tableFrame->InvalidateFrame(aFlags | INVALIDATE_DONT_SCHEDULE_PAINT);
+  tableFrame->InvalidateFrame();
 }
--- a/layout/tables/nsTableRowGroupFrame.h
+++ b/layout/tables/nsTableRowGroupFrame.h
@@ -319,17 +319,17 @@ public:
    * form non-decreasing sequences (should always be true for table rows);
    * if this is violated, call ClearRowCursor(). If we return nsnull, then we
    * decided not to use a cursor or we already have one set up.
    */
   FrameCursorData* SetupRowCursor();
 
   virtual nsILineIterator* GetLineIterator() { return this; }
   
-  virtual void InvalidateFrame(PRUint32 aFlags = 0);
+  virtual void InvalidateFrame();
 
 protected:
   nsTableRowGroupFrame(nsStyleContext* aContext);
 
   void InitChildReflowState(nsPresContext&     aPresContext, 
                             bool               aBorderCollapse,
                             nsHTMLReflowState& aReflowState);