Bug 685154 - Cleanup nsIFrame::GetParentStyleContextFrame and related code. r=roc
authorMats Palmgren <matspal@gmail.com>
Mon, 12 Sep 2011 09:08:07 -0700
changeset 76891 38ff711d43699ddf0f16f287e08254e2da22b392
parent 76890 90e4d207f5dd1b8abad50ec47468a702ecb33431
child 76892 79890feb4abe972aae795fbb0ccb6bf8959c8b5a
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersroc
bugs685154
milestone9.0a1
Bug 685154 - Cleanup nsIFrame::GetParentStyleContextFrame and related code. r=roc Make nsIFrame::GetParentStyleContextFrame return the frame directly instead of indirectly through an out parameter. Remove the unused nsPresContext parameter.
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsFrameManager.cpp
layout/generic/nsFrame.cpp
layout/generic/nsFrame.h
layout/generic/nsIFrame.h
layout/generic/nsPlaceholderFrame.cpp
layout/generic/nsPlaceholderFrame.h
layout/tables/nsTableColGroupFrame.cpp
layout/tables/nsTableFrame.cpp
layout/tables/nsTableFrame.h
layout/tables/nsTableOuterFrame.cpp
layout/tables/nsTableOuterFrame.h
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2474,19 +2474,19 @@ nsCSSFrameConstructor::ConstructDocEleme
   NS_ASSERTION(processChildren ? !mRootElementFrame :
                  mRootElementFrame == contentFrame,
                "unexpected mRootElementFrame");
   mRootElementFrame = contentFrame;
 
   // Figure out which frame has the main style for the document element,
   // assigning it to mRootElementStyleFrame.
   // Backgrounds should be propagated from that frame to the viewport.
-  PRBool isChild;
-  contentFrame->GetParentStyleContextFrame(state.mPresContext,
-          &mRootElementStyleFrame, &isChild);
+  mRootElementStyleFrame = contentFrame->GetParentStyleContextFrame();
+  bool isChild = mRootElementStyleFrame &&
+                 mRootElementStyleFrame->GetParent() == contentFrame;
   if (!isChild) {
     mRootElementStyleFrame = mRootElementFrame;
   }
 
   if (processChildren) {
     // Still need to process the child content
     nsFrameItems childItems;
 
@@ -5783,23 +5783,18 @@ nsCSSFrameConstructor::IsValidSibling(ns
       (NS_STYLE_DISPLAY_TABLE_CAPTION      == siblingDisplay) ||
       (NS_STYLE_DISPLAY_TABLE_HEADER_GROUP == siblingDisplay) ||
       (NS_STYLE_DISPLAY_TABLE_ROW_GROUP    == siblingDisplay) ||
       (NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP == siblingDisplay) ||
       nsGkAtoms::menuFrame == parentType) {
     // if we haven't already, construct a style context to find the display type of aContent
     if (UNSET_DISPLAY == aDisplay) {
       nsRefPtr<nsStyleContext> styleContext;
-      nsIFrame* styleParent;
-      PRBool providerIsChild;
-      if (NS_FAILED(aSibling->
-                      GetParentStyleContextFrame(aSibling->PresContext(),
-                                                 &styleParent,
-                                                 &providerIsChild)) ||
-          !styleParent) {
+      nsIFrame* styleParent = aSibling->GetParentStyleContextFrame();
+      if (!styleParent) {
         NS_NOTREACHED("Shouldn't happen");
         return PR_FALSE;
       }
       // XXXbz when this code is killed, the state argument to
       // ResolveStyleContext can be made non-optional.
       styleContext = ResolveStyleContext(styleParent, aContent, nsnull);
       if (!styleContext) return PR_FALSE;
       const nsStyleDisplay* display = styleContext->GetStyleDisplay();
--- a/layout/base/nsFrameManager.cpp
+++ b/layout/base/nsFrameManager.cpp
@@ -263,17 +263,17 @@ nsFrameManager::Destroy()
 
   mPresShell = nsnull;
 }
 
 //----------------------------------------------------------------------
 
 // Placeholder frame functions
 nsPlaceholderFrame*
-nsFrameManager::GetPlaceholderFrameFor(nsIFrame*  aFrame)
+nsFrameManager::GetPlaceholderFrameFor(nsIFrame* aFrame)
 {
   NS_PRECONDITION(aFrame, "null param unexpected");
 
   if (mPlaceholderMap.ops) {
     PlaceholderMapEntry *entry = static_cast<PlaceholderMapEntry*>
                                             (PL_DHashTableOperate(const_cast<PLDHashTable*>(&mPlaceholderMap),
                                 aFrame, PL_DHASH_LOOKUP));
     if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
@@ -582,20 +582,17 @@ VerifyContextParent(nsPresContext* aPres
   }
 
   if (!aParentContext) {
     // Get the correct parent context from the frame
     //  - if the frame is a placeholder, we get the out of flow frame's context 
     //    as the parent context instead of asking the frame
 
     // get the parent context from the frame (indirectly)
-    nsIFrame* providerFrame = nsnull;
-    PRBool providerIsChild;
-    aFrame->GetParentStyleContextFrame(aPresContext,
-                                       &providerFrame, &providerIsChild);
+    nsIFrame* providerFrame = aFrame->GetParentStyleContextFrame();
     if (providerFrame)
       aParentContext = providerFrame->GetStyleContext();
     // aParentContext could still be null
   }
 
   NS_ASSERTION(aContext, "Failure to get required contexts");
   nsStyleContext* actualParentContext = aContext->GetParent();
 
@@ -803,23 +800,21 @@ nsFrameManager::ReparentStyleContext(nsI
   }
 
   // DO NOT verify the style tree before reparenting.  The frame
   // tree has already been changed, so this check would just fail.
   nsStyleContext* oldContext = aFrame->GetStyleContext();
   // XXXbz can oldContext really ever be null?
   if (oldContext) {
     nsRefPtr<nsStyleContext> newContext;
-    nsIFrame* providerFrame = nsnull;
-    PRBool providerIsChild = PR_FALSE;
+    nsIFrame* providerFrame = aFrame->GetParentStyleContextFrame();
+    bool isChild = providerFrame && providerFrame->GetParent() == aFrame;
+    nsStyleContext* newParentContext = nsnull;
     nsIFrame* providerChild = nsnull;
-    aFrame->GetParentStyleContextFrame(GetPresContext(), &providerFrame,
-                                       &providerIsChild);
-    nsStyleContext* newParentContext = nsnull;
-    if (providerIsChild) {
+    if (isChild) {
       ReparentStyleContext(providerFrame);
       newParentContext = providerFrame->GetStyleContext();
       providerChild = providerFrame;
     } else if (providerFrame) {
       newParentContext = providerFrame->GetStyleContext();
     } else {
       NS_NOTREACHED("Reparenting something that has no usable parent? "
                     "Shouldn't happen!");
@@ -1102,21 +1097,19 @@ nsFrameManager::ReResolveStyleContext(ns
     if (childRestyleHint == eRestyle_Self) {
       childRestyleHint = nsRestyleHint(0);
     }
 
     nsStyleContext* parentContext;
     nsIFrame* resolvedChild = nsnull;
     // Get the frame providing the parent style context.  If it is a
     // child, then resolve the provider first.
-    nsIFrame* providerFrame = nsnull;
-    PRBool providerIsChild = PR_FALSE;
-    aFrame->GetParentStyleContextFrame(aPresContext,
-                                       &providerFrame, &providerIsChild); 
-    if (!providerIsChild) {
+    nsIFrame* providerFrame = aFrame->GetParentStyleContextFrame();
+    bool isChild = providerFrame && providerFrame->GetParent() == aFrame;
+    if (!isChild) {
       if (providerFrame)
         parentContext = providerFrame->GetStyleContext();
       else
         parentContext = nsnull;
     }
     else {
       // resolve the provider here (before aFrame below).
 
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -6515,25 +6515,16 @@ nsFrame::ConsiderChildOverflow(nsOverflo
   // FIXME: Why do we check this here rather than in
   // FinishAndStoreOverflow (where we check NS_STYLE_OVERFLOW_CLIP)?
   if (!disp->IsTableClip()) {
     aOverflowAreas.UnionWith(aChildFrame->GetOverflowAreas() +
                              aChildFrame->GetPosition());
   }
 }
 
-NS_IMETHODIMP 
-nsFrame::GetParentStyleContextFrame(nsPresContext* aPresContext,
-                                    nsIFrame**      aProviderFrame,
-                                    PRBool*         aIsChild)
-{
-  return DoGetParentStyleContextFrame(aPresContext, aProviderFrame, aIsChild);
-}
-
-
 /**
  * This function takes a "special" frame and _if_ that frame is an anonymous
  * block created by an ib split it returns the block's preceding inline.  This
  * is needed because the split inline's style context is the parent of the
  * anonymous block's style context.
  *
  * If aFrame is not an anonymous block, null is returned.
  */
@@ -6570,36 +6561,32 @@ GetIBSpecialSiblingForAnonymousBlock(nsI
  * having a block within an inline.  The result only differs from the
  * result of |GetParent| when |GetParent| returns an anonymous block
  * that was created for an element that was 'display: inline' because
  * that element contained a block.
  *
  * Also skip anonymous scrolled-content parents; inherit directly from the
  * outer scroll frame.
  */
-static nsresult
-GetCorrectedParent(nsPresContext* aPresContext, nsIFrame* aFrame,
-                   nsIFrame** aSpecialParent)
+static nsIFrame*
+GetCorrectedParent(const nsIFrame* aFrame)
 {
   nsIFrame *parent = aFrame->GetParent();
   if (!parent) {
-    *aSpecialParent = nsnull;
-  } else {
-    nsIAtom* pseudo = aFrame->GetStyleContext()->GetPseudo();
-    // Outer tables are always anon boxes; if we're in here for an outer
-    // table, that actually means its the _inner_ table that wants to
-    // know its parent.  So get the pseudo of the inner in that case.
-    if (pseudo == nsCSSAnonBoxes::tableOuter) {
-      pseudo = aFrame->GetFirstPrincipalChild()
-                         ->GetStyleContext()->GetPseudo();
-    }
-    *aSpecialParent = nsFrame::CorrectStyleParentFrame(parent, pseudo);
-  }
-
-  return NS_OK;
+    return nsnull;
+  }
+
+  // Outer tables are always anon boxes; if we're in here for an outer
+  // table, that actually means its the _inner_ table that wants to
+  // know its parent.  So get the pseudo of the inner in that case.
+  nsIAtom* pseudo = aFrame->GetStyleContext()->GetPseudo();
+  if (pseudo == nsCSSAnonBoxes::tableOuter) {
+    pseudo = aFrame->GetFirstPrincipalChild()->GetStyleContext()->GetPseudo();
+  }
+  return nsFrame::CorrectStyleParentFrame(parent, pseudo);
 }
 
 /* static */
 nsIFrame*
 nsFrame::CorrectStyleParentFrame(nsIFrame* aProspectiveParent,
                                  nsIAtom* aChildPseudo)
 {
   NS_PRECONDITION(aProspectiveParent, "Must have a prospective parent");
@@ -6654,73 +6641,61 @@ nsFrame::CorrectStyleParentFrame(nsIFram
   // We can get here if the root element is absolutely positioned.
   // We can't test for this very accurately, but it can only happen
   // when the prospective parent is a canvas frame.
   NS_ASSERTION(aProspectiveParent->GetType() == nsGkAtoms::canvasFrame,
                "Should have found a parent before this");
   return nsnull;
 }
 
-nsresult
-nsFrame::DoGetParentStyleContextFrame(nsPresContext* aPresContext,
-                                      nsIFrame**      aProviderFrame,
-                                      PRBool*         aIsChild)
-{
-  *aIsChild = PR_FALSE;
-  *aProviderFrame = nsnull;
+nsIFrame*
+nsFrame::DoGetParentStyleContextFrame()
+{
   if (mContent && !mContent->GetParent() &&
       !GetStyleContext()->GetPseudo()) {
     // we're a frame for the root.  We have no style context parent.
-    return NS_OK;
+    return nsnull;
   }
   
   if (!(mState & NS_FRAME_OUT_OF_FLOW)) {
     /*
      * If this frame is an anonymous block created when an inline with a block
      * inside it got split, then the parent style context is on its preceding
      * inline. We can get to it using GetIBSpecialSiblingForAnonymousBlock.
      */
     if (mState & NS_FRAME_IS_SPECIAL) {
-      *aProviderFrame = GetIBSpecialSiblingForAnonymousBlock(this);
-
-      if (*aProviderFrame) {
-        return NS_OK;
+      nsIFrame* specialSibling = GetIBSpecialSiblingForAnonymousBlock(this);
+      if (specialSibling) {
+        return specialSibling;
       }
     }
 
     // If this frame is one of the blocks that split an inline, we must
     // return the "special" inline parent, i.e., the parent that this
     // frame would have if we didn't mangle the frame structure.
-    return GetCorrectedParent(aPresContext, this, aProviderFrame);
+    return GetCorrectedParent(this);
   }
 
   // For out-of-flow frames, we must resolve underneath the
   // placeholder's parent.
   nsIFrame* oofFrame = this;
   if ((oofFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) &&
       GetPrevInFlow()) {
     // Out of flows that are continuations do not
     // have placeholders. Use their first-in-flow's placeholder.
     oofFrame = oofFrame->GetFirstInFlow();
   }
-  nsIFrame *placeholder =
-    aPresContext->FrameManager()->GetPlaceholderFrameFor(oofFrame);
+  nsIFrame* placeholder = oofFrame->PresContext()->FrameManager()->
+                            GetPlaceholderFrameFor(oofFrame);
   if (!placeholder) {
     NS_NOTREACHED("no placeholder frame for out-of-flow frame");
-    GetCorrectedParent(aPresContext, this, aProviderFrame);
-    return NS_ERROR_FAILURE;
-  }
-  return static_cast<nsFrame*>(placeholder)->
-    GetParentStyleContextFrame(aPresContext, aProviderFrame, aIsChild);
-}
-
-//-----------------------------------------------------------------------------------
-
-
-
+    return GetCorrectedParent(this);
+  }
+  return placeholder->GetParentStyleContextFrame();
+}
 
 void
 nsFrame::GetLastLeaf(nsPresContext* aPresContext, nsIFrame **aFrame)
 {
   if (!aFrame || !*aFrame)
     return;
   nsIFrame *child = *aFrame;
   //if we are a block frame then go for the last line of 'this'
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -263,19 +263,28 @@ public:
 
   NS_IMETHOD  GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const;
   virtual void ChildIsDirty(nsIFrame* aChild);
 
 #ifdef ACCESSIBILITY
   virtual already_AddRefed<nsAccessible> CreateAccessible();
 #endif
 
-  NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
-                                        nsIFrame**      aProviderFrame,
-                                        PRBool*         aIsChild);
+  virtual nsIFrame* GetParentStyleContextFrame() {
+    return DoGetParentStyleContextFrame();
+  }
+
+  /**
+   * Do the work for getting the parent style context frame so that
+   * other frame's |GetParentStyleContextFrame| methods can call this
+   * method on *another* frame.  (This function handles out-of-flow
+   * frames by using the frame manager's placeholder map and it also
+   * handles block-within-inline and generated content wrappers.)
+   */
+  nsIFrame* DoGetParentStyleContextFrame();
 
   virtual PRBool IsEmpty();
   virtual PRBool IsSelfEmpty();
 
   virtual void MarkIntrinsicWidthsDirty();
   virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
   virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
   virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
@@ -394,25 +403,16 @@ public:
   // it marks the frame as "unflowable", zeroes out the metrics, sets
   // the reflow status, and returns PR_TRUE. Otherwise, the frame is
   // unmarked "unflowable" and the metrics and reflow status are not
   // touched and PR_FALSE is returned.
   PRBool IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState,
                             nsHTMLReflowMetrics& aMetrics,
                             nsReflowStatus& aStatus);
 
-  // Do the work for getting the parent style context frame so that
-  // other frame's |GetParentStyleContextFrame| methods can call this
-  // method on *another* frame.  (This function handles out-of-flow
-  // frames by using the frame manager's placeholder map and it also
-  // handles block-within-inline and generated content wrappers.)
-  nsresult DoGetParentStyleContextFrame(nsPresContext* aPresContext,
-                                        nsIFrame**      aProviderFrame,
-                                        PRBool*         aIsChild);
-
   // Incorporate the child overflow areas into aOverflowAreas.
   // If the child does not have a overflow, use the child area.
   void ConsiderChildOverflow(nsOverflowAreas& aOverflowAreas,
                              nsIFrame* aChildFrame);
 
   virtual const void* GetStyleDataExternal(nsStyleStructID aSID) const;
 
 
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -2391,29 +2391,21 @@ public:
 
   /**
    * Get the frame whose style context should be the parent of this
    * frame's style context (i.e., provide the parent style context).
    * This frame must either be an ancestor of this frame or a child.  If
    * this frame returns a child frame, then the child frame must be sure
    * to return a grandparent or higher!
    *
-   * @param aPresContext:   PresContext
-   * @param aProviderFrame: The frame whose style context should be the
-   *                        parent of this frame's style context.  Null
-   *                        is permitted, and means that this frame's
-   *                        style context should be the root of the
-   *                        style context tree.
-   * @param aIsChild:       True if |aProviderFrame| is set to a child
-   *                        of this frame; false if it is an ancestor or
-   *                        null.
+   * @return The frame whose style context should be the parent of this frame's
+   *         style context.  Null is permitted, and means that this frame's
+   *         style context should be the root of the style context tree.
    */
-  NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
-                                        nsIFrame**      aProviderFrame,
-                                        PRBool*         aIsChild) = 0;
+  virtual nsIFrame* GetParentStyleContextFrame() = 0;
 
   /**
    * Determines whether a frame is visible for painting;
    * taking into account whether it is painting a selection or printing.
    */
   PRBool IsVisibleForPainting(nsDisplayListBuilder* aBuilder);
   /**
    * Determines whether a frame is visible for painting or collapsed;
--- a/layout/generic/nsPlaceholderFrame.cpp
+++ b/layout/generic/nsPlaceholderFrame.cpp
@@ -186,30 +186,25 @@ nsPlaceholderFrame::CanContinueTextRun()
   if (!mOutOfFlowFrame) {
     return PR_FALSE;
   }
   // first-letter frames can continue text runs, and placeholders for floated
   // first-letter frames can too
   return mOutOfFlowFrame->CanContinueTextRun();
 }
 
-NS_IMETHODIMP
-nsPlaceholderFrame::GetParentStyleContextFrame(nsPresContext* aPresContext,
-                                               nsIFrame**      aProviderFrame,
-                                               PRBool*         aIsChild)
+nsIFrame*
+nsPlaceholderFrame::GetParentStyleContextFrame()
 {
   NS_PRECONDITION(GetParent(), "How can we not have a parent here?");
-  *aIsChild = PR_FALSE;
 
   // Lie about our pseudo so we can step out of all anon boxes and
   // pseudo-elements.  The other option would be to reimplement the
   // {ib} split gunk here.
-  *aProviderFrame =
-    CorrectStyleParentFrame(GetParent(), nsGkAtoms::placeholderFrame);
-  return NS_OK;
+  return CorrectStyleParentFrame(GetParent(), nsGkAtoms::placeholderFrame);
 }
 
 
 #ifdef DEBUG
 static void
 PaintDebugPlaceholder(nsIFrame* aFrame, nsRenderingContext* aCtx,
                       const nsRect& aDirtyRect, nsPoint aPt)
 {
--- a/layout/generic/nsPlaceholderFrame.h
+++ b/layout/generic/nsPlaceholderFrame.h
@@ -169,19 +169,18 @@ public:
   virtual already_AddRefed<nsAccessible> CreateAccessible()
   {
     nsIFrame* realFrame = GetRealFrameForPlaceholder(this);
     return realFrame ? realFrame->CreateAccessible() :
                        nsFrame::CreateAccessible();
   }
 #endif
 
-  NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
-                                        nsIFrame**      aProviderFrame,
-                                        PRBool*         aIsChild);
+  virtual nsIFrame* GetParentStyleContextFrame();
+
   /**
    * @return the out-of-flow for aFrame if aFrame is a placeholder; otherwise
    * aFrame
    */
   static nsIFrame* GetRealFrameFor(nsIFrame* aFrame) {
     NS_PRECONDITION(aFrame, "Must have a frame to work with");
     if (aFrame->GetType() == nsGkAtoms::placeholderFrame) {
       return GetRealFrameForPlaceholder(aFrame);
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -331,20 +331,17 @@ nsTableColGroupFrame::RemoveFrame(ChildL
     nsTableColFrame* colFrame = (nsTableColFrame*)aOldFrame;
     if (colFrame->GetColType() == eColContent) {
       contentRemoval = PR_TRUE;
       // Remove any anonymous column frames this <col> produced via a colspan
       nsTableColFrame* col = colFrame->GetNextCol();
       nsTableColFrame* nextCol;
       while (col && col->GetColType() == eColAnonymousCol) {
 #ifdef DEBUG
-        nsIFrame* providerFrame;
-        PRBool isChild;
-        colFrame->GetParentStyleContextFrame(PresContext(), &providerFrame,
-                                             &isChild);
+        nsIFrame* providerFrame = colFrame->GetParentStyleContextFrame();
         if (colFrame->GetStyleContext()->GetParent() ==
             providerFrame->GetStyleContext()) {
           NS_ASSERTION(col->GetStyleContext() == colFrame->GetStyleContext() &&
                        col->GetContent() == colFrame->GetContent(),
                        "How did that happen??");
         }
         // else colFrame is being removed because of a frame
         // reconstruct on it, and its style context is still the old
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -156,34 +156,29 @@ struct BCPropertyData
   BCPixelSize mTopBorderWidth;
   BCPixelSize mRightBorderWidth;
   BCPixelSize mBottomBorderWidth;
   BCPixelSize mLeftBorderWidth;
   BCPixelSize mLeftCellBorderWidth;
   BCPixelSize mRightCellBorderWidth;
 };
 
-NS_IMETHODIMP
-nsTableFrame::GetParentStyleContextFrame(nsPresContext*  aPresContext,
-                                         nsIFrame**      aProviderFrame,
-                                         PRBool*         aIsChild)
+nsIFrame*
+nsTableFrame::GetParentStyleContextFrame()
 {
   // Since our parent, the table outer frame, returned this frame, we
   // must return whatever our parent would normally have returned.
 
   NS_PRECONDITION(mParent, "table constructed without outer table");
   if (!mContent->GetParent() && !GetStyleContext()->GetPseudo()) {
     // We're the root.  We have no style context parent.
-    *aIsChild = PR_FALSE;
-    *aProviderFrame = nsnull;
-    return NS_OK;
-  }
-
-  return static_cast<nsFrame*>(mParent)->
-          DoGetParentStyleContextFrame(aPresContext, aProviderFrame, aIsChild);
+    return nsnull;
+  }
+
+  return static_cast<nsFrame*>(GetParent())->DoGetParentStyleContextFrame();
 }
 
 
 nsIAtom*
 nsTableFrame::GetType() const
 {
   return nsGkAtoms::tableFrame;
 }
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -344,19 +344,17 @@ public:
   nsresult ReflowTable(nsHTMLReflowMetrics&     aDesiredSize,
                        const nsHTMLReflowState& aReflowState,
                        nscoord                  aAvailHeight,
                        nsIFrame*&               aLastChildReflowed,
                        nsReflowStatus&          aStatus);
 
   nsFrameList& GetColGroups();
 
-  NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
-                                        nsIFrame**      aProviderFrame,
-                                        PRBool*         aIsChild);
+  virtual nsIFrame* GetParentStyleContextFrame();
 
   /**
    * Get the "type" of the frame
    *
    * @see nsGkAtoms::tableFrame
    */
   virtual nsIAtom* GetType() const;
 
--- a/layout/tables/nsTableOuterFrame.cpp
+++ b/layout/tables/nsTableOuterFrame.cpp
@@ -112,41 +112,35 @@ nsTableCaptionFrame::ComputeAutoSize(nsR
     if (min > aCBSize.width)
       min = aCBSize.width;
     if (min > result.width)
       result.width = min;
   }
   return result;
 }
 
-NS_IMETHODIMP 
-nsTableCaptionFrame::GetParentStyleContextFrame(nsPresContext* aPresContext,
-                                                nsIFrame**      aProviderFrame,
-                                                PRBool*         aIsChild)
+nsIFrame*
+nsTableCaptionFrame::GetParentStyleContextFrame()
 {
   NS_PRECONDITION(mContent->GetParent(),
                   "How could we not have a parent here?");
     
   // The caption's style context parent is the inner frame, unless
   // it's anonymous.
   nsIFrame* outerFrame = GetParent();
   if (outerFrame && outerFrame->GetType() == nsGkAtoms::tableOuterFrame) {
     nsIFrame* innerFrame = outerFrame->GetFirstPrincipalChild();
     if (innerFrame) {
-      *aProviderFrame =
-        nsFrame::CorrectStyleParentFrame(innerFrame,
-                                         GetStyleContext()->GetPseudo());
-      *aIsChild = PR_FALSE;
-      return NS_OK;
+      return nsFrame::CorrectStyleParentFrame(innerFrame,
+                                              GetStyleContext()->GetPseudo());
     }
   }
 
   NS_NOTREACHED("Where is our inner table frame?");
-  return nsBlockFrame::GetParentStyleContextFrame(aPresContext, aProviderFrame,
-                                                  aIsChild);
+  return nsBlockFrame::GetParentStyleContextFrame();
 }
 
 #ifdef ACCESSIBILITY
 already_AddRefed<nsAccessible>
 nsTableCaptionFrame::CreateAccessible()
 {
   if (!GetRect().IsEmpty()) {
     nsAccessibilityService* accService = nsIPresShell::AccService();
@@ -400,39 +394,33 @@ nsTableOuterFrame::SetSelected(PRBool   
                                SelectionType aType)
 {
   nsFrame::SetSelected(aSelected, aType);
   if (mInnerTableFrame) {
     mInnerTableFrame->SetSelected(aSelected, aType);
   }
 }
 
-NS_IMETHODIMP 
-nsTableOuterFrame::GetParentStyleContextFrame(nsPresContext* aPresContext,
-                                              nsIFrame**      aProviderFrame,
-                                              PRBool*         aIsChild)
+nsIFrame*
+nsTableOuterFrame::GetParentStyleContextFrame()
 {
   // The table outer frame and the (inner) table frame split the style
   // data by giving the table frame the style context associated with
   // the table content node and creating a style context for the outer
   // frame that is a *child* of the table frame's style context,
   // matching the ::-moz-table-outer pseudo-element.  html.css has a
   // rule that causes that pseudo-element (and thus the outer table)
   // to inherit *some* style properties from the table frame.  The
   // children of the table inherit directly from the inner table, and
   // the outer table's style context is a leaf.
 
   if (!mInnerTableFrame) {
-    *aProviderFrame = this;
-    *aIsChild = PR_FALSE;
-    return NS_ERROR_FAILURE;
+    return this;
   }
-  *aProviderFrame = mInnerTableFrame;
-  *aIsChild = PR_TRUE;
-  return NS_OK;
+  return mInnerTableFrame;
 }
 
 // INCREMENTAL REFLOW HELPER FUNCTIONS 
 
 void
 nsTableOuterFrame::InitChildReflowState(nsPresContext&    aPresContext,                     
                                         nsHTMLReflowState& aReflowState)
                                     
--- a/layout/tables/nsTableOuterFrame.h
+++ b/layout/tables/nsTableOuterFrame.h
@@ -54,19 +54,18 @@ public:
   virtual nsIAtom* GetType() const;
   friend nsIFrame* NS_NewTableCaptionFrame(nsIPresShell* aPresShell, nsStyleContext*  aContext);
 
   virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
                                  nsSize aCBSize, nscoord aAvailableWidth,
                                  nsSize aMargin, nsSize aBorder,
                                  nsSize aPadding, PRBool aShrinkWrap);
 
-  NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
-                                        nsIFrame**      aProviderFrame,
-                                        PRBool*         aIsChild);
+  virtual nsIFrame* GetParentStyleContextFrame();
+
 #ifdef ACCESSIBILITY
   virtual already_AddRefed<nsAccessible> CreateAccessible();
 #endif
 
 #ifdef NS_DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
 
@@ -164,19 +163,17 @@ public:
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
 
   /** SetSelected needs to be overridden to talk to inner tableframe
    */
   void SetSelected(PRBool aSelected,
                    SelectionType aType);
 
-  NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
-                                        nsIFrame**      aProviderFrame,
-                                        PRBool*         aIsChild);
+  virtual nsIFrame* GetParentStyleContextFrame();
 
   /*---------------- nsITableLayout methods ------------------------*/
 
   /** @see nsITableFrame::GetCellDataAt */
   NS_IMETHOD GetCellDataAt(PRInt32 aRowIndex, PRInt32 aColIndex, 
                            nsIDOMElement* &aCell,   //out params
                            PRInt32& aStartRowIndex, PRInt32& aStartColIndex, 
                            PRInt32& aRowSpan, PRInt32& aColSpan,