Bug 253889: DeCOMtaminate nsIPresShell - IsReflowLocked(). r=roc

--HG--
extra : rebase_source : 46adf0d5ad41602276c8bcded46e7dae0f399da9
This commit is contained in:
Craig Topper 2010-03-31 08:43:27 -04:00
parent a31830c001
commit 980fd2992c
6 changed files with 10 additions and 21 deletions

View File

@ -10739,9 +10739,7 @@ nsCSSFrameConstructor::ReframeContainingBlock(nsIFrame* aFrame)
// XXXbz how exactly would we get here while isReflowing anyway? Should this // XXXbz how exactly would we get here while isReflowing anyway? Should this
// whole test be ifdef DEBUG? // whole test be ifdef DEBUG?
PRBool isReflowing; if (mPresShell->IsReflowLocked()) {
mPresShell->IsReflowLocked(&isReflowing);
if(isReflowing) {
// don't ReframeContainingBlock, this will result in a crash // don't ReframeContainingBlock, this will result in a crash
// if we remove a tree that's in reflow - see bug 121368 for testcase // if we remove a tree that's in reflow - see bug 121368 for testcase
NS_ERROR("Atemptted to nsCSSFrameConstructor::ReframeContainingBlock during a Reflow!!!"); NS_ERROR("Atemptted to nsCSSFrameConstructor::ReframeContainingBlock during a Reflow!!!");

View File

@ -669,7 +669,7 @@ public:
* Determine if reflow is currently locked * Determine if reflow is currently locked
* @param aIsReflowLocked returns PR_TRUE if reflow is locked, PR_FALSE otherwise * @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, * Called to find out if painting is suppressed for this presshell. If it is suppressd,

View File

@ -1846,9 +1846,7 @@ nsPresContext::GetUserFontSetInternal()
#ifdef DEBUG #ifdef DEBUG
{ {
PRBool inReflow; PRBool inReflow;
NS_ASSERTION(!userFontSetGottenBefore || NS_ASSERTION(!userFontSetGottenBefore || !mShell->IsReflowLocked(),
(NS_SUCCEEDED(mShell->IsReflowLocked(&inReflow)) &&
!inReflow),
"FlushUserFontSet should have been called first"); "FlushUserFontSet should have been called first");
} }
#endif #endif

View File

@ -759,7 +759,7 @@ public:
virtual NS_HIDDEN_(nsIFrame*) GetEventTargetFrame(); virtual NS_HIDDEN_(nsIFrame*) GetEventTargetFrame();
virtual NS_HIDDEN_(already_AddRefed<nsIContent>) GetEventTargetContent(nsEvent* aEvent); virtual NS_HIDDEN_(already_AddRefed<nsIContent>) GetEventTargetContent(nsEvent* aEvent);
NS_IMETHOD IsReflowLocked(PRBool* aIsLocked); virtual NS_HIDDEN_(PRBool) IsReflowLocked() const;
virtual nsresult ReconstructFrames(void); virtual nsresult ReconstructFrames(void);
virtual void Freeze(); virtual void Freeze();
@ -4697,11 +4697,10 @@ PresShell::FlushPendingNotifications(mozFlushType aType)
} }
} }
NS_IMETHODIMP PRBool
PresShell::IsReflowLocked(PRBool* aIsReflowLocked) PresShell::IsReflowLocked() const
{ {
*aIsReflowLocked = mIsReflowing; return mIsReflowing;
return NS_OK;
} }
void void

View File

@ -400,9 +400,7 @@ nsSVGForeignObjectFrame::NotifySVGChanged(PRUint32 aFlags)
// PresShell and prevent it from reflowing us properly in future. Besides // PresShell and prevent it from reflowing us properly in future. Besides
// that, nsSVGOuterSVGFrame::DidReflow will take care of reflowing us // that, nsSVGOuterSVGFrame::DidReflow will take care of reflowing us
// synchronously, so there's no need. // synchronously, so there's no need.
PRBool reflowing; if (!PresContext()->PresShell()->IsReflowLocked()) {
PresContext()->PresShell()->IsReflowLocked(&reflowing);
if (!reflowing) {
UpdateGraphic(); // update mRect before requesting reflow UpdateGraphic(); // update mRect before requesting reflow
RequestReflow(nsIPresShell::eResize); RequestReflow(nsIPresShell::eResize);
} }

View File

@ -370,9 +370,7 @@ void
nsTreeBodyFrame::EnsureView() nsTreeBodyFrame::EnsureView()
{ {
if (!mView) { if (!mView) {
PRBool isInReflow; if (PresContext()->PresShell()->IsReflowLocked()) {
PresContext()->PresShell()->IsReflowLocked(&isInReflow);
if (isInReflow) {
if (!mReflowCallbackPosted) { if (!mReflowCallbackPosted) {
mReflowCallbackPosted = PR_TRUE; mReflowCallbackPosted = PR_TRUE;
PresContext()->PresShell()->PostReflowCallback(this); PresContext()->PresShell()->PostReflowCallback(this);
@ -532,9 +530,7 @@ nsTreeBodyFrame::SetView(nsITreeView * aView)
NS_ENSURE_STATE(weakFrame.IsAlive()); NS_ENSURE_STATE(weakFrame.IsAlive());
mView->GetRowCount(&mRowCount); mView->GetRowCount(&mRowCount);
PRBool isInReflow; if (!PresContext()->PresShell()->IsReflowLocked()) {
PresContext()->PresShell()->IsReflowLocked(&isInReflow);
if (!isInReflow) {
// The scrollbar will need to be updated. // The scrollbar will need to be updated.
FullScrollbarsUpdate(PR_FALSE); FullScrollbarsUpdate(PR_FALSE);
} else if (!mReflowCallbackPosted) { } else if (!mReflowCallbackPosted) {