From 980fd2992c89e151ee76941eadf033a73db8a3b9 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 31 Mar 2010 08:43:27 -0400 Subject: [PATCH] Bug 253889: DeCOMtaminate nsIPresShell - IsReflowLocked(). r=roc --HG-- extra : rebase_source : 46adf0d5ad41602276c8bcded46e7dae0f399da9 --- layout/base/nsCSSFrameConstructor.cpp | 4 +--- layout/base/nsIPresShell.h | 2 +- layout/base/nsPresContext.cpp | 4 +--- layout/base/nsPresShell.cpp | 9 ++++----- layout/svg/base/src/nsSVGForeignObjectFrame.cpp | 4 +--- layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp | 8 ++------ 6 files changed, 10 insertions(+), 21 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 1289fff982b..59c561a218e 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -10739,9 +10739,7 @@ nsCSSFrameConstructor::ReframeContainingBlock(nsIFrame* aFrame) // XXXbz how exactly would we get here while isReflowing anyway? Should this // whole test be ifdef DEBUG? - PRBool isReflowing; - mPresShell->IsReflowLocked(&isReflowing); - if(isReflowing) { + if (mPresShell->IsReflowLocked()) { // don't ReframeContainingBlock, this will result in a crash // if we remove a tree that's in reflow - see bug 121368 for testcase NS_ERROR("Atemptted to nsCSSFrameConstructor::ReframeContainingBlock during a Reflow!!!"); diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 9ad9a24c757..e5996b1f2ff 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -669,7 +669,7 @@ public: * Determine if reflow is currently locked * @param aIsReflowLocked returns PR_TRUE if reflow is locked, PR_FALSE otherwise */ - NS_IMETHOD IsReflowLocked(PRBool* aIsLocked) = 0; + virtual NS_HIDDEN_(PRBool) IsReflowLocked() const = 0; /** * Called to find out if painting is suppressed for this presshell. If it is suppressd, diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index d0416f1a397..843c71904d6 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -1846,9 +1846,7 @@ nsPresContext::GetUserFontSetInternal() #ifdef DEBUG { PRBool inReflow; - NS_ASSERTION(!userFontSetGottenBefore || - (NS_SUCCEEDED(mShell->IsReflowLocked(&inReflow)) && - !inReflow), + NS_ASSERTION(!userFontSetGottenBefore || !mShell->IsReflowLocked(), "FlushUserFontSet should have been called first"); } #endif diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 01b2436b2a2..a15d9c62ae8 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -759,7 +759,7 @@ public: virtual NS_HIDDEN_(nsIFrame*) GetEventTargetFrame(); virtual NS_HIDDEN_(already_AddRefed) GetEventTargetContent(nsEvent* aEvent); - NS_IMETHOD IsReflowLocked(PRBool* aIsLocked); + virtual NS_HIDDEN_(PRBool) IsReflowLocked() const; virtual nsresult ReconstructFrames(void); virtual void Freeze(); @@ -4697,11 +4697,10 @@ PresShell::FlushPendingNotifications(mozFlushType aType) } } -NS_IMETHODIMP -PresShell::IsReflowLocked(PRBool* aIsReflowLocked) +PRBool +PresShell::IsReflowLocked() const { - *aIsReflowLocked = mIsReflowing; - return NS_OK; + return mIsReflowing; } void diff --git a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp index f6fe5c45661..cfd4b7826b1 100644 --- a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp +++ b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp @@ -400,9 +400,7 @@ nsSVGForeignObjectFrame::NotifySVGChanged(PRUint32 aFlags) // PresShell and prevent it from reflowing us properly in future. Besides // that, nsSVGOuterSVGFrame::DidReflow will take care of reflowing us // synchronously, so there's no need. - PRBool reflowing; - PresContext()->PresShell()->IsReflowLocked(&reflowing); - if (!reflowing) { + if (!PresContext()->PresShell()->IsReflowLocked()) { UpdateGraphic(); // update mRect before requesting reflow RequestReflow(nsIPresShell::eResize); } diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index 0f6e9584fb7..78f8dec6c3c 100644 --- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -370,9 +370,7 @@ void nsTreeBodyFrame::EnsureView() { if (!mView) { - PRBool isInReflow; - PresContext()->PresShell()->IsReflowLocked(&isInReflow); - if (isInReflow) { + if (PresContext()->PresShell()->IsReflowLocked()) { if (!mReflowCallbackPosted) { mReflowCallbackPosted = PR_TRUE; PresContext()->PresShell()->PostReflowCallback(this); @@ -532,9 +530,7 @@ nsTreeBodyFrame::SetView(nsITreeView * aView) NS_ENSURE_STATE(weakFrame.IsAlive()); mView->GetRowCount(&mRowCount); - PRBool isInReflow; - PresContext()->PresShell()->IsReflowLocked(&isInReflow); - if (!isInReflow) { + if (!PresContext()->PresShell()->IsReflowLocked()) { // The scrollbar will need to be updated. FullScrollbarsUpdate(PR_FALSE); } else if (!mReflowCallbackPosted) {