зеркало из https://github.com/mozilla/gecko-dev.git
Change FlushPendingNotifications to have more granularity and update callers to
only flush the things they really need flushed. Bug 144072, r+sr=jst
This commit is contained in:
Родитель
37985e9e8e
Коммит
a7bff6ad5b
|
@ -0,0 +1,61 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is mozilla.org code.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Boris Zbarsky.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||||
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
#ifndef mozFlushType_h___
|
||||||
|
#define mozFlushType_h___
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the enum used by nsIDocument::FlushPendingNotifications to
|
||||||
|
* decide what to flush.
|
||||||
|
*/
|
||||||
|
enum mozFlushType {
|
||||||
|
Flush_Content = 0x1, /* flush the content model construction */
|
||||||
|
Flush_SinkNotifications = 0x2, /* flush the frame model construction */
|
||||||
|
Flush_StyleReresolves = 0x4, /* flush style reresolution */
|
||||||
|
Flush_OnlyReflow = 0x8, /* flush reflows */
|
||||||
|
Flush_OnlyPaint = 0x10, /* flush painting */
|
||||||
|
Flush_Frames = (Flush_Content | Flush_SinkNotifications),
|
||||||
|
Flush_ContentAndNotify = (Flush_Content | Flush_SinkNotifications),
|
||||||
|
Flush_Style = (Flush_Content | Flush_SinkNotifications |
|
||||||
|
Flush_StyleReresolves),
|
||||||
|
Flush_Layout = (Flush_Content | Flush_SinkNotifications |
|
||||||
|
Flush_StyleReresolves | Flush_OnlyReflow),
|
||||||
|
Flush_Display = (Flush_Content | Flush_SinkNotifications |
|
||||||
|
Flush_StyleReresolves | Flush_OnlyReflow |
|
||||||
|
Flush_OnlyPaint)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* mozFlushType_h___ */
|
|
@ -52,6 +52,7 @@
|
||||||
#include "nsILoadGroup.h"
|
#include "nsILoadGroup.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
|
#include "mozFlushType.h"
|
||||||
|
|
||||||
class nsIAtom;
|
class nsIAtom;
|
||||||
class nsIContent;
|
class nsIContent;
|
||||||
|
@ -510,8 +511,11 @@ public:
|
||||||
PRUint32 aFlags,
|
PRUint32 aFlags,
|
||||||
nsEventStatus* aEventStatus) = 0;
|
nsEventStatus* aEventStatus) = 0;
|
||||||
|
|
||||||
virtual void FlushPendingNotifications(PRBool aFlushReflows=PR_TRUE,
|
/**
|
||||||
PRBool aUpdateViews=PR_FALSE) = 0;
|
* Flush notifications for this document and its parent documents
|
||||||
|
* (since those may affect the layout of this one).
|
||||||
|
*/
|
||||||
|
virtual void FlushPendingNotifications(mozFlushType aType) = 0;
|
||||||
|
|
||||||
PRInt32 GetAndIncrementContentID()
|
PRInt32 GetAndIncrementContentID()
|
||||||
{
|
{
|
||||||
|
|
|
@ -105,7 +105,7 @@ public:
|
||||||
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode)
|
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode)
|
||||||
{ return NS_OK; }
|
{ return NS_OK; }
|
||||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
|
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
|
||||||
NS_IMETHOD FlushPendingNotifications() { return NS_OK; }
|
virtual void FlushContent(PRBool aNotify) { }
|
||||||
NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
|
NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
|
||||||
NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
|
NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
|
||||||
|
|
||||||
|
|
|
@ -429,8 +429,8 @@ nsContentList::Item(PRUint32 aIndex, PRBool aDoFlush)
|
||||||
CheckDocumentExistence();
|
CheckDocumentExistence();
|
||||||
|
|
||||||
if (mDocument && aDoFlush) {
|
if (mDocument && aDoFlush) {
|
||||||
// Flush pending content changes Bug 4891
|
// Flush pending content changes Bug 4891.
|
||||||
mDocument->FlushPendingNotifications(PR_FALSE);
|
mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mState != LIST_UP_TO_DATE)
|
if (mState != LIST_UP_TO_DATE)
|
||||||
|
@ -963,7 +963,8 @@ void
|
||||||
nsContentList::BringSelfUpToDate(PRBool aDoFlush)
|
nsContentList::BringSelfUpToDate(PRBool aDoFlush)
|
||||||
{
|
{
|
||||||
if (mDocument && aDoFlush) {
|
if (mDocument && aDoFlush) {
|
||||||
mDocument->FlushPendingNotifications(PR_FALSE); // Flush pending content changes Bug 4891
|
// Flush pending content changes Bug 4891.
|
||||||
|
mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mState != LIST_UP_TO_DATE)
|
if (mState != LIST_UP_TO_DATE)
|
||||||
|
|
|
@ -863,7 +863,7 @@ nsContentSink::ScrollToRef(PRBool aReallyScroll)
|
||||||
if (shell) {
|
if (shell) {
|
||||||
// Scroll to the anchor
|
// Scroll to the anchor
|
||||||
if (aReallyScroll) {
|
if (aReallyScroll) {
|
||||||
shell->FlushPendingNotifications(PR_FALSE);
|
shell->FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check an empty string which might be caused by the UTF-8 conversion
|
// Check an empty string which might be caused by the UTF-8 conversion
|
||||||
|
|
|
@ -3906,10 +3906,11 @@ nsDocument::CreateEventGroup(nsIDOMEventGroup **aInstancePtrResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsDocument::FlushPendingNotifications(PRBool aFlushReflows,
|
nsDocument::FlushPendingNotifications(mozFlushType aType)
|
||||||
PRBool aUpdateViews)
|
|
||||||
{
|
{
|
||||||
if (!aFlushReflows || !mScriptGlobalObject) {
|
if (aType == (aType & (Flush_Content | Flush_SinkNotifications)) ||
|
||||||
|
!mScriptGlobalObject) {
|
||||||
|
// Nothing to do here
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3935,8 +3936,7 @@ nsDocument::FlushPendingNotifications(PRBool aFlushReflows,
|
||||||
if (doc) {
|
if (doc) {
|
||||||
// If we have a parent we must flush the parent too to ensure
|
// If we have a parent we must flush the parent too to ensure
|
||||||
// that our container is reflown if its size was changed.
|
// that our container is reflown if its size was changed.
|
||||||
|
doc->FlushPendingNotifications(aType);
|
||||||
doc->FlushPendingNotifications(aFlushReflows, aUpdateViews);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3948,7 +3948,7 @@ nsDocument::FlushPendingNotifications(PRBool aFlushReflows,
|
||||||
NS_STATIC_CAST(nsIPresShell*, mPresShells[i]);
|
NS_STATIC_CAST(nsIPresShell*, mPresShells[i]);
|
||||||
|
|
||||||
if (shell) {
|
if (shell) {
|
||||||
shell->FlushPendingNotifications(aUpdateViews);
|
shell->FlushPendingNotifications(aType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -397,8 +397,7 @@ public:
|
||||||
virtual void StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
|
virtual void StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
|
||||||
nsIStyleRule* aStyleRule);
|
nsIStyleRule* aStyleRule);
|
||||||
|
|
||||||
virtual void FlushPendingNotifications(PRBool aFlushReflows = PR_TRUE,
|
virtual void FlushPendingNotifications(mozFlushType aType);
|
||||||
PRBool aUpdateViews = PR_FALSE);
|
|
||||||
virtual void AddReference(void *aKey, nsISupports *aReference);
|
virtual void AddReference(void *aKey, nsISupports *aReference);
|
||||||
virtual already_AddRefed<nsISupports> RemoveReference(void *aKey);
|
virtual already_AddRefed<nsISupports> RemoveReference(void *aKey);
|
||||||
virtual nsIScriptEventManager* GetScriptEventManager();
|
virtual nsIScriptEventManager* GetScriptEventManager();
|
||||||
|
|
|
@ -656,7 +656,7 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow)
|
||||||
// Note that we are flushing before we add mPresShell as an observer
|
// Note that we are flushing before we add mPresShell as an observer
|
||||||
// to avoid bogus notifications.
|
// to avoid bogus notifications.
|
||||||
|
|
||||||
mDocument->FlushPendingNotifications(PR_FALSE);
|
mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
mPresShell->BeginObservingDocument();
|
mPresShell->BeginObservingDocument();
|
||||||
|
@ -935,9 +935,7 @@ DocumentViewerImpl::LoadComplete(nsresult aStatus)
|
||||||
static PRBool forcePaint
|
static PRBool forcePaint
|
||||||
= PR_GetEnv("MOZ_FORCE_PAINT_AFTER_ONLOAD") != nsnull;
|
= PR_GetEnv("MOZ_FORCE_PAINT_AFTER_ONLOAD") != nsnull;
|
||||||
if (forcePaint) {
|
if (forcePaint) {
|
||||||
if (mPresShell) {
|
mDocument->FlushPendingNotifications(Flush_Display);
|
||||||
mPresShell->FlushPendingNotifications(PR_TRUE);
|
|
||||||
}
|
|
||||||
nsIURI *uri = mDocument->GetDocumentURI();
|
nsIURI *uri = mDocument->GetDocumentURI();
|
||||||
nsCAutoString spec;
|
nsCAutoString spec;
|
||||||
if (uri) {
|
if (uri) {
|
||||||
|
|
|
@ -101,7 +101,7 @@ public:
|
||||||
NS_IMETHOD AddComment(const nsIParserNode& aNode) { return NS_OK; }
|
NS_IMETHOD AddComment(const nsIParserNode& aNode) { return NS_OK; }
|
||||||
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode) { return NS_OK; }
|
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode) { return NS_OK; }
|
||||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode) { return NS_OK; }
|
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode) { return NS_OK; }
|
||||||
NS_IMETHOD FlushPendingNotifications() { return NS_OK; }
|
virtual void FlushContent(PRBool aNotify) { }
|
||||||
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
|
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
|
||||||
NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
|
NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
|
||||||
|
|
||||||
|
|
|
@ -503,6 +503,7 @@ nsEventStateManager::PreHandleEvent(nsIPresContext* aPresContext,
|
||||||
GenerateMouseEnterExit(aPresContext, (nsGUIEvent*)aEvent);
|
GenerateMouseEnterExit(aPresContext, (nsGUIEvent*)aEvent);
|
||||||
// Flush reflows and invalidates to eliminate flicker when both a reflow
|
// Flush reflows and invalidates to eliminate flicker when both a reflow
|
||||||
// and visual change occur in an event callback. See bug #36849
|
// and visual change occur in an event callback. See bug #36849
|
||||||
|
// XXXbz eeeew. Why not fix viewmanager to flush reflows before painting??
|
||||||
FlushPendingEvents(aPresContext);
|
FlushPendingEvents(aPresContext);
|
||||||
break;
|
break;
|
||||||
case NS_MOUSE_EXIT:
|
case NS_MOUSE_EXIT:
|
||||||
|
@ -4641,7 +4642,8 @@ nsEventStateManager::FlushPendingEvents(nsIPresContext* aPresContext)
|
||||||
NS_PRECONDITION(nsnull != aPresContext, "nsnull ptr");
|
NS_PRECONDITION(nsnull != aPresContext, "nsnull ptr");
|
||||||
nsIPresShell *shell = aPresContext->GetPresShell();
|
nsIPresShell *shell = aPresContext->GetPresShell();
|
||||||
if (shell) {
|
if (shell) {
|
||||||
shell->FlushPendingNotifications(PR_FALSE);
|
// This is not flushing _Display because of the mess that is bug 36849
|
||||||
|
shell->FlushPendingNotifications(Flush_Layout);
|
||||||
nsIViewManager* viewManager = shell->GetViewManager();
|
nsIViewManager* viewManager = shell->GetViewManager();
|
||||||
if (viewManager) {
|
if (viewManager) {
|
||||||
viewManager->FlushPendingInvalidates();
|
viewManager->FlushPendingInvalidates();
|
||||||
|
|
|
@ -582,7 +582,7 @@ nsGenericHTMLElement::GetOffsetRect(nsRect& aRect, nsIContent** aOffsetParent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush all pending notifications so that our frames are uptodate
|
// Flush all pending notifications so that our frames are uptodate
|
||||||
mDocument->FlushPendingNotifications();
|
mDocument->FlushPendingNotifications(Flush_Layout);
|
||||||
|
|
||||||
// Get the Frame for our content
|
// Get the Frame for our content
|
||||||
nsIFrame* frame = nsnull;
|
nsIFrame* frame = nsnull;
|
||||||
|
@ -933,7 +933,7 @@ nsGenericHTMLElement::GetScrollInfo(nsIScrollableView **aScrollableView,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mDocument->FlushPendingNotifications(PR_TRUE, PR_FALSE);
|
mDocument->FlushPendingNotifications(Flush_Layout);
|
||||||
|
|
||||||
// Get the presentation shell
|
// Get the presentation shell
|
||||||
nsIPresShell *presShell = mDocument->GetShellAt(0);
|
nsIPresShell *presShell = mDocument->GetShellAt(0);
|
||||||
|
@ -1239,7 +1239,7 @@ nsGenericHTMLElement::ScrollIntoView(PRBool aTop)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now flush to make sure things are up to date
|
// Now flush to make sure things are up to date
|
||||||
presShell->FlushPendingNotifications(PR_FALSE);
|
mDocument->FlushPendingNotifications(Flush_Layout);
|
||||||
|
|
||||||
// Get the primary frame for this element
|
// Get the primary frame for this element
|
||||||
nsIFrame *frame = nsnull;
|
nsIFrame *frame = nsnull;
|
||||||
|
@ -2176,7 +2176,7 @@ nsGenericHTMLElement::GetPrimaryFrameFor(nsIContent* aContent,
|
||||||
if (aFlushContent) {
|
if (aFlushContent) {
|
||||||
// Cause a flush of content, so we get up-to-date frame
|
// Cause a flush of content, so we get up-to-date frame
|
||||||
// information
|
// information
|
||||||
aDocument->FlushPendingNotifications(PR_FALSE);
|
aDocument->FlushPendingNotifications(Flush_Frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get presentation shell 0
|
// Get presentation shell 0
|
||||||
|
|
|
@ -221,7 +221,7 @@ nsHTMLAnchorElement::SetFocus(nsIPresContext* aPresContext)
|
||||||
|
|
||||||
// Make sure the presentation is up-to-date
|
// Make sure the presentation is up-to-date
|
||||||
if (mDocument) {
|
if (mDocument) {
|
||||||
mDocument->FlushPendingNotifications();
|
mDocument->FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIPresShell *presShell = aPresContext->GetPresShell();
|
nsIPresShell *presShell = aPresContext->GetPresShell();
|
||||||
|
|
|
@ -202,7 +202,7 @@ nsHTMLAreaElement::SetFocus(nsIPresContext* aPresContext)
|
||||||
|
|
||||||
// Make sure the presentation is up-to-date
|
// Make sure the presentation is up-to-date
|
||||||
if (mDocument) {
|
if (mDocument) {
|
||||||
mDocument->FlushPendingNotifications();
|
mDocument->FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIPresShell *presShell = aPresContext->GetPresShell();
|
nsIPresShell *presShell = aPresContext->GetPresShell();
|
||||||
|
|
|
@ -373,19 +373,11 @@ nsHTMLBodyElement::GetBgColor(nsAString& aBgColor)
|
||||||
// If we don't have an attribute, find the actual color used for
|
// If we don't have an attribute, find the actual color used for
|
||||||
// (generally from the user agent style sheet) for compatibility
|
// (generally from the user agent style sheet) for compatibility
|
||||||
if (rv == NS_CONTENT_ATTR_NOT_THERE) {
|
if (rv == NS_CONTENT_ATTR_NOT_THERE) {
|
||||||
// XXX This should just use nsGenericHTMLElement::GetPrimaryFrame()
|
|
||||||
if (mDocument) {
|
if (mDocument) {
|
||||||
// Make sure the presentation is up-to-date
|
// Make sure the style is up-to-date, since we need it
|
||||||
mDocument->FlushPendingNotifications();
|
mDocument->FlushPendingNotifications(Flush_Style);
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIPresContext> context;
|
nsIFrame* frame = GetPrimaryFrameFor(this, mDocument, PR_FALSE);
|
||||||
GetPresContext(this, getter_AddRefs(context));
|
|
||||||
|
|
||||||
if (context) {
|
|
||||||
nsIFrame* frame;
|
|
||||||
rv = context->PresShell()->GetPrimaryFrameFor(this, &frame);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
if (frame) {
|
if (frame) {
|
||||||
bgcolor = frame->GetStyleBackground()->mBackgroundColor;
|
bgcolor = frame->GetStyleBackground()->mBackgroundColor;
|
||||||
|
|
|
@ -765,7 +765,7 @@ nsHTMLFormElement::DoSubmitOrReset(nsIPresContext* aPresContext,
|
||||||
|
|
||||||
// Make sure the presentation is up-to-date
|
// Make sure the presentation is up-to-date
|
||||||
if (mDocument) {
|
if (mDocument) {
|
||||||
mDocument->FlushPendingNotifications();
|
mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
// JBK Don't get form frames anymore - bug 34297
|
// JBK Don't get form frames anymore - bug 34297
|
||||||
|
|
|
@ -285,8 +285,8 @@ nsHTMLImageElement::GetXY()
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush all pending notifications so that our frames are uptodate
|
// Flush all pending notifications so that our frames are laid out correctly
|
||||||
mDocument->FlushPendingNotifications();
|
mDocument->FlushPendingNotifications(Flush_Layout);
|
||||||
|
|
||||||
// Get the Frame for this image
|
// Get the Frame for this image
|
||||||
nsIFrame* frame = nsnull;
|
nsIFrame* frame = nsnull;
|
||||||
|
@ -339,7 +339,7 @@ nsHTMLImageElement::GetWidthHeight()
|
||||||
// Flush all pending notifications so that our frames are up to date.
|
// Flush all pending notifications so that our frames are up to date.
|
||||||
// If we're not in a document, we don't have a frame anyway, so we
|
// If we're not in a document, we don't have a frame anyway, so we
|
||||||
// don't care.
|
// don't care.
|
||||||
mDocument->FlushPendingNotifications();
|
mDocument->FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIImageFrame* imageFrame;
|
nsIImageFrame* imageFrame;
|
||||||
|
|
|
@ -230,7 +230,7 @@ public:
|
||||||
NS_IMETHOD WillInterrupt(void);
|
NS_IMETHOD WillInterrupt(void);
|
||||||
NS_IMETHOD WillResume(void);
|
NS_IMETHOD WillResume(void);
|
||||||
NS_IMETHOD SetParser(nsIParser* aParser);
|
NS_IMETHOD SetParser(nsIParser* aParser);
|
||||||
NS_IMETHOD FlushPendingNotifications();
|
NS_IMETHOD_(void) FlushContent(PRBool aNotify);
|
||||||
NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
|
NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
|
||||||
|
|
||||||
// nsIHTMLContentSink
|
// nsIHTMLContentSink
|
||||||
|
@ -727,7 +727,7 @@ public:
|
||||||
return FlushText(aDidFlush, PR_TRUE);
|
return FlushText(aDidFlush, PR_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult FlushTags(PRBool aNotify = PR_TRUE);
|
nsresult FlushTags(PRBool aNotify);
|
||||||
|
|
||||||
PRBool IsCurrentContainer(nsHTMLTag mType);
|
PRBool IsCurrentContainer(nsHTMLTag mType);
|
||||||
PRBool IsAncestorContainer(nsHTMLTag mType);
|
PRBool IsAncestorContainer(nsHTMLTag mType);
|
||||||
|
@ -4419,22 +4419,14 @@ HTMLContentSink::ProcessSTYLETag(const nsIParserNode& aNode)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
void
|
||||||
HTMLContentSink::FlushPendingNotifications()
|
HTMLContentSink::FlushContent(PRBool aNotify)
|
||||||
{
|
{
|
||||||
nsresult result = NS_OK;
|
|
||||||
// Only flush tags if we're not doing the notification ourselves
|
// Only flush tags if we're not doing the notification ourselves
|
||||||
// (since we aren't reentrant) and if we're in a script (since we
|
// (since we aren't reentrant)
|
||||||
// only care to flush if this is done via script).
|
|
||||||
//
|
|
||||||
// Bug 4891: Also flush outside of <script> tags - if script is
|
|
||||||
// executing after the page has finished loading, and a
|
|
||||||
// document.write occurs, we might need this flush.
|
|
||||||
if (mCurrentContext && !mInNotification) {
|
if (mCurrentContext && !mInNotification) {
|
||||||
result = mCurrentContext->FlushTags();
|
mCurrentContext->FlushTags(aNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -1299,38 +1299,35 @@ nsHTMLDocument::AttributeChanged(nsIContent* aContent, PRInt32 aNameSpaceID,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsHTMLDocument::FlushPendingNotifications(PRBool aFlushReflows,
|
nsHTMLDocument::FlushPendingNotifications(mozFlushType aType)
|
||||||
PRBool aUpdateViews)
|
|
||||||
{
|
{
|
||||||
// Determine if it is safe to flush the sink
|
if (aType & Flush_Content) {
|
||||||
// by determining if it safe to flush all the presshells.
|
// Determine if it is safe to flush the sink
|
||||||
PRBool isSafeToFlush = PR_TRUE;
|
// by determining if it safe to flush all the presshells.
|
||||||
if (aFlushReflows) {
|
PRBool isSafeToFlush = PR_TRUE;
|
||||||
PRInt32 i = 0, n = mPresShells.Count();
|
if (aType & Flush_SinkNotifications) {
|
||||||
while ((i < n) && (isSafeToFlush)) {
|
PRInt32 i = 0, n = mPresShells.Count();
|
||||||
nsCOMPtr<nsIPresShell> shell =
|
while ((i < n) && (isSafeToFlush)) {
|
||||||
NS_STATIC_CAST(nsIPresShell*, mPresShells[i]);
|
nsCOMPtr<nsIPresShell> shell =
|
||||||
|
NS_STATIC_CAST(nsIPresShell*, mPresShells[i]);
|
||||||
|
|
||||||
if (shell) {
|
if (shell) {
|
||||||
shell->IsSafeToFlush(isSafeToFlush);
|
shell->IsSafeToFlush(isSafeToFlush);
|
||||||
|
}
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSafeToFlush && mParser) {
|
||||||
|
nsCOMPtr<nsIContentSink> sink = mParser->GetContentSink();
|
||||||
|
if (sink) {
|
||||||
|
PRBool notify = ((aType & Flush_SinkNotifications) != 0);
|
||||||
|
sink->FlushContent(notify);
|
||||||
}
|
}
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSafeToFlush && mParser) {
|
nsDocument::FlushPendingNotifications(aType);
|
||||||
nsCOMPtr<nsIContentSink> sink;
|
|
||||||
|
|
||||||
// XXX Ack! Parser doesn't addref sink before passing it back
|
|
||||||
sink = mParser->GetContentSink();
|
|
||||||
if (sink) {
|
|
||||||
nsresult rv = sink->FlushPendingNotifications();
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nsDocument::FlushPendingNotifications(aFlushReflows, aUpdateViews);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
|
@ -2210,7 +2207,7 @@ nsHTMLDocument::Close()
|
||||||
// handler of the frameset fires before the frames get reflowed
|
// handler of the frameset fires before the frames get reflowed
|
||||||
// and loaded. That is the long explanation for why we need this
|
// and loaded. That is the long explanation for why we need this
|
||||||
// one line of code here!
|
// one line of code here!
|
||||||
FlushPendingNotifications();
|
FlushPendingNotifications(Flush_Layout);
|
||||||
|
|
||||||
// Remove the wyciwyg channel request from the document load group
|
// Remove the wyciwyg channel request from the document load group
|
||||||
// that we added in OpenCommon(). If all other requests between
|
// that we added in OpenCommon(). If all other requests between
|
||||||
|
@ -2543,7 +2540,7 @@ nsHTMLDocument::GetPixelDimensions(nsIPresShell* aShell,
|
||||||
{
|
{
|
||||||
*aWidth = *aHeight = 0;
|
*aWidth = *aHeight = 0;
|
||||||
|
|
||||||
FlushPendingNotifications();
|
FlushPendingNotifications(Flush_Layout);
|
||||||
|
|
||||||
// Find the <body> element: this is what we'll want to use for the
|
// Find the <body> element: this is what we'll want to use for the
|
||||||
// document's width and height values.
|
// document's width and height values.
|
||||||
|
@ -3061,6 +3058,10 @@ nsHTMLDocument::UpdateNameTableEntry(const nsAString& aName,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: this indexof is absolutely needed, since we don't flush
|
||||||
|
// content notifications when we do document.foo resolution. So
|
||||||
|
// aContent may be in our list already and just now getting notified
|
||||||
|
// for!
|
||||||
if (list->IndexOf(aContent, PR_FALSE) < 0) {
|
if (list->IndexOf(aContent, PR_FALSE) < 0) {
|
||||||
list->AppendElement(aContent);
|
list->AppendElement(aContent);
|
||||||
}
|
}
|
||||||
|
@ -3304,7 +3305,7 @@ nsHTMLDocument::ResolveName(const nsAString& aName,
|
||||||
// table changes when we flush.
|
// table changes when we flush.
|
||||||
PRUint32 generation = mIdAndNameHashTable.generation;
|
PRUint32 generation = mIdAndNameHashTable.generation;
|
||||||
|
|
||||||
FlushPendingNotifications(PR_FALSE);
|
FlushPendingNotifications(Flush_Content);
|
||||||
|
|
||||||
if (generation != mIdAndNameHashTable.generation) {
|
if (generation != mIdAndNameHashTable.generation) {
|
||||||
// Table changed, so the entry pointer is no longer valid; look up the
|
// Table changed, so the entry pointer is no longer valid; look up the
|
||||||
|
|
|
@ -136,8 +136,7 @@ public:
|
||||||
PRInt32 aNameSpaceID,
|
PRInt32 aNameSpaceID,
|
||||||
nsIAtom* aAttribute);
|
nsIAtom* aAttribute);
|
||||||
|
|
||||||
virtual void FlushPendingNotifications(PRBool aFlushReflows = PR_TRUE,
|
virtual void FlushPendingNotifications(mozFlushType aType);
|
||||||
PRBool aUpdateViews = PR_FALSE);
|
|
||||||
|
|
||||||
virtual PRBool IsCaseSensitive();
|
virtual PRBool IsCaseSensitive();
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
NS_IMETHOD WillInterrupt(void);
|
NS_IMETHOD WillInterrupt(void);
|
||||||
NS_IMETHOD WillResume(void);
|
NS_IMETHOD WillResume(void);
|
||||||
NS_IMETHOD SetParser(nsIParser* aParser);
|
NS_IMETHOD SetParser(nsIParser* aParser);
|
||||||
NS_IMETHOD FlushPendingNotifications() { return NS_OK; }
|
virtual void FlushContent(PRBool aNotify) { }
|
||||||
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
|
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
|
||||||
|
|
||||||
// nsIHTMLContentSink
|
// nsIHTMLContentSink
|
||||||
|
|
|
@ -106,6 +106,8 @@ public:
|
||||||
* Called to get a better count of forms than document.forms can provide
|
* Called to get a better count of forms than document.forms can provide
|
||||||
* without calling FlushPendingNotifications (bug 138892).
|
* without calling FlushPendingNotifications (bug 138892).
|
||||||
*/
|
*/
|
||||||
|
// XXXbz is this still needed now that we can flush just content,
|
||||||
|
// not the rest?
|
||||||
virtual PRInt32 GetNumFormsSynchronous() = 0;
|
virtual PRInt32 GetNumFormsSynchronous() = 0;
|
||||||
|
|
||||||
virtual PRBool IsWriting() = 0;
|
virtual PRBool IsWriting() = 0;
|
||||||
|
|
|
@ -271,6 +271,11 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName,
|
||||||
|
|
||||||
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
nsIDocument* document = mContent->GetDocument();
|
||||||
|
if (document) {
|
||||||
|
document->FlushPendingNotifications(Flush_Style);
|
||||||
|
}
|
||||||
|
|
||||||
nsIFrame *frame = nsnull;
|
nsIFrame *frame = nsnull;
|
||||||
presShell->GetPrimaryFrameFor(mContent, &frame);
|
presShell->GetPrimaryFrameFor(mContent, &frame);
|
||||||
|
|
||||||
|
@ -2873,7 +2878,7 @@ nsComputedDOMStyle::FlushPendingReflows()
|
||||||
// Flush all pending notifications so that our frames are up to date
|
// Flush all pending notifications so that our frames are up to date
|
||||||
nsIDocument* document = mContent->GetDocument();
|
nsIDocument* document = mContent->GetDocument();
|
||||||
if (document) {
|
if (document) {
|
||||||
document->FlushPendingNotifications();
|
document->FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ nsCSSKeywords.h \
|
||||||
nsCSSPropList.h \
|
nsCSSPropList.h \
|
||||||
nsCSSProperty.h \
|
nsCSSProperty.h \
|
||||||
nsCSSProps.h \
|
nsCSSProps.h \
|
||||||
|
mozFlushType.h \
|
||||||
nsFrameManager.h \
|
nsFrameManager.h \
|
||||||
nsFrameManagerBase.h \
|
nsFrameManagerBase.h \
|
||||||
nsHTMLAtomList.h \
|
nsHTMLAtomList.h \
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is mozilla.org code.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Boris Zbarsky.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||||
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
#ifndef mozFlushType_h___
|
||||||
|
#define mozFlushType_h___
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the enum used by nsIDocument::FlushPendingNotifications to
|
||||||
|
* decide what to flush.
|
||||||
|
*/
|
||||||
|
enum mozFlushType {
|
||||||
|
Flush_Content = 0x1, /* flush the content model construction */
|
||||||
|
Flush_SinkNotifications = 0x2, /* flush the frame model construction */
|
||||||
|
Flush_StyleReresolves = 0x4, /* flush style reresolution */
|
||||||
|
Flush_OnlyReflow = 0x8, /* flush reflows */
|
||||||
|
Flush_OnlyPaint = 0x10, /* flush painting */
|
||||||
|
Flush_Frames = (Flush_Content | Flush_SinkNotifications),
|
||||||
|
Flush_ContentAndNotify = (Flush_Content | Flush_SinkNotifications),
|
||||||
|
Flush_Style = (Flush_Content | Flush_SinkNotifications |
|
||||||
|
Flush_StyleReresolves),
|
||||||
|
Flush_Layout = (Flush_Content | Flush_SinkNotifications |
|
||||||
|
Flush_StyleReresolves | Flush_OnlyReflow),
|
||||||
|
Flush_Display = (Flush_Content | Flush_SinkNotifications |
|
||||||
|
Flush_StyleReresolves | Flush_OnlyReflow |
|
||||||
|
Flush_OnlyPaint)
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* mozFlushType_h___ */
|
|
@ -1118,7 +1118,7 @@ void nsSVGSVGElement::GetScreenPosition(PRInt32 &x, PRInt32 &y)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush all pending notifications so that our frames are uptodate
|
// Flush all pending notifications so that our frames are uptodate
|
||||||
presShell->FlushPendingNotifications(PR_FALSE);
|
mDocument->FlushPendingNotifications(Flush_Layout);
|
||||||
|
|
||||||
nsIFrame* frame;
|
nsIFrame* frame;
|
||||||
presShell->GetPrimaryFrameFor(this, &frame);
|
presShell->GetPrimaryFrameFor(this, &frame);
|
||||||
|
|
|
@ -251,8 +251,8 @@ nsXBLResourceLoader::NotifyBoundElements()
|
||||||
nsCOMPtr<nsIDocument> doc = content->GetDocument();
|
nsCOMPtr<nsIDocument> doc = content->GetDocument();
|
||||||
|
|
||||||
if (doc) {
|
if (doc) {
|
||||||
// Flush first
|
// Flush first to make sure we can get the frame for content
|
||||||
doc->FlushPendingNotifications();
|
doc->FlushPendingNotifications(Flush_Frames);
|
||||||
|
|
||||||
// Notify
|
// Notify
|
||||||
nsCOMPtr<nsIContent> parent = content->GetParent();
|
nsCOMPtr<nsIContent> parent = content->GetParent();
|
||||||
|
@ -286,7 +286,8 @@ nsXBLResourceLoader::NotifyBoundElements()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush again
|
// Flush again
|
||||||
doc->FlushPendingNotifications();
|
// XXXbz why is this needed?
|
||||||
|
doc->FlushPendingNotifications(Flush_ContentAndNotify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,7 +384,7 @@ nsXBLStreamListener::Load(nsIDOMEvent* aEvent)
|
||||||
nsXBLBindingRequest* req = (nsXBLBindingRequest*)mBindingRequests.ElementAt(0);
|
nsXBLBindingRequest* req = (nsXBLBindingRequest*)mBindingRequests.ElementAt(0);
|
||||||
nsIDocument* document = req->mBoundElement->GetDocument();
|
nsIDocument* document = req->mBoundElement->GetDocument();
|
||||||
if (document)
|
if (document)
|
||||||
document->FlushPendingNotifications();
|
document->FlushPendingNotifications(Flush_ContentAndNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove ourselves from the set of pending docs.
|
// Remove ourselves from the set of pending docs.
|
||||||
|
@ -429,11 +429,12 @@ nsXBLStreamListener::Load(nsIDOMEvent* aEvent)
|
||||||
// All reqs normally have the same binding doc. Force a synchronous
|
// All reqs normally have the same binding doc. Force a synchronous
|
||||||
// reflow on this binding doc to deal with the fact that iframes
|
// reflow on this binding doc to deal with the fact that iframes
|
||||||
// don't construct or load their subdocs until they get a reflow.
|
// don't construct or load their subdocs until they get a reflow.
|
||||||
|
// XXXbz this is still needed for <xul:iframe>. We need to fix that.
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
nsXBLBindingRequest* req = (nsXBLBindingRequest*)mBindingRequests.ElementAt(0);
|
nsXBLBindingRequest* req = (nsXBLBindingRequest*)mBindingRequests.ElementAt(0);
|
||||||
nsIDocument* document = req->mBoundElement->GetDocument();
|
nsIDocument* document = req->mBoundElement->GetDocument();
|
||||||
if (document)
|
if (document)
|
||||||
document->FlushPendingNotifications();
|
document->FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -121,10 +121,10 @@ nsLoadSaveContentSink::SetParser(nsIParser* aParser)
|
||||||
return mBaseSink->SetParser(aParser);
|
return mBaseSink->SetParser(aParser);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
void
|
||||||
nsLoadSaveContentSink::FlushPendingNotifications(void)
|
nsLoadSaveContentSink::FlushContent(PRBool aNotify)
|
||||||
{
|
{
|
||||||
return mBaseSink->FlushPendingNotifications();
|
mBaseSink->FlushContent(aNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -74,7 +74,7 @@ public:
|
||||||
NS_IMETHOD WillInterrupt(void);
|
NS_IMETHOD WillInterrupt(void);
|
||||||
NS_IMETHOD WillResume(void);
|
NS_IMETHOD WillResume(void);
|
||||||
NS_IMETHOD SetParser(nsIParser* aParser);
|
NS_IMETHOD SetParser(nsIParser* aParser);
|
||||||
NS_IMETHOD FlushPendingNotifications(void);
|
virtual void FlushContent(PRBool aNotify);
|
||||||
NS_IMETHOD SetDocumentCharset(nsAString& aCharset);
|
NS_IMETHOD SetDocumentCharset(nsAString& aCharset);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -85,7 +85,7 @@ public:
|
||||||
NS_IMETHOD WillInterrupt(void);
|
NS_IMETHOD WillInterrupt(void);
|
||||||
NS_IMETHOD WillResume(void);
|
NS_IMETHOD WillResume(void);
|
||||||
NS_IMETHOD SetParser(nsIParser* aParser);
|
NS_IMETHOD SetParser(nsIParser* aParser);
|
||||||
NS_IMETHOD FlushPendingNotifications() { return NS_OK; }
|
virtual void FlushContent(PRBool aNotify) { }
|
||||||
NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
|
NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
|
||||||
|
|
||||||
// nsITransformObserver
|
// nsITransformObserver
|
||||||
|
|
|
@ -133,7 +133,7 @@ public:
|
||||||
NS_IMETHOD WillInterrupt(void);
|
NS_IMETHOD WillInterrupt(void);
|
||||||
NS_IMETHOD WillResume(void);
|
NS_IMETHOD WillResume(void);
|
||||||
NS_IMETHOD SetParser(nsIParser* aParser);
|
NS_IMETHOD SetParser(nsIParser* aParser);
|
||||||
NS_IMETHOD FlushPendingNotifications() { return NS_OK; }
|
virtual void FlushContent(PRBool aNotify) { }
|
||||||
NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
|
NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
|
||||||
|
|
||||||
// nsIXULContentSink
|
// nsIXULContentSink
|
||||||
|
|
|
@ -1585,7 +1585,7 @@ nsXULDocument::GetPixelDimensions(nsIPresShell* aShell, PRInt32* aWidth,
|
||||||
nsSize size;
|
nsSize size;
|
||||||
nsIFrame* frame;
|
nsIFrame* frame;
|
||||||
|
|
||||||
FlushPendingNotifications();
|
FlushPendingNotifications(Flush_Layout);
|
||||||
|
|
||||||
result = aShell->GetPrimaryFrameFor(mRootContent, &frame);
|
result = aShell->GetPrimaryFrameFor(mRootContent, &frame);
|
||||||
if (NS_SUCCEEDED(result) && frame) {
|
if (NS_SUCCEEDED(result) && frame) {
|
||||||
|
@ -2167,7 +2167,8 @@ nsXULDocument::StartLayout(void)
|
||||||
// This is done because iframes don't load their subdocs until
|
// This is done because iframes don't load their subdocs until
|
||||||
// they get reflowed. If we reflow asynchronously, our onload
|
// they get reflowed. If we reflow asynchronously, our onload
|
||||||
// will fire too early. -- hyatt
|
// will fire too early. -- hyatt
|
||||||
FlushPendingNotifications();
|
// XXXbz this is still needed for <xul:iframe>. We need to fix that.
|
||||||
|
FlushPendingNotifications(Flush_Layout);
|
||||||
|
|
||||||
// Start observing the document _after_ we do the initial
|
// Start observing the document _after_ we do the initial
|
||||||
// reflow. Otherwise, we'll get into an trouble trying to
|
// reflow. Otherwise, we'll get into an trouble trying to
|
||||||
|
|
|
@ -5879,7 +5879,9 @@ nsHTMLExternalObjSH::GetPluginInstance(nsIXPConnectWrappedNative *wrapper,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
doc->FlushPendingNotifications();
|
// Have to flush layout, since plugin instance instantiation
|
||||||
|
// currently happens in reflow! That's just uncool.
|
||||||
|
doc->FlushPendingNotifications(Flush_Layout);
|
||||||
|
|
||||||
// See if we have a frame.
|
// See if we have a frame.
|
||||||
nsIPresShell *shell = doc->GetShellAt(0);
|
nsIPresShell *shell = doc->GetShellAt(0);
|
||||||
|
|
|
@ -96,7 +96,7 @@ nsDOMWindowList::GetLength(PRUint32* aLength)
|
||||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domdoc));
|
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domdoc));
|
||||||
|
|
||||||
if (doc) {
|
if (doc) {
|
||||||
doc->FlushPendingNotifications();
|
doc->FlushPendingNotifications(Flush_ContentAndNotify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ nsDOMWindowList::Item(PRUint32 aIndex, nsIDOMWindow** aReturn)
|
||||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domdoc);
|
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domdoc);
|
||||||
|
|
||||||
if (doc) {
|
if (doc) {
|
||||||
doc->FlushPendingNotifications();
|
doc->FlushPendingNotifications(Flush_ContentAndNotify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ nsDOMWindowList::NamedItem(const nsAString& aName, nsIDOMWindow** aReturn)
|
||||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domdoc));
|
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domdoc));
|
||||||
|
|
||||||
if (doc) {
|
if (doc) {
|
||||||
doc->FlushPendingNotifications();
|
doc->FlushPendingNotifications(Flush_ContentAndNotify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1537,7 +1537,14 @@ GlobalWindowImpl::SetName(const nsAString& aName)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
GlobalWindowImpl::GetInnerWidth(PRInt32* aInnerWidth)
|
GlobalWindowImpl::GetInnerWidth(PRInt32* aInnerWidth)
|
||||||
{
|
{
|
||||||
FlushPendingNotifications(PR_TRUE);
|
// If we're a subframe, make sure our size is up to date. It's OK that this
|
||||||
|
// crosses the content/chrome boundary, since chrome can have pending reflows
|
||||||
|
// too.
|
||||||
|
GlobalWindowImpl* parent = NS_STATIC_CAST(GlobalWindowImpl*,
|
||||||
|
GetPrivateParent());
|
||||||
|
if (parent) {
|
||||||
|
parent->FlushPendingNotifications(Flush_Layout);
|
||||||
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIBaseWindow> docShellWin(do_QueryInterface(mDocShell));
|
nsCOMPtr<nsIBaseWindow> docShellWin(do_QueryInterface(mDocShell));
|
||||||
*aInnerWidth = 0;
|
*aInnerWidth = 0;
|
||||||
|
@ -1589,7 +1596,14 @@ GlobalWindowImpl::SetInnerWidth(PRInt32 aInnerWidth)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
GlobalWindowImpl::GetInnerHeight(PRInt32* aInnerHeight)
|
GlobalWindowImpl::GetInnerHeight(PRInt32* aInnerHeight)
|
||||||
{
|
{
|
||||||
FlushPendingNotifications(PR_TRUE);
|
// If we're a subframe, make sure our size is up to date. It's OK that this
|
||||||
|
// crosses the content/chrome boundary, since chrome can have pending reflows
|
||||||
|
// too.
|
||||||
|
GlobalWindowImpl* parent = NS_STATIC_CAST(GlobalWindowImpl*,
|
||||||
|
GetPrivateParent());
|
||||||
|
if (parent) {
|
||||||
|
parent->FlushPendingNotifications(Flush_Layout);
|
||||||
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIBaseWindow> docShellWin(do_QueryInterface(mDocShell));
|
nsCOMPtr<nsIBaseWindow> docShellWin(do_QueryInterface(mDocShell));
|
||||||
*aInnerHeight = 0;
|
*aInnerHeight = 0;
|
||||||
|
@ -1646,7 +1660,11 @@ GlobalWindowImpl::GetOuterWidth(PRInt32* aOuterWidth)
|
||||||
GetTreeOwner(getter_AddRefs(treeOwnerAsWin));
|
GetTreeOwner(getter_AddRefs(treeOwnerAsWin));
|
||||||
NS_ENSURE_TRUE(treeOwnerAsWin, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(treeOwnerAsWin, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
FlushPendingNotifications(PR_TRUE);
|
GlobalWindowImpl* rootWindow = NS_STATIC_CAST(GlobalWindowImpl*,
|
||||||
|
GetPrivateRoot());
|
||||||
|
if (rootWindow) {
|
||||||
|
rootWindow->FlushPendingNotifications(Flush_Layout);
|
||||||
|
}
|
||||||
PRInt32 notused;
|
PRInt32 notused;
|
||||||
NS_ENSURE_SUCCESS(treeOwnerAsWin->GetSize(aOuterWidth, ¬used),
|
NS_ENSURE_SUCCESS(treeOwnerAsWin->GetSize(aOuterWidth, ¬used),
|
||||||
NS_ERROR_FAILURE);
|
NS_ERROR_FAILURE);
|
||||||
|
@ -1689,7 +1707,11 @@ GlobalWindowImpl::GetOuterHeight(PRInt32* aOuterHeight)
|
||||||
GetTreeOwner(getter_AddRefs(treeOwnerAsWin));
|
GetTreeOwner(getter_AddRefs(treeOwnerAsWin));
|
||||||
NS_ENSURE_TRUE(treeOwnerAsWin, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(treeOwnerAsWin, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
FlushPendingNotifications(PR_TRUE);
|
GlobalWindowImpl* rootWindow = NS_STATIC_CAST(GlobalWindowImpl*,
|
||||||
|
GetPrivateRoot());
|
||||||
|
if (rootWindow) {
|
||||||
|
rootWindow->FlushPendingNotifications(Flush_Layout);
|
||||||
|
}
|
||||||
|
|
||||||
PRInt32 notused;
|
PRInt32 notused;
|
||||||
NS_ENSURE_SUCCESS(treeOwnerAsWin->GetSize(¬used, aOuterHeight),
|
NS_ENSURE_SUCCESS(treeOwnerAsWin->GetSize(¬used, aOuterHeight),
|
||||||
|
@ -1862,7 +1884,11 @@ GlobalWindowImpl::CheckSecurityLeftAndTop(PRInt32* aLeft, PRInt32* aTop)
|
||||||
PRInt32 screenLeft, screenTop, screenWidth, screenHeight;
|
PRInt32 screenLeft, screenTop, screenWidth, screenHeight;
|
||||||
PRInt32 winLeft, winTop, winWidth, winHeight;
|
PRInt32 winLeft, winTop, winWidth, winHeight;
|
||||||
|
|
||||||
FlushPendingNotifications(PR_TRUE);
|
GlobalWindowImpl* rootWindow = NS_STATIC_CAST(GlobalWindowImpl*,
|
||||||
|
GetPrivateRoot());
|
||||||
|
if (rootWindow) {
|
||||||
|
rootWindow->FlushPendingNotifications(Flush_Layout);
|
||||||
|
}
|
||||||
|
|
||||||
// Get the window size
|
// Get the window size
|
||||||
nsCOMPtr<nsIBaseWindow> treeOwner;
|
nsCOMPtr<nsIBaseWindow> treeOwner;
|
||||||
|
@ -2140,7 +2166,7 @@ GlobalWindowImpl::EnsureReflowFlushAndPaint()
|
||||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(mDocument));
|
nsCOMPtr<nsIDocument> doc(do_QueryInterface(mDocument));
|
||||||
|
|
||||||
if (doc) {
|
if (doc) {
|
||||||
doc->FlushPendingNotifications(PR_TRUE, PR_FALSE);
|
doc->FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unsuppress painting.
|
// Unsuppress painting.
|
||||||
|
@ -3390,7 +3416,7 @@ GlobalWindowImpl::GetFrames(nsIDOMWindow** aFrames)
|
||||||
*aFrames = this;
|
*aFrames = this;
|
||||||
NS_ADDREF(*aFrames);
|
NS_ADDREF(*aFrames);
|
||||||
|
|
||||||
FlushPendingNotifications(PR_FALSE);
|
FlushPendingNotifications(Flush_ContentAndNotify);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -4184,15 +4210,15 @@ GlobalWindowImpl::GetPrivateParent()
|
||||||
if (NS_STATIC_CAST(nsIDOMWindow *, this) == parent.get()) {
|
if (NS_STATIC_CAST(nsIDOMWindow *, this) == parent.get()) {
|
||||||
nsCOMPtr<nsIContent> chromeElement(do_QueryInterface(mChromeEventHandler));
|
nsCOMPtr<nsIContent> chromeElement(do_QueryInterface(mChromeEventHandler));
|
||||||
if (!chromeElement)
|
if (!chromeElement)
|
||||||
return NS_OK; // This is ok, just means a null parent.
|
return nsnull; // This is ok, just means a null parent.
|
||||||
|
|
||||||
nsIDocument* doc = chromeElement->GetDocument();
|
nsIDocument* doc = chromeElement->GetDocument();
|
||||||
if (!doc)
|
if (!doc)
|
||||||
return NS_OK; // This is ok, just means a null parent.
|
return nsnull; // This is ok, just means a null parent.
|
||||||
|
|
||||||
nsIScriptGlobalObject *globalObject = doc->GetScriptGlobalObject();
|
nsIScriptGlobalObject *globalObject = doc->GetScriptGlobalObject();
|
||||||
if (!globalObject)
|
if (!globalObject)
|
||||||
return NS_OK; // This is ok, just means a null parent.
|
return nsnull; // This is ok, just means a null parent.
|
||||||
|
|
||||||
parent = do_QueryInterface(globalObject);
|
parent = do_QueryInterface(globalObject);
|
||||||
}
|
}
|
||||||
|
@ -5429,7 +5455,7 @@ GlobalWindowImpl::GetScrollInfo(nsIScrollableView **aScrollableView,
|
||||||
|
|
||||||
// Flush pending notifications so that the presentation is up to
|
// Flush pending notifications so that the presentation is up to
|
||||||
// date.
|
// date.
|
||||||
FlushPendingNotifications(PR_TRUE);
|
FlushPendingNotifications(Flush_Layout);
|
||||||
|
|
||||||
nsCOMPtr<nsIPresContext> presContext;
|
nsCOMPtr<nsIPresContext> presContext;
|
||||||
mDocShell->GetPresContext(getter_AddRefs(presContext));
|
mDocShell->GetPresContext(getter_AddRefs(presContext));
|
||||||
|
@ -5497,11 +5523,11 @@ GlobalWindowImpl::SecurityCheckURL(const char *aURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GlobalWindowImpl::FlushPendingNotifications(PRBool aFlushReflows)
|
GlobalWindowImpl::FlushPendingNotifications(mozFlushType aType)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(mDocument));
|
nsCOMPtr<nsIDocument> doc(do_QueryInterface(mDocument));
|
||||||
if (doc) {
|
if (doc) {
|
||||||
doc->FlushPendingNotifications(aFlushReflows);
|
doc->FlushPendingNotifications(aType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,7 @@
|
||||||
#include "nsIXPCScriptable.h"
|
#include "nsIXPCScriptable.h"
|
||||||
#include "nsPoint.h"
|
#include "nsPoint.h"
|
||||||
#include "nsSize.h"
|
#include "nsSize.h"
|
||||||
|
#include "mozFlushType.h"
|
||||||
|
|
||||||
#define DEFAULT_HOME_PAGE "www.mozilla.org"
|
#define DEFAULT_HOME_PAGE "www.mozilla.org"
|
||||||
#define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
|
#define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
|
||||||
|
@ -249,7 +250,7 @@ protected:
|
||||||
const nsAString &aPopupURL,
|
const nsAString &aPopupURL,
|
||||||
const nsAString &aPopupWindowFeatures);
|
const nsAString &aPopupWindowFeatures);
|
||||||
|
|
||||||
void FlushPendingNotifications(PRBool aFlushReflows);
|
void FlushPendingNotifications(mozFlushType aType);
|
||||||
void EnsureReflowFlushAndPaint();
|
void EnsureReflowFlushAndPaint();
|
||||||
nsresult CheckSecurityWidthAndHeight(PRInt32* width, PRInt32* height);
|
nsresult CheckSecurityWidthAndHeight(PRInt32* width, PRInt32* height);
|
||||||
nsresult CheckSecurityLeftAndTop(PRInt32* left, PRInt32* top);
|
nsresult CheckSecurityLeftAndTop(PRInt32* left, PRInt32* top);
|
||||||
|
|
|
@ -169,7 +169,7 @@ inLayoutUtils::GetScreenOrigin(nsIDOMElement* aElement)
|
||||||
|
|
||||||
if (presShell) {
|
if (presShell) {
|
||||||
// Flush all pending notifications so that our frames are uptodate
|
// Flush all pending notifications so that our frames are uptodate
|
||||||
presShell->FlushPendingNotifications(PR_FALSE);
|
doc->FlushPendingNotifications(Flush_Layout);
|
||||||
|
|
||||||
nsCOMPtr<nsIPresContext> presContext;
|
nsCOMPtr<nsIPresContext> presContext;
|
||||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||||
|
|
|
@ -163,7 +163,7 @@ nsXPathResult::IterateNext(nsIDOMNode **aResult)
|
||||||
return NS_ERROR_DOM_TYPE_ERR;
|
return NS_ERROR_DOM_TYPE_ERR;
|
||||||
|
|
||||||
if (mDocument)
|
if (mDocument)
|
||||||
mDocument->FlushPendingNotifications(PR_FALSE);
|
mDocument->FlushPendingNotifications(Flush_Content);
|
||||||
|
|
||||||
if (mInvalidIteratorState)
|
if (mInvalidIteratorState)
|
||||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||||
|
|
|
@ -111,7 +111,7 @@ public:
|
||||||
NS_IMETHOD WillInterrupt(void) { return NS_OK; }
|
NS_IMETHOD WillInterrupt(void) { return NS_OK; }
|
||||||
NS_IMETHOD WillResume(void) { return NS_OK; }
|
NS_IMETHOD WillResume(void) { return NS_OK; }
|
||||||
NS_IMETHOD SetParser(nsIParser* aParser) { return NS_OK; }
|
NS_IMETHOD SetParser(nsIParser* aParser) { return NS_OK; }
|
||||||
NS_IMETHOD FlushPendingNotifications() { return NS_OK; }
|
virtual void FlushContent(PRBool aNotify) { }
|
||||||
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
|
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -79,6 +79,7 @@
|
||||||
#include "mozXMLTermSession.h"
|
#include "mozXMLTermSession.h"
|
||||||
#include "nsISelectionController.h"
|
#include "nsISelectionController.h"
|
||||||
#include "nsReadableUtils.h"
|
#include "nsReadableUtils.h"
|
||||||
|
#include "nsIDocument.h"
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// mozXMLTermSession definition
|
// mozXMLTermSession definition
|
||||||
|
@ -3093,7 +3094,10 @@ NS_IMETHODIMP mozXMLTermSession::ScrollToBottomLeft(void)
|
||||||
if (NS_FAILED(result) || !presShell)
|
if (NS_FAILED(result) || !presShell)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
presShell->FlushPendingNotifications(PR_FALSE);
|
nsIDocument* doc = presShell->GetDocument();
|
||||||
|
if (doc) {
|
||||||
|
doc->FlushPendingNotifications(Flush_Layout);
|
||||||
|
}
|
||||||
|
|
||||||
// Get DOM Window
|
// Get DOM Window
|
||||||
nsCOMPtr<nsIDocShell> docShell;
|
nsCOMPtr<nsIDocShell> docShell;
|
||||||
|
|
|
@ -656,7 +656,7 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow)
|
||||||
// Note that we are flushing before we add mPresShell as an observer
|
// Note that we are flushing before we add mPresShell as an observer
|
||||||
// to avoid bogus notifications.
|
// to avoid bogus notifications.
|
||||||
|
|
||||||
mDocument->FlushPendingNotifications(PR_FALSE);
|
mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
mPresShell->BeginObservingDocument();
|
mPresShell->BeginObservingDocument();
|
||||||
|
@ -935,9 +935,7 @@ DocumentViewerImpl::LoadComplete(nsresult aStatus)
|
||||||
static PRBool forcePaint
|
static PRBool forcePaint
|
||||||
= PR_GetEnv("MOZ_FORCE_PAINT_AFTER_ONLOAD") != nsnull;
|
= PR_GetEnv("MOZ_FORCE_PAINT_AFTER_ONLOAD") != nsnull;
|
||||||
if (forcePaint) {
|
if (forcePaint) {
|
||||||
if (mPresShell) {
|
mDocument->FlushPendingNotifications(Flush_Display);
|
||||||
mPresShell->FlushPendingNotifications(PR_TRUE);
|
|
||||||
}
|
|
||||||
nsIURI *uri = mDocument->GetDocumentURI();
|
nsIURI *uri = mDocument->GetDocumentURI();
|
||||||
nsCAutoString spec;
|
nsCAutoString spec;
|
||||||
if (uri) {
|
if (uri) {
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
#include "nsCompatibility.h"
|
#include "nsCompatibility.h"
|
||||||
#include "nsCOMArray.h"
|
#include "nsCOMArray.h"
|
||||||
#include "nsFrameManagerBase.h"
|
#include "nsFrameManagerBase.h"
|
||||||
|
#include "mozFlushType.h"
|
||||||
#include <stdio.h> // for FILE definition
|
#include <stdio.h> // for FILE definition
|
||||||
|
|
||||||
class nsIAtom;
|
class nsIAtom;
|
||||||
|
@ -324,11 +325,15 @@ public:
|
||||||
NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush) = 0;
|
NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush all pending notifications such that the presentation is
|
* Flush pending notifications of the type specified. This method
|
||||||
* in sync with the content.
|
* will not affect the content model; it'll just affect style and
|
||||||
* @param aUpdateViews PR_TRUE causes the affected views to be refreshed immediately.
|
* frames. Callers that actually want up-to-date presentation (other
|
||||||
|
* than the document itself) should probably be calling
|
||||||
|
* nsIDocument::FlushPendingNotifications.
|
||||||
|
*
|
||||||
|
* @param aType the type of notifications to flush
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD FlushPendingNotifications(PRBool aUpdateViews) = 0;
|
NS_IMETHOD FlushPendingNotifications(mozFlushType aType) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post a request to handle a DOM event after Reflow has finished.
|
* Post a request to handle a DOM event after Reflow has finished.
|
||||||
|
|
|
@ -1131,7 +1131,7 @@ public:
|
||||||
PRBool aProcessDummyLayoutRequest = PR_TRUE);
|
PRBool aProcessDummyLayoutRequest = PR_TRUE);
|
||||||
NS_IMETHOD CancelAllReflowCommands();
|
NS_IMETHOD CancelAllReflowCommands();
|
||||||
NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush);
|
NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush);
|
||||||
NS_IMETHOD FlushPendingNotifications(PRBool aUpdateViews);
|
NS_IMETHOD FlushPendingNotifications(mozFlushType aType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recreates the frames for a node
|
* Recreates the frames for a node
|
||||||
|
@ -3972,6 +3972,10 @@ PresShell::CantRenderReplacedElement(nsIFrame* aFrame)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
|
PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
|
||||||
{
|
{
|
||||||
|
if (!mDocument) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Hold a reference to the ESM in case event dispatch tears us down.
|
// Hold a reference to the ESM in case event dispatch tears us down.
|
||||||
nsCOMPtr<nsIEventStateManager> esm = mPresContext->EventStateManager();
|
nsCOMPtr<nsIEventStateManager> esm = mPresContext->EventStateManager();
|
||||||
|
|
||||||
|
@ -4097,7 +4101,7 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
|
||||||
if (content) {
|
if (content) {
|
||||||
// Flush notifications so we scroll to the right place
|
// Flush notifications so we scroll to the right place
|
||||||
if (aScroll) {
|
if (aScroll) {
|
||||||
FlushPendingNotifications(PR_FALSE);
|
mDocument->FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the primary frame
|
// Get the primary frame
|
||||||
|
@ -5087,7 +5091,7 @@ PresShell::HandlePostedReflowCallbacks()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldFlush)
|
if (shouldFlush)
|
||||||
FlushPendingNotifications(PR_FALSE);
|
FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -5162,19 +5166,26 @@ PresShell::IsSafeToFlush(PRBool& aIsSafeToFlush)
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::FlushPendingNotifications(PRBool aUpdateViews)
|
PresShell::FlushPendingNotifications(mozFlushType aType)
|
||||||
{
|
{
|
||||||
|
NS_ASSERTION(aType & (Flush_StyleReresolves | Flush_OnlyReflow |
|
||||||
|
Flush_OnlyPaint),
|
||||||
|
"Why did we get called?");
|
||||||
|
|
||||||
PRBool isSafeToFlush;
|
PRBool isSafeToFlush;
|
||||||
IsSafeToFlush(isSafeToFlush);
|
IsSafeToFlush(isSafeToFlush);
|
||||||
|
|
||||||
if (isSafeToFlush) {
|
if (isSafeToFlush) {
|
||||||
if (aUpdateViews && mViewManager) {
|
PRBool batchViews = (aType & Flush_OnlyPaint);
|
||||||
|
if (batchViews && mViewManager) {
|
||||||
mViewManager->BeginUpdateViewBatch();
|
mViewManager->BeginUpdateViewBatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessReflowCommands(PR_FALSE);
|
if (aType & Flush_OnlyReflow) {
|
||||||
|
ProcessReflowCommands(PR_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
if (aUpdateViews && mViewManager) {
|
if (batchViews && mViewManager) {
|
||||||
mViewManager->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE);
|
mViewManager->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5202,7 +5213,7 @@ PresShell::EndReflowBatching(PRBool aFlushPendingReflows)
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
mBatchReflows = PR_FALSE;
|
mBatchReflows = PR_FALSE;
|
||||||
if (aFlushPendingReflows) {
|
if (aFlushPendingReflows) {
|
||||||
rv = FlushPendingNotifications(PR_FALSE);
|
rv = FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PostReflowEvent();
|
PostReflowEvent();
|
||||||
|
@ -6303,7 +6314,7 @@ PresShell::DidCauseReflow()
|
||||||
// We may have had more reflow commands appended to the queue during
|
// We may have had more reflow commands appended to the queue during
|
||||||
// our reflow. Make sure these get processed at some point.
|
// our reflow. Make sure these get processed at some point.
|
||||||
if (!gAsyncReflowDuringDocLoad && mDocumentLoading) {
|
if (!gAsyncReflowDuringDocLoad && mDocumentLoading) {
|
||||||
FlushPendingNotifications(PR_FALSE);
|
FlushPendingNotifications(Flush_Layout);
|
||||||
} else {
|
} else {
|
||||||
PostReflowEvent();
|
PostReflowEvent();
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
#include "nsCompatibility.h"
|
#include "nsCompatibility.h"
|
||||||
#include "nsCOMArray.h"
|
#include "nsCOMArray.h"
|
||||||
#include "nsFrameManagerBase.h"
|
#include "nsFrameManagerBase.h"
|
||||||
|
#include "mozFlushType.h"
|
||||||
#include <stdio.h> // for FILE definition
|
#include <stdio.h> // for FILE definition
|
||||||
|
|
||||||
class nsIAtom;
|
class nsIAtom;
|
||||||
|
@ -324,11 +325,15 @@ public:
|
||||||
NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush) = 0;
|
NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush all pending notifications such that the presentation is
|
* Flush pending notifications of the type specified. This method
|
||||||
* in sync with the content.
|
* will not affect the content model; it'll just affect style and
|
||||||
* @param aUpdateViews PR_TRUE causes the affected views to be refreshed immediately.
|
* frames. Callers that actually want up-to-date presentation (other
|
||||||
|
* than the document itself) should probably be calling
|
||||||
|
* nsIDocument::FlushPendingNotifications.
|
||||||
|
*
|
||||||
|
* @param aType the type of notifications to flush
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD FlushPendingNotifications(PRBool aUpdateViews) = 0;
|
NS_IMETHOD FlushPendingNotifications(mozFlushType aType) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post a request to handle a DOM event after Reflow has finished.
|
* Post a request to handle a DOM event after Reflow has finished.
|
||||||
|
|
|
@ -616,7 +616,9 @@ nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList)
|
||||||
mDroppedDown = PR_FALSE;
|
mDroppedDown = PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
aPresContext->PresShell()->FlushPendingNotifications(PR_FALSE);
|
// Don't flush anything but reflows lest it destroy us
|
||||||
|
aPresContext->PresShell()->
|
||||||
|
GetDocument()->FlushPendingNotifications(Flush_OnlyReflow);
|
||||||
|
|
||||||
if (widget)
|
if (widget)
|
||||||
widget->CaptureRollupEvents((nsIRollupListener *)this, mDroppedDown, aShowList);
|
widget->CaptureRollupEvents((nsIRollupListener *)this, mDroppedDown, aShowList);
|
||||||
|
@ -1809,8 +1811,6 @@ nsComboboxControlFrame::RedisplayText(PRInt32 aIndex)
|
||||||
//mTextFrame->AddStateBits(NS_FRAME_IS_DIRTY);
|
//mTextFrame->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||||
mDisplayFrame->AddStateBits(NS_FRAME_IS_DIRTY);
|
mDisplayFrame->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||||
ReflowDirtyChild(mPresContext->PresShell(), mDisplayFrame);
|
ReflowDirtyChild(mPresContext->PresShell(), mDisplayFrame);
|
||||||
|
|
||||||
// mPresContext->PresShell()->FlushPendingNotifications(PR_FALSE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -3480,7 +3480,9 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||||
// Why aren't they getting flushed each time?
|
// Why aren't they getting flushed each time?
|
||||||
// because this isn't needed for Gfx
|
// because this isn't needed for Gfx
|
||||||
if (IsInDropDownMode() == PR_TRUE) {
|
if (IsInDropDownMode() == PR_TRUE) {
|
||||||
mPresContext->PresShell()->FlushPendingNotifications(PR_FALSE);
|
// Don't flush anything but reflows lest it destroy us
|
||||||
|
mPresContext->PresShell()->
|
||||||
|
GetDocument()->FlushPendingNotifications(Flush_OnlyReflow);
|
||||||
}
|
}
|
||||||
REFLOW_DEBUG_MSG2(" After: %d\n", newIndex);
|
REFLOW_DEBUG_MSG2(" After: %d\n", newIndex);
|
||||||
|
|
||||||
|
|
|
@ -1131,7 +1131,7 @@ public:
|
||||||
PRBool aProcessDummyLayoutRequest = PR_TRUE);
|
PRBool aProcessDummyLayoutRequest = PR_TRUE);
|
||||||
NS_IMETHOD CancelAllReflowCommands();
|
NS_IMETHOD CancelAllReflowCommands();
|
||||||
NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush);
|
NS_IMETHOD IsSafeToFlush(PRBool& aIsSafeToFlush);
|
||||||
NS_IMETHOD FlushPendingNotifications(PRBool aUpdateViews);
|
NS_IMETHOD FlushPendingNotifications(mozFlushType aType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recreates the frames for a node
|
* Recreates the frames for a node
|
||||||
|
@ -3972,6 +3972,10 @@ PresShell::CantRenderReplacedElement(nsIFrame* aFrame)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
|
PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
|
||||||
{
|
{
|
||||||
|
if (!mDocument) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Hold a reference to the ESM in case event dispatch tears us down.
|
// Hold a reference to the ESM in case event dispatch tears us down.
|
||||||
nsCOMPtr<nsIEventStateManager> esm = mPresContext->EventStateManager();
|
nsCOMPtr<nsIEventStateManager> esm = mPresContext->EventStateManager();
|
||||||
|
|
||||||
|
@ -4097,7 +4101,7 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
|
||||||
if (content) {
|
if (content) {
|
||||||
// Flush notifications so we scroll to the right place
|
// Flush notifications so we scroll to the right place
|
||||||
if (aScroll) {
|
if (aScroll) {
|
||||||
FlushPendingNotifications(PR_FALSE);
|
mDocument->FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the primary frame
|
// Get the primary frame
|
||||||
|
@ -5087,7 +5091,7 @@ PresShell::HandlePostedReflowCallbacks()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldFlush)
|
if (shouldFlush)
|
||||||
FlushPendingNotifications(PR_FALSE);
|
FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -5162,19 +5166,26 @@ PresShell::IsSafeToFlush(PRBool& aIsSafeToFlush)
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PresShell::FlushPendingNotifications(PRBool aUpdateViews)
|
PresShell::FlushPendingNotifications(mozFlushType aType)
|
||||||
{
|
{
|
||||||
|
NS_ASSERTION(aType & (Flush_StyleReresolves | Flush_OnlyReflow |
|
||||||
|
Flush_OnlyPaint),
|
||||||
|
"Why did we get called?");
|
||||||
|
|
||||||
PRBool isSafeToFlush;
|
PRBool isSafeToFlush;
|
||||||
IsSafeToFlush(isSafeToFlush);
|
IsSafeToFlush(isSafeToFlush);
|
||||||
|
|
||||||
if (isSafeToFlush) {
|
if (isSafeToFlush) {
|
||||||
if (aUpdateViews && mViewManager) {
|
PRBool batchViews = (aType & Flush_OnlyPaint);
|
||||||
|
if (batchViews && mViewManager) {
|
||||||
mViewManager->BeginUpdateViewBatch();
|
mViewManager->BeginUpdateViewBatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessReflowCommands(PR_FALSE);
|
if (aType & Flush_OnlyReflow) {
|
||||||
|
ProcessReflowCommands(PR_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
if (aUpdateViews && mViewManager) {
|
if (batchViews && mViewManager) {
|
||||||
mViewManager->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE);
|
mViewManager->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5202,7 +5213,7 @@ PresShell::EndReflowBatching(PRBool aFlushPendingReflows)
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
mBatchReflows = PR_FALSE;
|
mBatchReflows = PR_FALSE;
|
||||||
if (aFlushPendingReflows) {
|
if (aFlushPendingReflows) {
|
||||||
rv = FlushPendingNotifications(PR_FALSE);
|
rv = FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PostReflowEvent();
|
PostReflowEvent();
|
||||||
|
@ -6303,7 +6314,7 @@ PresShell::DidCauseReflow()
|
||||||
// We may have had more reflow commands appended to the queue during
|
// We may have had more reflow commands appended to the queue during
|
||||||
// our reflow. Make sure these get processed at some point.
|
// our reflow. Make sure these get processed at some point.
|
||||||
if (!gAsyncReflowDuringDocLoad && mDocumentLoading) {
|
if (!gAsyncReflowDuringDocLoad && mDocumentLoading) {
|
||||||
FlushPendingNotifications(PR_FALSE);
|
FlushPendingNotifications(Flush_Layout);
|
||||||
} else {
|
} else {
|
||||||
PostReflowEvent();
|
PostReflowEvent();
|
||||||
}
|
}
|
||||||
|
|
|
@ -616,7 +616,9 @@ nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList)
|
||||||
mDroppedDown = PR_FALSE;
|
mDroppedDown = PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
aPresContext->PresShell()->FlushPendingNotifications(PR_FALSE);
|
// Don't flush anything but reflows lest it destroy us
|
||||||
|
aPresContext->PresShell()->
|
||||||
|
GetDocument()->FlushPendingNotifications(Flush_OnlyReflow);
|
||||||
|
|
||||||
if (widget)
|
if (widget)
|
||||||
widget->CaptureRollupEvents((nsIRollupListener *)this, mDroppedDown, aShowList);
|
widget->CaptureRollupEvents((nsIRollupListener *)this, mDroppedDown, aShowList);
|
||||||
|
@ -1809,8 +1811,6 @@ nsComboboxControlFrame::RedisplayText(PRInt32 aIndex)
|
||||||
//mTextFrame->AddStateBits(NS_FRAME_IS_DIRTY);
|
//mTextFrame->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||||
mDisplayFrame->AddStateBits(NS_FRAME_IS_DIRTY);
|
mDisplayFrame->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||||
ReflowDirtyChild(mPresContext->PresShell(), mDisplayFrame);
|
ReflowDirtyChild(mPresContext->PresShell(), mDisplayFrame);
|
||||||
|
|
||||||
// mPresContext->PresShell()->FlushPendingNotifications(PR_FALSE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
@ -3480,7 +3480,9 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||||
// Why aren't they getting flushed each time?
|
// Why aren't they getting flushed each time?
|
||||||
// because this isn't needed for Gfx
|
// because this isn't needed for Gfx
|
||||||
if (IsInDropDownMode() == PR_TRUE) {
|
if (IsInDropDownMode() == PR_TRUE) {
|
||||||
mPresContext->PresShell()->FlushPendingNotifications(PR_FALSE);
|
// Don't flush anything but reflows lest it destroy us
|
||||||
|
mPresContext->PresShell()->
|
||||||
|
GetDocument()->FlushPendingNotifications(Flush_OnlyReflow);
|
||||||
}
|
}
|
||||||
REFLOW_DEBUG_MSG2(" After: %d\n", newIndex);
|
REFLOW_DEBUG_MSG2(" After: %d\n", newIndex);
|
||||||
|
|
||||||
|
|
|
@ -271,6 +271,11 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName,
|
||||||
|
|
||||||
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
nsIDocument* document = mContent->GetDocument();
|
||||||
|
if (document) {
|
||||||
|
document->FlushPendingNotifications(Flush_Style);
|
||||||
|
}
|
||||||
|
|
||||||
nsIFrame *frame = nsnull;
|
nsIFrame *frame = nsnull;
|
||||||
presShell->GetPrimaryFrameFor(mContent, &frame);
|
presShell->GetPrimaryFrameFor(mContent, &frame);
|
||||||
|
|
||||||
|
@ -2873,7 +2878,7 @@ nsComputedDOMStyle::FlushPendingReflows()
|
||||||
// Flush all pending notifications so that our frames are up to date
|
// Flush all pending notifications so that our frames are up to date
|
||||||
nsIDocument* document = mContent->GetDocument();
|
nsIDocument* document = mContent->GetDocument();
|
||||||
if (document) {
|
if (document) {
|
||||||
document->FlushPendingNotifications();
|
document->FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1060,7 +1060,10 @@ void nsSVGOuterSVGFrame::InitiateReflow()
|
||||||
}
|
}
|
||||||
|
|
||||||
mPresShell->AppendReflowCommand(reflowCmd);
|
mPresShell->AppendReflowCommand(reflowCmd);
|
||||||
mPresShell->FlushPendingNotifications(PR_FALSE);
|
// XXXbz why is this synchronously flushing reflows, exactly? If it
|
||||||
|
// needs to, why is it not using the presshell's reflow batching
|
||||||
|
// instead of hacking its own?
|
||||||
|
mPresShell->FlushPendingNotifications(Flush_OnlyReflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ nsBoxObject::GetOffsetRect(nsRect& aRect)
|
||||||
|
|
||||||
if(presShell) {
|
if(presShell) {
|
||||||
// Flush all pending notifications so that our frames are uptodate
|
// Flush all pending notifications so that our frames are uptodate
|
||||||
presShell->FlushPendingNotifications(PR_FALSE);
|
doc->FlushPendingNotifications(Flush_Layout);
|
||||||
|
|
||||||
// Get the Frame for our content
|
// Get the Frame for our content
|
||||||
nsIFrame* frame = nsnull;
|
nsIFrame* frame = nsnull;
|
||||||
|
@ -282,7 +282,7 @@ nsBoxObject::GetScreenRect(nsRect& aRect)
|
||||||
|
|
||||||
if (presShell) {
|
if (presShell) {
|
||||||
// Flush all pending notifications so that our frames are uptodate
|
// Flush all pending notifications so that our frames are uptodate
|
||||||
presShell->FlushPendingNotifications(PR_FALSE);
|
doc->FlushPendingNotifications(Flush_Layout);
|
||||||
|
|
||||||
nsCOMPtr<nsIPresContext> presContext;
|
nsCOMPtr<nsIPresContext> presContext;
|
||||||
presShell->GetPresContext(getter_AddRefs(presContext));
|
presShell->GetPresContext(getter_AddRefs(presContext));
|
||||||
|
|
|
@ -404,7 +404,8 @@ nsListBoxBodyFrame::PositionChanged(PRInt32 aOldIndex, PRInt32& aNewIndex)
|
||||||
|
|
||||||
smoother->Stop();
|
smoother->Stop();
|
||||||
|
|
||||||
mPresContext->PresShell()->FlushPendingNotifications(PR_FALSE);
|
// Don't flush anything but reflows lest it destroy us
|
||||||
|
mContent->GetDocument()->FlushPendingNotifications(Flush_OnlyReflow);
|
||||||
|
|
||||||
smoother->mDelta = newTwipIndex > oldTwipIndex ? rowDelta : -rowDelta;
|
smoother->mDelta = newTwipIndex > oldTwipIndex ? rowDelta : -rowDelta;
|
||||||
|
|
||||||
|
@ -851,7 +852,8 @@ nsListBoxBodyFrame::DoScrollToIndex(PRInt32 aRowIndex, PRBool aForceDestruct)
|
||||||
|
|
||||||
// This change has to happen immediately.
|
// This change has to happen immediately.
|
||||||
// Flush any pending reflow commands.
|
// Flush any pending reflow commands.
|
||||||
mContent->GetDocument()->FlushPendingNotifications();
|
// Don't flush anything but reflows lest it destroy us
|
||||||
|
mContent->GetDocument()->FlushPendingNotifications(Flush_OnlyReflow);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -881,8 +883,7 @@ nsListBoxBodyFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta, PRBool a
|
||||||
// begin timing how long it takes to scroll a row
|
// begin timing how long it takes to scroll a row
|
||||||
PRTime start = PR_Now();
|
PRTime start = PR_Now();
|
||||||
|
|
||||||
nsIPresShell *shell = mPresContext->PresShell();
|
mContent->GetDocument()->FlushPendingNotifications(Flush_OnlyReflow);
|
||||||
shell->FlushPendingNotifications(PR_FALSE);
|
|
||||||
|
|
||||||
PRInt32 visibleRows = 0;
|
PRInt32 visibleRows = 0;
|
||||||
if (mRowHeight)
|
if (mRowHeight)
|
||||||
|
@ -927,7 +928,9 @@ nsListBoxBodyFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta, PRBool a
|
||||||
nsBoxLayoutState state(mPresContext);
|
nsBoxLayoutState state(mPresContext);
|
||||||
mScrolling = PR_TRUE;
|
mScrolling = PR_TRUE;
|
||||||
MarkDirtyChildren(state);
|
MarkDirtyChildren(state);
|
||||||
shell->FlushPendingNotifications(PR_FALSE); // Calls CreateRows
|
// Flush calls CreateRows
|
||||||
|
// XXXbz there has to be a better way to do this than flushing!
|
||||||
|
mPresContext->PresShell()->FlushPendingNotifications(Flush_OnlyReflow);
|
||||||
mScrolling = PR_FALSE;
|
mScrolling = PR_FALSE;
|
||||||
|
|
||||||
VerticalScroll(mYPosition);
|
VerticalScroll(mYPosition);
|
||||||
|
@ -1318,7 +1321,7 @@ nsListBoxBodyFrame::OnContentInserted(nsIPresContext* aPresContext, nsIContent*
|
||||||
|
|
||||||
nsBoxLayoutState state(aPresContext);
|
nsBoxLayoutState state(aPresContext);
|
||||||
MarkDirtyChildren(state);
|
MarkDirtyChildren(state);
|
||||||
shell->FlushPendingNotifications(PR_FALSE);
|
shell->FlushPendingNotifications(Flush_OnlyReflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1390,7 +1393,7 @@ nsListBoxBodyFrame::OnContentRemoved(nsIPresContext* aPresContext, nsIFrame* aCh
|
||||||
}
|
}
|
||||||
|
|
||||||
MarkDirtyChildren(state);
|
MarkDirtyChildren(state);
|
||||||
aPresContext->PresShell()->FlushPendingNotifications(PR_FALSE);
|
aPresContext->PresShell()->FlushPendingNotifications(Flush_OnlyReflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -802,7 +802,7 @@ nsMenuFrame::OpenMenuInternal(PRBool aActivateFlag)
|
||||||
{
|
{
|
||||||
menuPopup->MarkDirty(state);
|
menuPopup->MarkDirty(state);
|
||||||
|
|
||||||
mPresContext->PresShell()->FlushPendingNotifications(PR_FALSE);
|
mPresContext->PresShell()->FlushPendingNotifications(Flush_OnlyReflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRect curRect;
|
nsRect curRect;
|
||||||
|
@ -823,7 +823,7 @@ nsMenuFrame::OpenMenuInternal(PRBool aActivateFlag)
|
||||||
if (curRect.height != rect.height || mLastPref.height != rect.height)
|
if (curRect.height != rect.height || mLastPref.height != rect.height)
|
||||||
{
|
{
|
||||||
menuPopup->MarkDirty(state);
|
menuPopup->MarkDirty(state);
|
||||||
mPresContext->PresShell()->FlushPendingNotifications(PR_FALSE);
|
mPresContext->PresShell()->FlushPendingNotifications(Flush_OnlyReflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivateMenu(PR_TRUE);
|
ActivateMenu(PR_TRUE);
|
||||||
|
|
|
@ -563,7 +563,7 @@ nsPopupSetFrame::ActivatePopup(nsPopupFrameList* aEntry, PRBool aActivateFlag)
|
||||||
// reflow will cause the popup to show itself again. (bug 71219)
|
// reflow will cause the popup to show itself again. (bug 71219)
|
||||||
nsIDocument* doc = aEntry->mPopupContent->GetDocument();
|
nsIDocument* doc = aEntry->mPopupContent->GetDocument();
|
||||||
if (doc)
|
if (doc)
|
||||||
doc->FlushPendingNotifications();
|
doc->FlushPendingNotifications(Flush_OnlyReflow);
|
||||||
|
|
||||||
// make sure we hide the popup. We can't assume that we'll have a view
|
// make sure we hide the popup. We can't assume that we'll have a view
|
||||||
// since we could be cleaning up after someone that didn't correctly
|
// since we could be cleaning up after someone that didn't correctly
|
||||||
|
|
|
@ -1047,11 +1047,7 @@ nsSplitterFrameInner::AdjustChildren(nsIPresContext* aPresContext)
|
||||||
frame->GetOffsetFromView(aPresContext, offset, &view);
|
frame->GetOffsetFromView(aPresContext, offset, &view);
|
||||||
NS_ASSERTION(nsnull != view, "no view");
|
NS_ASSERTION(nsnull != view, "no view");
|
||||||
}
|
}
|
||||||
nsIViewManager* viewManager = view->GetViewManager();
|
aPresContext->PresShell()->FlushPendingNotifications(Flush_Display);
|
||||||
|
|
||||||
viewManager->DisableRefresh();
|
|
||||||
aPresContext->PresShell()->FlushPendingNotifications(PR_FALSE);
|
|
||||||
viewManager->EnableRefresh(NS_VMREFRESH_IMMEDIATE);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nsBoxLayoutState state(aPresContext);
|
nsBoxLayoutState state(aPresContext);
|
||||||
|
|
|
@ -109,10 +109,13 @@ public:
|
||||||
NS_IMETHOD SetParser(nsIParser* aParser)=0;
|
NS_IMETHOD SetParser(nsIParser* aParser)=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush all pending notifications so that the content model
|
* Flush content so that the content model is in sync with the state
|
||||||
* is in sync with the state of the sink.
|
* of the sink.
|
||||||
|
*
|
||||||
|
* @param aNotify true if notifications should be fired in the
|
||||||
|
* process (instead of deferred for now).
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD FlushPendingNotifications()=0;
|
virtual void FlushContent(PRBool aNotify)=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the document character set. This should be passed on to the
|
* Set the document character set. This should be passed on to the
|
||||||
|
|
|
@ -104,7 +104,7 @@ public:
|
||||||
NS_IMETHOD WillInterrupt(void) { return NS_OK; }
|
NS_IMETHOD WillInterrupt(void) { return NS_OK; }
|
||||||
NS_IMETHOD WillResume(void) { return NS_OK; }
|
NS_IMETHOD WillResume(void) { return NS_OK; }
|
||||||
NS_IMETHOD SetParser(nsIParser* aParser) { return NS_OK; }
|
NS_IMETHOD SetParser(nsIParser* aParser) { return NS_OK; }
|
||||||
NS_IMETHOD FlushPendingNotifications() { return NS_OK; }
|
virtual void FlushContent(PRBool aNotify) { }
|
||||||
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
|
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
|
||||||
NS_IMETHOD WillProcessTokens(void) { return NS_OK; }
|
NS_IMETHOD WillProcessTokens(void) { return NS_OK; }
|
||||||
NS_IMETHOD DidProcessTokens(void) { return NS_OK; }
|
NS_IMETHOD DidProcessTokens(void) { return NS_OK; }
|
||||||
|
|
|
@ -72,7 +72,7 @@ public:
|
||||||
NS_IMETHOD AddComment(const nsIParserNode& aNode);
|
NS_IMETHOD AddComment(const nsIParserNode& aNode);
|
||||||
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
|
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
|
||||||
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
|
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
|
||||||
NS_IMETHOD FlushPendingNotifications() { return NS_OK; }
|
virtual void FlushContent(PRBool aNotify) { }
|
||||||
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
|
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
|
||||||
NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
|
NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ public:
|
||||||
NS_IMETHOD WillInterrupt(void);
|
NS_IMETHOD WillInterrupt(void);
|
||||||
NS_IMETHOD WillResume(void);
|
NS_IMETHOD WillResume(void);
|
||||||
NS_IMETHOD SetParser(nsIParser* aParser);
|
NS_IMETHOD SetParser(nsIParser* aParser);
|
||||||
NS_IMETHOD FlushPendingNotifications() { return NS_OK; }
|
virtual void FlushContent(PRBool aNotify) { }
|
||||||
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
|
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
|
||||||
|
|
||||||
// nsIRDFContentSink
|
// nsIRDFContentSink
|
||||||
|
|
|
@ -438,17 +438,8 @@ nsWebCrawler::OnStateChange(nsIWebProgress* aWebProgress,
|
||||||
// Make sure the document bits make it to the screen at least once
|
// Make sure the document bits make it to the screen at least once
|
||||||
nsCOMPtr<nsIPresShell> shell = dont_AddRef(GetPresShell());
|
nsCOMPtr<nsIPresShell> shell = dont_AddRef(GetPresShell());
|
||||||
if (shell) {
|
if (shell) {
|
||||||
// Force the presentation shell to flush any pending reflows
|
// Force the presentation shell to update the display
|
||||||
shell->FlushPendingNotifications(PR_FALSE);
|
shell->FlushPendingNotifications(Flush_Display);
|
||||||
|
|
||||||
// Force the view manager to update itself
|
|
||||||
nsCOMPtr<nsIViewManager> vm;
|
|
||||||
shell->GetViewManager(getter_AddRefs(vm));
|
|
||||||
if (vm) {
|
|
||||||
nsIView* rootView;
|
|
||||||
vm->GetRootView(rootView);
|
|
||||||
vm->UpdateView(rootView, NS_VMREFRESH_IMMEDIATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mJiggleLayout) {
|
if (mJiggleLayout) {
|
||||||
nsRect r;
|
nsRect r;
|
||||||
|
|
|
@ -388,6 +388,7 @@ NS_IMETHODIMP nsContentTreeOwner::SetStatus(PRUint32 aStatusType, const PRUnicha
|
||||||
// XXX: This is nasty because we have to drill down to the nsIDocument to
|
// XXX: This is nasty because we have to drill down to the nsIDocument to
|
||||||
// force the flushing...
|
// force the flushing...
|
||||||
//
|
//
|
||||||
|
// XXXbz no, this is nasty because we're flushing at all!
|
||||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||||
nsCOMPtr<nsIDocument> doc;
|
nsCOMPtr<nsIDocument> doc;
|
||||||
|
|
||||||
|
@ -395,7 +396,7 @@ NS_IMETHODIMP nsContentTreeOwner::SetStatus(PRUint32 aStatusType, const PRUnicha
|
||||||
doc = do_QueryInterface(domDoc);
|
doc = do_QueryInterface(domDoc);
|
||||||
|
|
||||||
if (doc) {
|
if (doc) {
|
||||||
doc->FlushPendingNotifications(PR_TRUE, PR_TRUE);
|
doc->FlushPendingNotifications(Flush_Layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче