Bug 233463, patch 1 - Minor cleanup of frame list related code in nsTableRowGroupFrame. r=bzbarsky
authorMats Palmgren <matspal@gmail.com>
Fri, 18 Sep 2009 13:09:35 +0200
changeset 32842 ffb5ea9c48c70c75b125909be20036cb35e4cfe7
parent 32841 b90618f4d70640015c4915c833060a847aac53a2
child 32843 70ec909259338087354e4978ed5da52a7ca4921f
push id9189
push usermpalmgren@mozilla.com
push dateFri, 18 Sep 2009 11:13:31 +0000
treeherdermozilla-central@4b8efcb179b8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs233463
milestone1.9.3a1pre
Bug 233463, patch 1 - Minor cleanup of frame list related code in nsTableRowGroupFrame. r=bzbarsky
layout/tables/nsTableRowGroupFrame.cpp
layout/tables/nsTableRowGroupFrame.h
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -75,39 +75,33 @@ nsTableRowGroupFrame::IsContainingBlock(
 }
 
 PRInt32
 nsTableRowGroupFrame::GetRowCount()
 {  
   PRInt32 count = 0; // init return
 
   // loop through children, adding one to aCount for every legit row
-  nsIFrame* childFrame = GetFirstFrame();
-  while (PR_TRUE) {
-    if (!childFrame)
-      break;
+  for (nsIFrame* childFrame = mFrames.FirstChild();
+       childFrame; childFrame = childFrame->GetNextSibling()) {
     if (NS_STYLE_DISPLAY_TABLE_ROW == childFrame->GetStyleDisplay()->mDisplay)
       count++;
-    GetNextFrame(childFrame, &childFrame);
   }
   return count;
 }
 
 PRInt32 nsTableRowGroupFrame::GetStartRowIndex()
 {
   PRInt32 result = -1;
-  nsIFrame* childFrame = GetFirstFrame();
-  while (PR_TRUE) {
-    if (!childFrame)
-      break;
+  for (nsIFrame* childFrame = mFrames.FirstChild();
+       childFrame; childFrame = childFrame->GetNextSibling()) {
     if (NS_STYLE_DISPLAY_TABLE_ROW == childFrame->GetStyleDisplay()->mDisplay) {
       result = ((nsTableRowFrame *)childFrame)->GetRowIndex();
       break;
     }
-    GetNextFrame(childFrame, &childFrame);
   }
   // if the row group doesn't have any children, get it the hard way
   if (-1 == result) {
     nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
     if (tableFrame) {
       return tableFrame->GetStartRowIndex(*this);
     }
   }
@@ -372,17 +366,17 @@ nsTableRowGroupFrame::ReflowChildren(nsP
   PRBool isPaginated = aPresContext->IsPaginated();
 
   PRBool haveRow = PR_FALSE;
   PRBool reflowAllKids = aReflowState.reflowState.ShouldReflowAllKids() ||
                          tableFrame->IsGeometryDirty();
   PRBool needToCalcRowHeights = reflowAllKids;
 
   nsIFrame *prevKidFrame = nsnull;
-  for (nsIFrame* kidFrame = GetFirstFrame(); kidFrame;
+  for (nsIFrame* kidFrame = mFrames.FirstChild(); kidFrame;
        prevKidFrame = kidFrame, kidFrame = kidFrame->GetNextSibling()) {
     nsTableRowFrame *rowFrame = do_QueryFrame(kidFrame);
     if (!rowFrame) {
       // XXXldb nsCSSFrameConstructor needs to enforce this!
       NS_NOTREACHED("yikes, a non-row child");
       continue;
     }
 
@@ -410,17 +404,17 @@ nsTableRowGroupFrame::ReflowChildren(nsP
                                        kidFrame, kidAvailSize,
                                        -1, -1, PR_FALSE);
       InitChildReflowState(*aPresContext, borderCollapse, kidReflowState);
 
       // This can indicate that columns were resized.
       if (aReflowState.reflowState.mFlags.mHResize)
         kidReflowState.mFlags.mHResize = PR_TRUE;
      
-      NS_ASSERTION(kidFrame == GetFirstFrame() || prevKidFrame, 
+      NS_ASSERTION(kidFrame == mFrames.FirstChild() || prevKidFrame, 
                    "If we're not on the first frame, we should have a "
                    "previous sibling...");
       // If prev row has nonzero YMost, then we can't be at the top of the page
       if (prevKidFrame && prevKidFrame->GetRect().YMost() > 0) {
         kidReflowState.mFlags.mIsTopOfPage = PR_FALSE;
       }
 
       rv = ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState,
@@ -507,17 +501,17 @@ nsTableRowGroupFrame::ReflowChildren(nsP
   }
 
   return rv;
 }
 
 nsTableRowFrame*  
 nsTableRowGroupFrame::GetFirstRow() 
 {
-  for (nsIFrame* childFrame = GetFirstFrame(); childFrame;
+  for (nsIFrame* childFrame = mFrames.FirstChild(); childFrame;
        childFrame = childFrame->GetNextSibling()) {
     nsTableRowFrame *rowFrame = do_QueryFrame(childFrame);
     if (rowFrame) {
       return rowFrame;
     }
   }
   return nsnull;
 }
--- a/layout/tables/nsTableRowGroupFrame.h
+++ b/layout/tables/nsTableRowGroupFrame.h
@@ -440,20 +440,16 @@ protected:
                         
 private:
   // border widths in pixels in the collapsing border model
   BCPixelSize mRightContBorderWidth;
   BCPixelSize mBottomContBorderWidth;
   BCPixelSize mLeftContBorderWidth;
 
 public:
-  virtual nsIFrame* GetFirstFrame() { return mFrames.FirstChild(); }
-  virtual nsIFrame* GetLastFrame() { return mFrames.LastChild(); }
-  virtual void GetNextFrame(nsIFrame*  aFrame, 
-                            nsIFrame** aResult) { *aResult = aFrame->GetNextSibling(); }
   PRBool IsRepeatable() const;
   void   SetRepeatable(PRBool aRepeatable);
   PRBool HasStyleHeight() const;
   void   SetHasStyleHeight(PRBool aValue);
 };
 
 
 inline PRBool nsTableRowGroupFrame::IsRepeatable() const