diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 4a2fbc1cb9f9..e898496a73b5 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -339,7 +339,8 @@ public: NS_IMETHOD_(PRBool) EventCaptureRegistration(PRInt32 aCapturerIncrement) = 0; - NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows=PR_TRUE) = 0; + NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows=PR_TRUE, + PRBool aUpdateViews=PR_FALSE) = 0; NS_IMETHOD GetAndIncrementContentID(PRInt32* aID) = 0; diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 9c591f898e74..9c2c9fb7a999 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -3259,7 +3259,7 @@ nsDocument::GetFileSpec(nsIFile * *aFileSpec) } NS_IMETHODIMP -nsDocument::FlushPendingNotifications(PRBool aFlushReflows) +nsDocument::FlushPendingNotifications(PRBool aFlushReflows, PRBool aUpdateViews) { if (aFlushReflows) { @@ -3268,7 +3268,7 @@ nsDocument::FlushPendingNotifications(PRBool aFlushReflows) for (i = 0; i < count; i++) { nsIPresShell* shell = NS_STATIC_CAST(nsIPresShell*, mPresShells[i]); if (shell) { - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(aUpdateViews); } } } diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index 74cb94358f70..c8774b150dec 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -454,7 +454,8 @@ public: NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet, nsIStyleRule* aStyleRule); - NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows = PR_TRUE); + NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows = PR_TRUE, + PRBool aUpdateViews = PR_FALSE); NS_IMETHOD GetAndIncrementContentID(PRInt32* aID); NS_IMETHOD GetBindingManager(nsIBindingManager** aResult); NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager); diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 1a9e5bf66c4b..9def9e994f77 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -3925,7 +3925,7 @@ void nsEventStateManager::FlushPendingEvents(nsIPresContext* aPresContext) { nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); if (nsnull != shell) { - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); nsCOMPtr viewManager; shell->GetViewManager(getter_AddRefs(viewManager)); if (viewManager) { diff --git a/content/html/document/src/nsHTMLContentSink.cpp b/content/html/document/src/nsHTMLContentSink.cpp index 69768532c406..6b0f7953676f 100644 --- a/content/html/document/src/nsHTMLContentSink.cpp +++ b/content/html/document/src/nsHTMLContentSink.cpp @@ -3984,7 +3984,7 @@ HTMLContentSink::ScrollToRef() mDocument->GetShellAt(i, getter_AddRefs(shell)); if (shell) { // Scroll to the anchor - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); // Check an empty string which might be caused by the UTF-8 conversion if (!ref.IsEmpty()) diff --git a/content/xml/document/src/nsXMLContentSink.cpp b/content/xml/document/src/nsXMLContentSink.cpp index 80ca1ea42643..43a854cedebb 100644 --- a/content/xml/document/src/nsXMLContentSink.cpp +++ b/content/xml/document/src/nsXMLContentSink.cpp @@ -276,7 +276,7 @@ nsXMLContentSink::ScrollToRef() mDocument->GetShellAt(i, getter_AddRefs(shell)); if (shell) { // Scroll to the anchor - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); // Check an empty string which might be caused by the UTF-8 conversion if (!ref.IsEmpty()) diff --git a/content/xul/document/src/nsXULDocument.cpp b/content/xul/document/src/nsXULDocument.cpp index 7c1253307ca6..a289167bbc52 100644 --- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -2013,7 +2013,7 @@ nsXULDocument::FindNext(const nsAReadableString &aSearchStr, NS_IMETHODIMP -nsXULDocument::FlushPendingNotifications(PRBool aFlushReflows) +nsXULDocument::FlushPendingNotifications(PRBool aFlushReflows, PRBool aUpdateViews) { if (aFlushReflows) { @@ -2022,7 +2022,7 @@ nsXULDocument::FlushPendingNotifications(PRBool aFlushReflows) for (i = 0; i < count; i++) { nsIPresShell* shell = NS_STATIC_CAST(nsIPresShell*, mPresShells[i]); if (shell) { - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(aUpdateViews); } } } diff --git a/content/xul/document/src/nsXULDocument.h b/content/xul/document/src/nsXULDocument.h index f02ef7f94898..a8993bca8236 100644 --- a/content/xul/document/src/nsXULDocument.h +++ b/content/xul/document/src/nsXULDocument.h @@ -298,7 +298,7 @@ public: NS_IMETHOD FindNext(const nsAReadableString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound); - NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows = PR_TRUE); + NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows = PR_TRUE, PRBool aUpdateViews = PR_FALSE); NS_IMETHOD GetAndIncrementContentID(PRInt32* aID); diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp index 8a2641401189..04dc307aba0a 100644 --- a/dom/src/base/nsGlobalWindow.cpp +++ b/dom/src/base/nsGlobalWindow.cpp @@ -1588,7 +1588,7 @@ static void EnsureReflowFlushAndPaint(nsIDocShell* aDocShell) return; // Flush pending reflows. - presShell->FlushPendingNotifications(); + presShell->FlushPendingNotifications(PR_FALSE); // Unsuppress painting. presShell->UnsuppressPainting(); diff --git a/extensions/inspector/base/src/inLayoutUtils.cpp b/extensions/inspector/base/src/inLayoutUtils.cpp index 2c3a3d002c70..805c77f0b726 100644 --- a/extensions/inspector/base/src/inLayoutUtils.cpp +++ b/extensions/inspector/base/src/inLayoutUtils.cpp @@ -220,7 +220,7 @@ inLayoutUtils::GetScreenOrigin(nsIDOMElement* aElement) if (presShell) { // Flush all pending notifications so that our frames are uptodate - presShell->FlushPendingNotifications(); + presShell->FlushPendingNotifications(PR_FALSE); nsCOMPtr presContext; presShell->GetPresContext(getter_AddRefs(presContext)); diff --git a/extensions/xmlterm/base/mozXMLTermSession.cpp b/extensions/xmlterm/base/mozXMLTermSession.cpp index e4ca76aa1341..75c571d0dd8e 100644 --- a/extensions/xmlterm/base/mozXMLTermSession.cpp +++ b/extensions/xmlterm/base/mozXMLTermSession.cpp @@ -2915,7 +2915,7 @@ NS_IMETHODIMP mozXMLTermSession::ScrollToBottomLeft(void) if (NS_FAILED(result) || !presShell) return NS_ERROR_FAILURE; - presShell->FlushPendingNotifications(); + presShell->FlushPendingNotifications(PR_FALSE); // Get DOM Window nsCOMPtr docShell; diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index ac3942e73389..788e03c8f1e3 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -8127,7 +8127,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, treeRowGroup->RegenerateRowGroupInfo(0); if (!treeRowGroup->IsBatching()) - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); return NS_OK; } @@ -8599,7 +8599,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, } if (!treeRowGroup->IsBatching()) - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); return NS_OK; } } @@ -9281,7 +9281,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, treeRowGroup->MarkDirtyChildren(state); if (!treeRowGroup->IsBatching()) - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); } return NS_OK; } diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 61b91b030d4f..864c97c95ef0 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -295,8 +295,9 @@ public: /** * Flush all pending notifications such that the presentation is * in sync with the content. + * @param aUpdateViews PR_TRUE causes the affected views to be refreshed immediately. */ - NS_IMETHOD FlushPendingNotifications() = 0; + NS_IMETHOD FlushPendingNotifications(PRBool aUpdateViews) = 0; /** * Post a request to handle a DOM event after Reflow has finished. diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 6580268d4454..bfad948bcbc5 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -866,7 +866,7 @@ public: PRBool aProcessDummyLayoutRequest = PR_TRUE); NS_IMETHOD CancelAllReflowCommands(); NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush); - NS_IMETHOD FlushPendingNotifications(); + NS_IMETHOD FlushPendingNotifications(PRBool aUpdateViews=PR_FALSE); /** * Post a request to handle a DOM event after Reflow has finished. @@ -4868,13 +4868,21 @@ PresShell::IsSafeToFlush(PRBool& aIsSafeToFlush) NS_IMETHODIMP -PresShell::FlushPendingNotifications() +PresShell::FlushPendingNotifications(PRBool aUpdateViews) { PRBool isSafeToFlush; IsSafeToFlush(isSafeToFlush); if (isSafeToFlush) { + if (aUpdateViews && mViewManager) { + mViewManager->BeginUpdateViewBatch(); + } + ProcessReflowCommands(PR_FALSE); + + if (aUpdateViews && mViewManager) { + mViewManager->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE); + } } return NS_OK; diff --git a/layout/base/public/nsIPresShell.h b/layout/base/public/nsIPresShell.h index 61b91b030d4f..864c97c95ef0 100644 --- a/layout/base/public/nsIPresShell.h +++ b/layout/base/public/nsIPresShell.h @@ -295,8 +295,9 @@ public: /** * Flush all pending notifications such that the presentation is * in sync with the content. + * @param aUpdateViews PR_TRUE causes the affected views to be refreshed immediately. */ - NS_IMETHOD FlushPendingNotifications() = 0; + NS_IMETHOD FlushPendingNotifications(PRBool aUpdateViews) = 0; /** * Post a request to handle a DOM event after Reflow has finished. diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index 06ea9cd5cf9f..7b1018a0d245 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -668,7 +668,7 @@ nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList) nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->FlushPendingNotifications(); + presShell->FlushPendingNotifications(PR_FALSE); if (widget) widget->CaptureRollupEvents((nsIRollupListener *)this, mDroppedDown, PR_TRUE); @@ -2064,7 +2064,7 @@ nsComboboxControlFrame::SelectionChanged() nsCOMPtr presShell; mPresContext->GetShell(getter_AddRefs(presShell)); - presShell->FlushPendingNotifications(); + presShell->FlushPendingNotifications(PR_FALSE); } } return rv; diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index a2782052e964..9e539fa5c04a 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -4185,7 +4185,7 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent) if (IsInDropDownMode() == PR_TRUE) { nsCOMPtr presShell; mPresContext->GetShell(getter_AddRefs(presShell)); - presShell->FlushPendingNotifications(); + presShell->FlushPendingNotifications(PR_FALSE); } REFLOW_DEBUG_MSG2(" After: %d\n", mSelectedIndex); } else { diff --git a/layout/html/base/src/nsPresShell.cpp b/layout/html/base/src/nsPresShell.cpp index 6580268d4454..bfad948bcbc5 100644 --- a/layout/html/base/src/nsPresShell.cpp +++ b/layout/html/base/src/nsPresShell.cpp @@ -866,7 +866,7 @@ public: PRBool aProcessDummyLayoutRequest = PR_TRUE); NS_IMETHOD CancelAllReflowCommands(); NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush); - NS_IMETHOD FlushPendingNotifications(); + NS_IMETHOD FlushPendingNotifications(PRBool aUpdateViews=PR_FALSE); /** * Post a request to handle a DOM event after Reflow has finished. @@ -4868,13 +4868,21 @@ PresShell::IsSafeToFlush(PRBool& aIsSafeToFlush) NS_IMETHODIMP -PresShell::FlushPendingNotifications() +PresShell::FlushPendingNotifications(PRBool aUpdateViews) { PRBool isSafeToFlush; IsSafeToFlush(isSafeToFlush); if (isSafeToFlush) { + if (aUpdateViews && mViewManager) { + mViewManager->BeginUpdateViewBatch(); + } + ProcessReflowCommands(PR_FALSE); + + if (aUpdateViews && mViewManager) { + mViewManager->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE); + } } return NS_OK; diff --git a/layout/html/forms/src/nsComboboxControlFrame.cpp b/layout/html/forms/src/nsComboboxControlFrame.cpp index 06ea9cd5cf9f..7b1018a0d245 100644 --- a/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -668,7 +668,7 @@ nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList) nsCOMPtr presShell; aPresContext->GetShell(getter_AddRefs(presShell)); - presShell->FlushPendingNotifications(); + presShell->FlushPendingNotifications(PR_FALSE); if (widget) widget->CaptureRollupEvents((nsIRollupListener *)this, mDroppedDown, PR_TRUE); @@ -2064,7 +2064,7 @@ nsComboboxControlFrame::SelectionChanged() nsCOMPtr presShell; mPresContext->GetShell(getter_AddRefs(presShell)); - presShell->FlushPendingNotifications(); + presShell->FlushPendingNotifications(PR_FALSE); } } return rv; diff --git a/layout/html/forms/src/nsGfxListControlFrame.cpp b/layout/html/forms/src/nsGfxListControlFrame.cpp index a6bdfab29730..deafd2a06d17 100644 --- a/layout/html/forms/src/nsGfxListControlFrame.cpp +++ b/layout/html/forms/src/nsGfxListControlFrame.cpp @@ -3869,7 +3869,7 @@ nsGfxListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent) if (IsInDropDownMode() == PR_TRUE && mComboboxFrame) { nsCOMPtr presShell; mPresContext->GetShell(getter_AddRefs(presShell)); - presShell->FlushPendingNotifications(); + presShell->FlushPendingNotifications(PR_FALSE); } REFLOW_DEBUG_MSG2(" After: %d\n", mSelectedIndex); } else { diff --git a/layout/html/forms/src/nsListControlFrame.cpp b/layout/html/forms/src/nsListControlFrame.cpp index a2782052e964..9e539fa5c04a 100644 --- a/layout/html/forms/src/nsListControlFrame.cpp +++ b/layout/html/forms/src/nsListControlFrame.cpp @@ -4185,7 +4185,7 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent) if (IsInDropDownMode() == PR_TRUE) { nsCOMPtr presShell; mPresContext->GetShell(getter_AddRefs(presShell)); - presShell->FlushPendingNotifications(); + presShell->FlushPendingNotifications(PR_FALSE); } REFLOW_DEBUG_MSG2(" After: %d\n", mSelectedIndex); } else { diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index ac3942e73389..788e03c8f1e3 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -8127,7 +8127,7 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, treeRowGroup->RegenerateRowGroupInfo(0); if (!treeRowGroup->IsBatching()) - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); return NS_OK; } @@ -8599,7 +8599,7 @@ nsCSSFrameConstructor::ContentInserted(nsIPresContext* aPresContext, } if (!treeRowGroup->IsBatching()) - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); return NS_OK; } } @@ -9281,7 +9281,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, treeRowGroup->MarkDirtyChildren(state); if (!treeRowGroup->IsBatching()) - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); } return NS_OK; } diff --git a/layout/svg/base/src/nsPolygonFrame.cpp b/layout/svg/base/src/nsPolygonFrame.cpp index 2460e5b21970..24cf04411efc 100644 --- a/layout/svg/base/src/nsPolygonFrame.cpp +++ b/layout/svg/base/src/nsPolygonFrame.cpp @@ -305,7 +305,7 @@ nsPolygonFrame::AttributeChanged(nsIPresContext* aPresContext, if (NS_SUCCEEDED(rv)) { shell->AppendReflowCommand(reflowCmd); NS_RELEASE(reflowCmd); - rv = shell->FlushPendingNotifications(); + rv = shell->FlushPendingNotifications(PR_FALSE); } } else if (aAttribute == nsSVGAtoms::x) { } else if (aAttribute == nsSVGAtoms::y) { diff --git a/layout/xul/base/src/nsBoxObject.cpp b/layout/xul/base/src/nsBoxObject.cpp index 543c4ac78868..7600f48200f7 100644 --- a/layout/xul/base/src/nsBoxObject.cpp +++ b/layout/xul/base/src/nsBoxObject.cpp @@ -156,7 +156,7 @@ nsBoxObject::GetOffsetRect(nsRect& aRect) if(presShell) { // Flush all pending notifications so that our frames are uptodate - presShell->FlushPendingNotifications(); + presShell->FlushPendingNotifications(PR_FALSE); // Get the Frame for our content nsIFrame* frame = nsnull; @@ -267,7 +267,7 @@ nsBoxObject::GetScreenRect(nsRect& aRect) if (presShell) { // Flush all pending notifications so that our frames are uptodate - presShell->FlushPendingNotifications(); + presShell->FlushPendingNotifications(PR_FALSE); nsCOMPtr presContext; presShell->GetPresContext(getter_AddRefs(presContext)); diff --git a/layout/xul/base/src/nsMenuFrame.cpp b/layout/xul/base/src/nsMenuFrame.cpp index c6cf411fbd5b..2667812f1ad1 100644 --- a/layout/xul/base/src/nsMenuFrame.cpp +++ b/layout/xul/base/src/nsMenuFrame.cpp @@ -755,7 +755,7 @@ nsMenuFrame::OpenMenuInternal(PRBool aActivateFlag) nsCOMPtr shell; mPresContext->GetShell(getter_AddRefs(shell)); - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); } nsRect curRect; @@ -776,7 +776,7 @@ nsMenuFrame::OpenMenuInternal(PRBool aActivateFlag) menuPopup->MarkDirty(state); nsCOMPtr shell; mPresContext->GetShell(getter_AddRefs(shell)); - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); } ActivateMenu(PR_TRUE); diff --git a/layout/xul/base/src/nsSplitterFrame.cpp b/layout/xul/base/src/nsSplitterFrame.cpp index 1b36815cb429..fd270500210d 100644 --- a/layout/xul/base/src/nsSplitterFrame.cpp +++ b/layout/xul/base/src/nsSplitterFrame.cpp @@ -1166,7 +1166,7 @@ if (realTimeDrag) { } viewManager->DisableRefresh(); - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); viewManager->EnableRefresh(NS_VMREFRESH_NO_SYNC); viewManager->UpdateView(view, damageRect, NS_VMREFRESH_IMMEDIATE); diff --git a/layout/xul/base/src/nsXULTreeGroupFrame.cpp b/layout/xul/base/src/nsXULTreeGroupFrame.cpp index da57d8a92949..0d5fb3c20f7a 100644 --- a/layout/xul/base/src/nsXULTreeGroupFrame.cpp +++ b/layout/xul/base/src/nsXULTreeGroupFrame.cpp @@ -499,7 +499,7 @@ void nsXULTreeGroupFrame::OnContentRemoved(nsIPresContext* aPresContext, MarkDirtyChildren(state); nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); } PRBool nsXULTreeGroupFrame::ContinueReflow(nscoord height) diff --git a/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp b/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp index 49ef2aca6dfd..6d5345f78706 100644 --- a/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp +++ b/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp @@ -642,7 +642,7 @@ nsXULTreeOuterGroupFrame::PositionChanged(PRInt32 aOldIndex, PRInt32& aNewIndex) nsCOMPtr shell; mPresContext->GetShell(getter_AddRefs(shell)); - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); smoother->mDelta = newTwipIndex > oldTwipIndex ? rowDelta : -rowDelta; @@ -707,7 +707,7 @@ nsXULTreeOuterGroupFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta, PR nsCOMPtr shell; mPresContext->GetShell(getter_AddRefs(shell)); - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); PRInt32 visibleRows = 0; if (mRowHeight) @@ -775,7 +775,7 @@ nsXULTreeOuterGroupFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta, PR nsBoxLayoutState state(mPresContext); mScrolling = PR_TRUE; MarkDirtyChildren(state); - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); mScrolling = PR_FALSE; VerticalScroll(mYPosition); diff --git a/webshell/tests/viewer/nsWebCrawler.cpp b/webshell/tests/viewer/nsWebCrawler.cpp index 9af46fedc382..e845e05fb217 100644 --- a/webshell/tests/viewer/nsWebCrawler.cpp +++ b/webshell/tests/viewer/nsWebCrawler.cpp @@ -414,7 +414,7 @@ nsWebCrawler::OnStateChange(nsIWebProgress* aWebProgress, nsCOMPtr shell = dont_AddRef(GetPresShell()); if (shell) { // Force the presentation shell to flush any pending reflows - shell->FlushPendingNotifications(); + shell->FlushPendingNotifications(PR_FALSE); // Force the view manager to update itself nsCOMPtr vm; diff --git a/xpfe/appshell/src/nsContentTreeOwner.cpp b/xpfe/appshell/src/nsContentTreeOwner.cpp index 11033e469e8c..2db3de9e23fc 100644 --- a/xpfe/appshell/src/nsContentTreeOwner.cpp +++ b/xpfe/appshell/src/nsContentTreeOwner.cpp @@ -40,6 +40,10 @@ #include "nsIXULBrowserWindow.h" #include "nsPIDOMWindow.h" +// Needed for nsIDocument::FlushPendingNotifications(...) +#include "nsIDOMDocument.h" +#include "nsIDocument.h" + // CIDs static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID); @@ -338,7 +342,24 @@ NS_IMETHODIMP nsContentTreeOwner::SetStatus(PRUint32 aStatusType, const PRUnicha } } - return NS_OK; + // + // Force pending notifications to be processed immediately... This + // causes the status message to be displayed synchronously. + // + // XXX: This is nasty because we have to drill down to the nsIDocument to + // force the flushing... + // + nsCOMPtr domDoc; + nsCOMPtr doc; + + domWindow->GetDocument(getter_AddRefs(domDoc)); + doc = do_QueryInterface(domDoc); + + if (doc) { + doc->FlushPendingNotifications(PR_TRUE, PR_TRUE); + } + + return NS_OK; } NS_IMETHODIMP nsContentTreeOwner::SetWebBrowser(nsIWebBrowser* aWebBrowser)