From cfd25f13ddde351ccf09a78ebcf18b57c7d35fc5 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Tue, 25 Oct 2005 22:32:13 +0000 Subject: [PATCH] Flush out content updates before messing with the frame tree. Bug 313516, r+sr=roc git-svn-id: svn://10.0.0.236/trunk@183015 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsObjectLoadingContent.cpp | 3 --- mozilla/layout/base/nsPresShell.cpp | 9 +++++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mozilla/content/base/src/nsObjectLoadingContent.cpp b/mozilla/content/base/src/nsObjectLoadingContent.cpp index efad38efdda..9018638fbd9 100644 --- a/mozilla/content/base/src/nsObjectLoadingContent.cpp +++ b/mozilla/content/base/src/nsObjectLoadingContent.cpp @@ -989,9 +989,6 @@ nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType, // If our state changed, then we already recreated frames // Otherwise, need to do that here - // Need the following line before calling RecreateFramesFor - mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE); - PRUint32 numShells = doc->GetNumberOfShells(); for (PRUint32 i = 0; i < numShells; ++i) { nsIPresShell* shell = doc->GetShellAt(i); diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 3d4c72b1394..aa6211aed22 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -3738,11 +3738,16 @@ PresShell::RecreateFramesFor(nsIContent* aContent) // Don't call RecreateFramesForContent since that is not exported and we want // to keep the number of entrypoints down. + NS_ASSERTION(mViewManager, "Should have view manager"); + mViewManager->BeginUpdateViewBatch(); + + // Have to make sure that the content notifications are flushed before we + // start messing with the frame model; otherwise we can get content doubling. + mDocument->FlushPendingNotifications(Flush_ContentAndNotify); + nsStyleChangeList changeList; changeList.AppendChange(nsnull, aContent, nsChangeHint_ReconstructFrame); - NS_ASSERTION(mViewManager, "Should have view manager"); - mViewManager->BeginUpdateViewBatch(); nsresult rv = mFrameConstructor->ProcessRestyledFrames(changeList); mViewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC); #ifdef ACCESSIBILITY