diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 20af7bd2bea..7b1e08c27b2 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -2108,10 +2108,7 @@ GetPercentHeight(const nsStyleCoord& aStyle, if (eStyleUnit_Percent != aStyle.GetUnit()) return PR_FALSE; - nsIFrame *f; - for (f = aFrame->GetParent(); f && !f->IsContainingBlock(); - f = f->GetParent()) - ; + nsIFrame *f = aFrame->GetContainingBlock(); if (!f) { NS_NOTREACHED("top of frame tree not a containing block"); return PR_FALSE; diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index cba0fe30e7d..53a47ddd027 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -780,6 +780,13 @@ public: */ static nsBlockFrame* GetAsBlock(nsIFrame* aFrame); + /* + * Whether the frame is an nsBlockFrame which is not a wrapper block. + */ + static bool IsNonWrapperBlock(nsIFrame* aFrame) { + return GetAsBlock(aFrame) && !aFrame->IsBlockWrapper(); + } + /** * If aFrame is an out of flow frame, return its placeholder, otherwise * return its parent. diff --git a/layout/forms/nsFieldSetFrame.cpp b/layout/forms/nsFieldSetFrame.cpp index b4f653555b2..220032d1144 100644 --- a/layout/forms/nsFieldSetFrame.cpp +++ b/layout/forms/nsFieldSetFrame.cpp @@ -106,7 +106,6 @@ public: nsIFrame* aOldFrame); virtual nsIAtom* GetType() const; - virtual bool IsContainingBlock() const; #ifdef ACCESSIBILITY virtual already_AddRefed CreateAccessible(); @@ -151,12 +150,6 @@ nsFieldSetFrame::GetType() const return nsGkAtoms::fieldSetFrame; } -bool -nsFieldSetFrame::IsContainingBlock() const -{ - return PR_TRUE; -} - NS_IMETHODIMP nsFieldSetFrame::SetInitialChildList(ChildListID aListID, nsFrameList& aChildList) diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp index 4e038da7b6d..8aac0925e72 100644 --- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -361,12 +361,6 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext, aDesiredSize.ascent += yoff; } -/* virtual */ bool -nsHTMLButtonControlFrame::IsContainingBlock() const -{ - return PR_TRUE; -} - PRIntn nsHTMLButtonControlFrame::GetSkipSides() const { diff --git a/layout/forms/nsHTMLButtonControlFrame.h b/layout/forms/nsHTMLButtonControlFrame.h index 3e67b63d878..de806f0aaab 100644 --- a/layout/forms/nsHTMLButtonControlFrame.h +++ b/layout/forms/nsHTMLButtonControlFrame.h @@ -79,8 +79,6 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - virtual bool IsContainingBlock() const; - NS_IMETHOD HandleEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent, nsEventStatus* aEventStatus); diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index b8e4b37cca0..86fd26f50ef 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -1758,15 +1758,6 @@ nsListControlFrame::GetType() const return nsGkAtoms::listControlFrame; } -bool -nsListControlFrame::IsContainingBlock() const -{ - // We are in fact the containing block for our options. They should - // certainly not use our parent block (or worse yet our parent combobox) for - // their sizing. - return PR_TRUE; -} - void nsListControlFrame::InvalidateInternal(const nsRect& aDamageRect, nscoord aX, nscoord aY, nsIFrame* aForChild, diff --git a/layout/forms/nsListControlFrame.h b/layout/forms/nsListControlFrame.h index 2c8398cde6d..33a67de8fb2 100644 --- a/layout/forms/nsListControlFrame.h +++ b/layout/forms/nsListControlFrame.h @@ -124,8 +124,6 @@ public: ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock)); } - virtual bool IsContainingBlock() const; - virtual void InvalidateInternal(const nsRect& aDamageRect, nscoord aX, nscoord aY, nsIFrame* aForChild, PRUint32 aFlags); diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 3384318e003..71ee7056d2b 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -629,22 +629,6 @@ nsBlockFrame::GetChildLists(nsTArray* aLists) const } } -/* virtual */ bool -nsBlockFrame::IsContainingBlock() const -{ - // The block wrappers we use to wrap blocks inside inlines aren't - // described in the CSS spec. We need to make them not be containing - // blocks for the cases where we care about the 'direction' property - // of an element's containing block. - // Since the parent of such a block is either a normal block or - // another such pseudo, this shouldn't cause anything bad to happen. - // Also the anonymous blocks inside table cells are not containing blocks. - nsIAtom *pseudoType = GetStyleContext()->GetPseudo(); - return pseudoType != nsCSSAnonBoxes::mozAnonymousBlock && - pseudoType != nsCSSAnonBoxes::mozAnonymousPositionedBlock && - pseudoType != nsCSSAnonBoxes::cellContent; -} - /* virtual */ bool nsBlockFrame::IsFloatContainingBlock() const { diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h index 0110286ed43..597a2726b59 100644 --- a/layout/generic/nsBlockFrame.h +++ b/layout/generic/nsBlockFrame.h @@ -181,7 +181,6 @@ public: virtual nscoord GetCaretBaseline() const; virtual void DestroyFrom(nsIFrame* aDestructRoot); virtual nsSplittableType GetSplittableType() const; - virtual bool IsContainingBlock() const; virtual bool IsFloatContainingBlock() const; NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, diff --git a/layout/generic/nsCanvasFrame.h b/layout/generic/nsCanvasFrame.h index 64f14776ef3..0d2bc812fae 100644 --- a/layout/generic/nsCanvasFrame.h +++ b/layout/generic/nsCanvasFrame.h @@ -88,7 +88,6 @@ public: nsHTMLReflowMetrics& aDesiredSize, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - virtual bool IsContainingBlock() const { return true; } virtual bool IsFrameOfType(PRUint32 aFlags) const { return nsHTMLContainerFrame::IsFrameOfType(aFlags & diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 8472614df31..42188184ae5 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1787,7 +1787,6 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder, // XXX we REALLY need a "are you an inline-block sort of thing?" here!!! if ((aFlags & DISPLAY_CHILD_INLINE) && (disp->mDisplay != NS_STYLE_DISPLAY_INLINE || - aChild->IsContainingBlock() || (aChild->IsFrameOfType(eReplaced)))) { // child is a non-inline frame in an inline context, i.e., // it acts like inline-block or inline-table. Therefore it is a @@ -4905,16 +4904,43 @@ nsFrame::IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState, return PR_FALSE; } -/* virtual */ bool nsFrame::IsContainingBlock() const +bool +nsIFrame::IsBlockWrapper() const { - const nsStyleDisplay* display = GetStyleDisplay(); + nsIAtom *pseudoType = GetStyleContext()->GetPseudo(); + return (pseudoType == nsCSSAnonBoxes::mozAnonymousBlock || + pseudoType == nsCSSAnonBoxes::mozAnonymousPositionedBlock || + pseudoType == nsCSSAnonBoxes::cellContent); +} - // Absolute positioning causes |display->mDisplay| to be set to block, - // if needed. - return display->mDisplay == NS_STYLE_DISPLAY_BLOCK || - display->mDisplay == NS_STYLE_DISPLAY_INLINE_BLOCK || - display->mDisplay == NS_STYLE_DISPLAY_LIST_ITEM || - display->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL; +static nsIFrame* +GetNearestBlockContainer(nsIFrame* frame) +{ + // The block wrappers we use to wrap blocks inside inlines aren't + // described in the CSS spec. We need to make them not be containing + // blocks. + // Since the parent of such a block is either a normal block or + // another such pseudo, this shouldn't cause anything bad to happen. + // Also the anonymous blocks inside table cells are not containing blocks. + while (frame->IsFrameOfType(nsIFrame::eLineParticipant) || + frame->IsBlockWrapper()) { + frame = frame->GetParent(); + NS_ASSERTION(frame, "How come we got to the root frame without seeing a containing block?"); + } + return frame; +} + +nsIFrame* +nsIFrame::GetContainingBlock() const +{ + // MathML frames might have absolute positioning style, but they would + // still be in-flow. So we have to check to make sure that the frame + // is really out-of-flow too. + if (GetStyleDisplay()->IsAbsolutelyPositioned() && + (GetStateBits() & NS_FRAME_OUT_OF_FLOW)) { + return GetParent(); // the parent is always the containing block + } + return GetNearestBlockContainer(GetParent()); } #ifdef NS_DEBUG diff --git a/layout/generic/nsFrame.h b/layout/generic/nsFrame.h index ac76dcad647..74b37e8f5e2 100644 --- a/layout/generic/nsFrame.h +++ b/layout/generic/nsFrame.h @@ -231,7 +231,6 @@ public: NS_IMETHOD SetNextInFlow(nsIFrame*); NS_IMETHOD GetOffsetFromView(nsPoint& aOffset, nsIView** aView) const; virtual nsIAtom* GetType() const; - virtual bool IsContainingBlock() const; NS_IMETHOD GetSelected(bool *aSelected) const; NS_IMETHOD IsSelectable(bool* aIsSelectable, PRUint8* aSelectStyle) const; diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp index 23bc539f0d2..3a919eca39a 100644 --- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -299,31 +299,17 @@ void nsHTMLReflowState::InitCBReflowState() return; } - // If outer tables ever become containing blocks, we need to make sure to use - // their mCBReflowState in the non-absolutely-positioned case for inner - // tables. - NS_ASSERTION(frame->GetType() != nsGkAtoms::tableFrame || - !frame->GetParent()->IsContainingBlock(), - "Outer table should not be containing block"); - - if (parentReflowState->frame->IsContainingBlock() || - // Absolutely positioned frames should always be kids of the frames that - // determine their containing block.... - (NS_FRAME_GET_TYPE(mFrameType) == NS_CSS_FRAME_TYPE_ABSOLUTE)) { - // an absolutely positioned inner table needs to use the parent of - // the outer table. So the above comment about absolutely - // positioned frames is sort of a lie. - if (parentReflowState->parentReflowState && - frame->GetType() == nsGkAtoms::tableFrame) { - mCBReflowState = parentReflowState->parentReflowState; + if (parentReflowState->frame == frame->GetContainingBlock()) { + // Inner table frames need to use the containing block of the outer + // table frame. + if (frame->GetType() == nsGkAtoms::tableFrame) { + mCBReflowState = parentReflowState->mCBReflowState; } else { mCBReflowState = parentReflowState; } - - return; + } else { + mCBReflowState = parentReflowState->mCBReflowState; } - - mCBReflowState = parentReflowState->mCBReflowState; } /* Check whether CalcQuirkContainingBlockHeight would stop on the @@ -373,7 +359,7 @@ nsHTMLReflowState::InitResizeFlags(nsPresContext* aPresContext) // mCBReflowState->mFlags.mVResize is set correctly below when // reflowing descendant. mFlags.mVResize = PR_TRUE; - } else if (mCBReflowState && !frame->IsContainingBlock()) { + } else if (mCBReflowState && !nsLayoutUtils::IsNonWrapperBlock(frame)) { // XXX Is this problematic for relatively positioned inlines acting // as containing block for absolutely positioned elements? // Possibly; in that case we should at least be checking @@ -415,7 +401,7 @@ nsHTMLReflowState::InitResizeFlags(nsPresContext* aPresContext) // line-height depends on block height frame->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_HEIGHT); // but only on containing blocks if this frame is not a suitable block - dependsOnCBHeight |= !frame->IsContainingBlock(); + dependsOnCBHeight |= !nsLayoutUtils::IsNonWrapperBlock(frame); } // If we're the descendant of a table cell that performs special height @@ -488,23 +474,6 @@ nsHTMLReflowState::GetContainingBlockContentWidth(const nsHTMLReflowState* aRefl return rs->mComputedWidth; } -/* static */ -nsIFrame* -nsHTMLReflowState::GetContainingBlockFor(const nsIFrame* aFrame) -{ - NS_PRECONDITION(aFrame, "Must have frame to work with"); - nsIFrame* container = aFrame->GetParent(); - if (aFrame->GetStyleDisplay()->IsAbsolutelyPositioned()) { - // Absolutely positioned frames are just kids of their containing - // blocks (which may happen to be inlines). - return container; - } - while (container && !container->IsContainingBlock()) { - container = container->GetParent(); - } - return container; -} - void nsHTMLReflowState::InitFrameType() { @@ -701,22 +670,12 @@ nsHTMLReflowState::ComputeRelativeOffsets(const nsHTMLReflowState* cbrs, } } -static nsIFrame* -GetNearestContainingBlock(nsIFrame *aFrame) -{ - nsIFrame *cb = aFrame; - do { - cb = cb->GetParent(); - } while (!cb->IsContainingBlock()); - return cb; -} - nsIFrame* nsHTMLReflowState::GetHypotheticalBoxContainer(nsIFrame* aFrame, nscoord& aCBLeftEdge, nscoord& aCBWidth) { - aFrame = GetNearestContainingBlock(aFrame); + aFrame = aFrame->GetContainingBlock(); NS_ASSERTION(aFrame != frame, "How did that happen?"); /* Now aFrame is the containing block we want */ @@ -1190,7 +1149,7 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext, if (leftIsAuto && rightIsAuto) { // Use the direction of the original ("static-position") containing block // to dictate whether 'left' or 'right' is treated like 'static-position'. - if (NS_STYLE_DIRECTION_LTR == GetNearestContainingBlock(placeholderFrame) + if (NS_STYLE_DIRECTION_LTR == placeholderFrame->GetContainingBlock() ->GetStyleVisibility()->mDirection) { NS_ASSERTION(hypotheticalBox.mLeftIsExact, "should always have " "exact value on containing block's start side"); @@ -1570,8 +1529,13 @@ nsHTMLReflowState::ComputeContainingBlockRectangle(nsPresContext* aPres // formed by the content edge of the nearest block-level ancestor aContainingBlockWidth = aContainingBlockRS->mComputedWidth; aContainingBlockHeight = aContainingBlockRS->mComputedHeight; - - if (NS_FRAME_GET_TYPE(mFrameType) == NS_CSS_FRAME_TYPE_ABSOLUTE) { + + // mFrameType for abs-pos tables is NS_CSS_FRAME_TYPE_BLOCK, so we need to + // special case them here. + if (NS_FRAME_GET_TYPE(mFrameType) == NS_CSS_FRAME_TYPE_ABSOLUTE || + (frame->GetType() == nsGkAtoms::tableFrame && + frame->GetStyleDisplay()->IsAbsolutelyPositioned() && + (frame->GetParent()->GetStateBits() & NS_FRAME_OUT_OF_FLOW))) { // See if the ancestor is block-level or inline-level if (NS_FRAME_GET_TYPE(aContainingBlockRS->mFrameType) == NS_CSS_FRAME_TYPE_INLINE) { // Base our size on the actual size of the frame. In cases when this is @@ -2168,7 +2132,7 @@ nscoord nsHTMLReflowState::CalcLineHeight() const { nscoord blockHeight = - frame->IsContainingBlock() ? mComputedHeight : + nsLayoutUtils::IsNonWrapperBlock(frame) ? mComputedHeight : (mCBReflowState ? mCBReflowState->mComputedHeight : NS_AUTOHEIGHT); return CalcLineHeight(frame->GetStyleContext(), blockHeight); diff --git a/layout/generic/nsHTMLReflowState.h b/layout/generic/nsHTMLReflowState.h index 9027e603361..7bcf702093f 100644 --- a/layout/generic/nsHTMLReflowState.h +++ b/layout/generic/nsHTMLReflowState.h @@ -405,13 +405,6 @@ public: static nscoord GetContainingBlockContentWidth(const nsHTMLReflowState* aReflowState); - /** - * Find the containing block of aFrame. This may return null if - * there isn't one (but that should really only happen for root - * frames). - */ - static nsIFrame* GetContainingBlockFor(const nsIFrame* aFrame); - /** * Calculate the used line-height property. The return value will be >= 0. */ diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index fd3db548086..62e1ee243f3 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -1982,9 +1982,17 @@ public: } /** - * Is this frame a containing block for non-positioned elements? + * Returns true if the frame is a block wrapper. */ - virtual bool IsContainingBlock() const = 0; + bool IsBlockWrapper() const; + + /** + * Get this frame's CSS containing block. + * + * The algorithm is defined in + * http://www.w3.org/TR/CSS2/visudet.html#containing-block-details. + */ + nsIFrame* GetContainingBlock() const; /** * Is this frame a containing block for floating elements? diff --git a/layout/generic/nsPageContentFrame.cpp b/layout/generic/nsPageContentFrame.cpp index fc253fd832a..ed1be6848e4 100644 --- a/layout/generic/nsPageContentFrame.cpp +++ b/layout/generic/nsPageContentFrame.cpp @@ -168,9 +168,3 @@ nsPageContentFrame::GetFrameName(nsAString& aResult) const return MakeFrameName(NS_LITERAL_STRING("PageContent"), aResult); } #endif - -/* virtual */ bool -nsPageContentFrame::IsContainingBlock() const -{ - return PR_TRUE; -} diff --git a/layout/generic/nsPageContentFrame.h b/layout/generic/nsPageContentFrame.h index 907892669bf..dd891f7d8e2 100644 --- a/layout/generic/nsPageContentFrame.h +++ b/layout/generic/nsPageContentFrame.h @@ -56,7 +56,6 @@ public: const nsHTMLReflowState& aMaxSize, nsReflowStatus& aStatus); - virtual bool IsContainingBlock() const; virtual bool IsFrameOfType(PRUint32 aFlags) const { return ViewportFrame::IsFrameOfType(aFlags & diff --git a/layout/generic/nsPageFrame.cpp b/layout/generic/nsPageFrame.cpp index c6c097f1031..a1e4028445b 100644 --- a/layout/generic/nsPageFrame.cpp +++ b/layout/generic/nsPageFrame.cpp @@ -175,12 +175,6 @@ nsPageFrame::GetFrameName(nsAString& aResult) const } #endif -/* virtual */ bool -nsPageFrame::IsContainingBlock() const -{ - return PR_TRUE; -} - void nsPageFrame::ProcessSpecialCodes(const nsString& aStr, nsString& aNewStr) { diff --git a/layout/generic/nsPageFrame.h b/layout/generic/nsPageFrame.h index 02d118e854e..4551fda3006 100644 --- a/layout/generic/nsPageFrame.h +++ b/layout/generic/nsPageFrame.h @@ -59,8 +59,6 @@ public: const nsRect& aDirtyRect, const nsDisplayListSet& aLists); - virtual bool IsContainingBlock() const; - /** * Get the "type" of the frame * diff --git a/layout/generic/nsViewportFrame.cpp b/layout/generic/nsViewportFrame.cpp index 670a09aed7f..72fe3e884c3 100644 --- a/layout/generic/nsViewportFrame.cpp +++ b/layout/generic/nsViewportFrame.cpp @@ -290,12 +290,6 @@ ViewportFrame::GetType() const return nsGkAtoms::viewportFrame; } -/* virtual */ bool -ViewportFrame::IsContainingBlock() const -{ - return PR_TRUE; -} - void ViewportFrame::InvalidateInternal(const nsRect& aDamageRect, nscoord aX, nscoord aY, nsIFrame* aForChild, diff --git a/layout/generic/nsViewportFrame.h b/layout/generic/nsViewportFrame.h index 2f7dfae2992..85554e68bf9 100644 --- a/layout/generic/nsViewportFrame.h +++ b/layout/generic/nsViewportFrame.h @@ -100,8 +100,6 @@ public: * @see nsGkAtoms::viewportFrame */ virtual nsIAtom* GetType() const; - - virtual bool IsContainingBlock() const; virtual void InvalidateInternal(const nsRect& aDamageRect, nscoord aX, nscoord aY, nsIFrame* aForChild, diff --git a/layout/reftests/bugs/10209-1.html b/layout/reftests/bugs/10209-1.html new file mode 100644 index 00000000000..567f2a78f87 --- /dev/null +++ b/layout/reftests/bugs/10209-1.html @@ -0,0 +1,16 @@ + + + +
+ +
+
+ diff --git a/layout/reftests/bugs/10209-2.html b/layout/reftests/bugs/10209-2.html new file mode 100644 index 00000000000..65af40eaec6 --- /dev/null +++ b/layout/reftests/bugs/10209-2.html @@ -0,0 +1,16 @@ + + + +
+ +
+
+ diff --git a/layout/reftests/bugs/10209-3-ref.html b/layout/reftests/bugs/10209-3-ref.html new file mode 100644 index 00000000000..6f16cba6d67 --- /dev/null +++ b/layout/reftests/bugs/10209-3-ref.html @@ -0,0 +1,14 @@ + + + +
+
+ diff --git a/layout/reftests/bugs/10209-3.html b/layout/reftests/bugs/10209-3.html new file mode 100644 index 00000000000..b4bc59ddd1a --- /dev/null +++ b/layout/reftests/bugs/10209-3.html @@ -0,0 +1,13 @@ + + + +
+ diff --git a/layout/reftests/bugs/10209-ref.html b/layout/reftests/bugs/10209-ref.html new file mode 100644 index 00000000000..042326c0ad2 --- /dev/null +++ b/layout/reftests/bugs/10209-ref.html @@ -0,0 +1,14 @@ + + + +
+
+ diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index a47d79861ea..ed54d8763dc 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -18,6 +18,9 @@ == 9458-zorder-4.html 9458-zorder-ref-inline-block.html == 9458-zorder-5.html 9458-zorder-ref-inline-block.html == 10036-1.html 10036-1-ref.html +skip-if(!cocoaWidget) HTTP(..) == 10209-1.html 10209-ref.html # Bug 667079 +HTTP(..) == 10209-2.html 10209-ref.html +asserts(4) skip-if(!cocoaWidget) HTTP(..) == 10209-3.html 10209-3-ref.html # Assertions: bug 666606, skip because of bug 667079 == 18217-basic-1.html 18217-basic-1-ref.html == 18217-basic-2a.html 18217-basic-2-ref.html == 18217-basic-2b.html 18217-basic-2-ref.html diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 6aecb060071..64dab7d0d68 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -131,7 +131,7 @@ GetContainingBlockFor(nsIFrame* aFrame) { if (!aFrame) { return nsnull; } - return nsHTMLReflowState::GetContainingBlockFor(aFrame); + return aFrame->GetContainingBlock(); } nsComputedDOMStyle::nsComputedDOMStyle() @@ -3332,7 +3332,7 @@ nsComputedDOMStyle::GetLineHeightCoord(nscoord& aCoord) if (!mInnerFrame) return PR_FALSE; - if (mInnerFrame->IsContainingBlock()) { + if (nsLayoutUtils::IsNonWrapperBlock(mInnerFrame)) { blockHeight = mInnerFrame->GetContentRect().height; } else { GetCBContentHeight(blockHeight); diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index 6174ad0d30e..e2a4d7ffd83 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -1043,12 +1043,6 @@ nsTableCellFrame::GetType() const return nsGkAtoms::tableCellFrame; } -/* virtual */ bool -nsTableCellFrame::IsContainingBlock() const -{ - return PR_TRUE; -} - #ifdef DEBUG NS_IMETHODIMP nsTableCellFrame::GetFrameName(nsAString& aResult) const diff --git a/layout/tables/nsTableCellFrame.h b/layout/tables/nsTableCellFrame.h index d9addfef5cd..c1fab106ff6 100644 --- a/layout/tables/nsTableCellFrame.h +++ b/layout/tables/nsTableCellFrame.h @@ -149,8 +149,6 @@ public: */ virtual nsIAtom* GetType() const; - virtual bool IsContainingBlock() const; - #ifdef DEBUG NS_IMETHOD GetFrameName(nsAString& aResult) const; #endif diff --git a/layout/tables/nsTableColGroupFrame.cpp b/layout/tables/nsTableColGroupFrame.cpp index 7b83d5fa4b3..9071c2a75a2 100644 --- a/layout/tables/nsTableColGroupFrame.cpp +++ b/layout/tables/nsTableColGroupFrame.cpp @@ -429,12 +429,6 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsPresContext* aPresContext, return rv; } -/* virtual */ bool -nsTableColGroupFrame::IsContainingBlock() const -{ - return PR_TRUE; -} - nsTableColFrame * nsTableColGroupFrame::GetFirstColumn() { return GetNextColumn(nsnull); diff --git a/layout/tables/nsTableColGroupFrame.h b/layout/tables/nsTableColGroupFrame.h index 6148f61ffb8..a0c90415957 100644 --- a/layout/tables/nsTableColGroupFrame.h +++ b/layout/tables/nsTableColGroupFrame.h @@ -142,10 +142,6 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - /* needed only because we use Reflow in a hacky way, see - nsTableFrame::ReflowColGroups */ - virtual bool IsContainingBlock() const; - /** * Get the "type" of the frame * diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index d8684d375c6..faa81fd90e2 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -359,12 +359,6 @@ nsTableFrame::SetInitialChildList(ChildListID aListID, return NS_OK; } -/* virtual */ bool -nsTableFrame::IsContainingBlock() const -{ - return PR_TRUE; -} - void nsTableFrame::AttributeChangedFor(nsIFrame* aFrame, nsIContent* aContent, nsIAtom* aAttribute) diff --git a/layout/tables/nsTableFrame.h b/layout/tables/nsTableFrame.h index 70ff269053b..d67302c13d3 100644 --- a/layout/tables/nsTableFrame.h +++ b/layout/tables/nsTableFrame.h @@ -164,8 +164,6 @@ public: // height reflow will occur. static void RequestSpecialHeightReflow(const nsHTMLReflowState& aReflowState); - virtual bool IsContainingBlock() const; - static void RePositionViews(nsIFrame* aFrame); static bool PageBreakAfter(nsIFrame* aSourceFrame, diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp index 829273e91fd..c9cf99b591b 100644 --- a/layout/tables/nsTableOuterFrame.cpp +++ b/layout/tables/nsTableOuterFrame.cpp @@ -199,12 +199,6 @@ nsTableOuterFrame::CreateAccessible() } #endif -/* virtual */ bool -nsTableOuterFrame::IsContainingBlock() const -{ - return PR_FALSE; -} - void nsTableOuterFrame::DestroyFrom(nsIFrame* aDestructRoot) { diff --git a/layout/tables/nsTableOuterFrame.h b/layout/tables/nsTableOuterFrame.h index eae1911d0d5..575b7926047 100644 --- a/layout/tables/nsTableOuterFrame.h +++ b/layout/tables/nsTableOuterFrame.h @@ -98,8 +98,6 @@ public: // nsIFrame overrides - see there for a description virtual void DestroyFrom(nsIFrame* aDestructRoot); - - virtual bool IsContainingBlock() const; NS_IMETHOD SetInitialChildList(ChildListID aListID, nsFrameList& aChildList); diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp index 9d1869ab4a5..45befdd934c 100644 --- a/layout/tables/nsTableRowGroupFrame.cpp +++ b/layout/tables/nsTableRowGroupFrame.cpp @@ -69,12 +69,6 @@ NS_QUERYFRAME_HEAD(nsTableRowGroupFrame) NS_QUERYFRAME_ENTRY(nsTableRowGroupFrame) NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame) -/* virtual */ bool -nsTableRowGroupFrame::IsContainingBlock() const -{ - return PR_TRUE; -} - PRInt32 nsTableRowGroupFrame::GetRowCount() { diff --git a/layout/tables/nsTableRowGroupFrame.h b/layout/tables/nsTableRowGroupFrame.h index 60e1575a107..daddb91fa07 100644 --- a/layout/tables/nsTableRowGroupFrame.h +++ b/layout/tables/nsTableRowGroupFrame.h @@ -149,8 +149,6 @@ public: */ virtual nsIAtom* GetType() const; - virtual bool IsContainingBlock() const; - nsTableRowFrame* GetFirstRow(); #ifdef DEBUG diff --git a/layout/xul/base/src/nsScrollbarFrame.cpp b/layout/xul/base/src/nsScrollbarFrame.cpp index 69ea40a77c5..a625ddd8eff 100644 --- a/layout/xul/base/src/nsScrollbarFrame.cpp +++ b/layout/xul/base/src/nsScrollbarFrame.cpp @@ -102,14 +102,6 @@ nsScrollbarFrame::Reflow(nsPresContext* aPresContext, return NS_OK; } -/* virtual */ bool -nsScrollbarFrame::IsContainingBlock() const -{ - // Return true so that the nsHTMLReflowState code is happy with us - // being a reflow root. - return PR_TRUE; -} - nsIAtom* nsScrollbarFrame::GetType() const { diff --git a/layout/xul/base/src/nsScrollbarFrame.h b/layout/xul/base/src/nsScrollbarFrame.h index 4ee0d6db868..1430db972c7 100644 --- a/layout/xul/base/src/nsScrollbarFrame.h +++ b/layout/xul/base/src/nsScrollbarFrame.h @@ -96,8 +96,6 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); - virtual bool IsContainingBlock() const; - virtual nsIAtom* GetType() const; void SetScrollbarMediatorContent(nsIContent* aMediator);