From 47a8d26973d9c4cd5b61f7fba2217b11577e2488 Mon Sep 17 00:00:00 2001 From: "dbaron%fas.harvard.edu" Date: Wed, 11 Dec 2002 02:29:35 +0000 Subject: [PATCH] Fix incorrect check of position property in IsPercentageBase. b=180845 r=roc sr=bzbarsky --- layout/generic/nsFrame.cpp | 26 +++++++++++--------------- layout/html/base/src/nsFrame.cpp | 26 +++++++++++--------------- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 0fd6cc16f01..8a4e73c78e9 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -2079,6 +2079,10 @@ nsFrame::GetFrameForPoint(nsIPresContext* aPresContext, NS_IMETHODIMP nsFrame::WillReflow(nsIPresContext* aPresContext) { + // bug 81268 + NS_ASSERTION(!(mState & NS_FRAME_IN_REFLOW), + "nsFrame::WillReflow: frame is already in reflow"); + NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS, ("WillReflow: oldState=%x", mState)); mState |= NS_FRAME_IN_REFLOW; @@ -2625,21 +2629,13 @@ nsFrame::IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState, NS_IMETHODIMP nsFrame::IsPercentageBase(PRBool& aBase) const { const nsStyleDisplay* display; - GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display); - - if (display->mPosition != NS_STYLE_POSITION_STATIC) { - aBase = PR_TRUE; - } - else { - if ((display->mDisplay == NS_STYLE_DISPLAY_BLOCK) || - (display->mDisplay == NS_STYLE_DISPLAY_LIST_ITEM) || - (display->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL)) { - aBase = PR_TRUE; - } - else { - aBase = PR_FALSE; - } - } + ::GetStyleData(mStyleContext, &display); + + // Absolute positioning causes |display->mDisplay| to be set to block, + // if needed. + aBase = display->mDisplay == NS_STYLE_DISPLAY_BLOCK || + display->mDisplay == NS_STYLE_DISPLAY_LIST_ITEM || + display->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL; return NS_OK; } diff --git a/layout/html/base/src/nsFrame.cpp b/layout/html/base/src/nsFrame.cpp index 0fd6cc16f01..8a4e73c78e9 100644 --- a/layout/html/base/src/nsFrame.cpp +++ b/layout/html/base/src/nsFrame.cpp @@ -2079,6 +2079,10 @@ nsFrame::GetFrameForPoint(nsIPresContext* aPresContext, NS_IMETHODIMP nsFrame::WillReflow(nsIPresContext* aPresContext) { + // bug 81268 + NS_ASSERTION(!(mState & NS_FRAME_IN_REFLOW), + "nsFrame::WillReflow: frame is already in reflow"); + NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS, ("WillReflow: oldState=%x", mState)); mState |= NS_FRAME_IN_REFLOW; @@ -2625,21 +2629,13 @@ nsFrame::IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState, NS_IMETHODIMP nsFrame::IsPercentageBase(PRBool& aBase) const { const nsStyleDisplay* display; - GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display); - - if (display->mPosition != NS_STYLE_POSITION_STATIC) { - aBase = PR_TRUE; - } - else { - if ((display->mDisplay == NS_STYLE_DISPLAY_BLOCK) || - (display->mDisplay == NS_STYLE_DISPLAY_LIST_ITEM) || - (display->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL)) { - aBase = PR_TRUE; - } - else { - aBase = PR_FALSE; - } - } + ::GetStyleData(mStyleContext, &display); + + // Absolute positioning causes |display->mDisplay| to be set to block, + // if needed. + aBase = display->mDisplay == NS_STYLE_DISPLAY_BLOCK || + display->mDisplay == NS_STYLE_DISPLAY_LIST_ITEM || + display->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL; return NS_OK; }