Make sure that a reflow flush on the document makes the sink start layout if

needed.  Bug 253951, r=mrbkap, sr=jst
This commit is contained in:
bzbarsky%mit.edu 2005-08-24 20:56:58 +00:00
parent 72c36d6c2c
commit 3656444b70
16 changed files with 30 additions and 21 deletions

View File

@ -106,7 +106,7 @@ public:
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode)
{ return NS_OK; }
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
virtual void FlushContent(PRBool aNotify) { }
virtual void FlushPendingNotifications(mozFlushType aType) { }
NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
virtual nsISupports *GetTarget() { return nsnull; }

View File

@ -101,7 +101,7 @@ public:
NS_IMETHOD AddComment(const nsIParserNode& aNode) { return NS_OK; }
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode) { return NS_OK; }
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode) { return NS_OK; }
virtual void FlushContent(PRBool aNotify) { }
virtual void FlushPendingNotifications(mozFlushType aType) { }
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
virtual nsISupports *GetTarget() { return nsnull; }

View File

@ -228,7 +228,7 @@ public:
NS_IMETHOD WillInterrupt(void);
NS_IMETHOD WillResume(void);
NS_IMETHOD SetParser(nsIParser* aParser);
virtual void FlushContent(PRBool aNotify);
virtual void FlushPendingNotifications(mozFlushType aType);
NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
virtual nsISupports *GetTarget();
@ -4220,12 +4220,18 @@ HTMLContentSink::ProcessSTYLETag(const nsIParserNode& aNode)
}
void
HTMLContentSink::FlushContent(PRBool aNotify)
HTMLContentSink::FlushPendingNotifications(mozFlushType aType)
{
// Only flush tags if we're not doing the notification ourselves
// (since we aren't reentrant)
if (mCurrentContext && !mInNotification) {
mCurrentContext->FlushTags(aNotify);
PRBool notify = ((aType & Flush_SinkNotifications) != 0);
mCurrentContext->FlushTags(notify);
if (aType & Flush_OnlyReflow) {
// Make sure that layout has started so that the reflow flush
// will actually happen.
StartLayout();
}
}
}

View File

@ -1213,8 +1213,7 @@ nsHTMLDocument::FlushPendingNotifications(mozFlushType aType)
(!(aType & Flush_SinkNotifications) || IsSafeToFlush())) {
nsCOMPtr<nsIContentSink> sink = mParser->GetContentSink();
if (sink) {
PRBool notify = ((aType & Flush_SinkNotifications) != 0);
sink->FlushContent(notify);
sink->FlushPendingNotifications(aType);
}
}

View File

@ -83,7 +83,7 @@ public:
NS_IMETHOD WillInterrupt(void);
NS_IMETHOD WillResume(void);
NS_IMETHOD SetParser(nsIParser* aParser);
virtual void FlushContent(PRBool aNotify) { }
virtual void FlushPendingNotifications(mozFlushType aType) { }
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
virtual nsISupports *GetTarget() { return mTargetDocument; }

View File

@ -122,9 +122,9 @@ nsLoadSaveContentSink::SetParser(nsIParser* aParser)
}
void
nsLoadSaveContentSink::FlushContent(PRBool aNotify)
nsLoadSaveContentSink::FlushPendingNotifications(mozFlushType aType)
{
mBaseSink->FlushContent(aNotify);
mBaseSink->FlushPendingNotifications(aType);
}
NS_IMETHODIMP

View File

@ -74,7 +74,7 @@ public:
NS_IMETHOD WillInterrupt(void);
NS_IMETHOD WillResume(void);
NS_IMETHOD SetParser(nsIParser* aParser);
virtual void FlushContent(PRBool aNotify);
virtual void FlushPendingNotifications(mozFlushType aType);
NS_IMETHOD SetDocumentCharset(nsAString& aCharset);
private:

View File

@ -84,7 +84,7 @@ public:
NS_IMETHOD WillInterrupt(void);
NS_IMETHOD WillResume(void);
NS_IMETHOD SetParser(nsIParser* aParser);
virtual void FlushContent(PRBool aNotify) { }
virtual void FlushPendingNotifications(mozFlushType aType) { }
NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
virtual nsISupports *GetTarget();

View File

@ -133,7 +133,7 @@ public:
NS_IMETHOD WillInterrupt(void);
NS_IMETHOD WillResume(void);
NS_IMETHOD SetParser(nsIParser* aParser);
virtual void FlushContent(PRBool aNotify) { }
virtual void FlushPendingNotifications(mozFlushType aType) { }
NS_IMETHOD SetDocumentCharset(nsACString& aCharset);
virtual nsISupports *GetTarget();

View File

@ -111,7 +111,7 @@ public:
NS_IMETHOD WillInterrupt(void) { return NS_OK; }
NS_IMETHOD WillResume(void) { return NS_OK; }
NS_IMETHOD SetParser(nsIParser* aParser) { return NS_OK; }
virtual void FlushContent(PRBool aNotify) { }
virtual void FlushPendingNotifications(mozFlushType aType) { }
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
virtual nsISupports *GetTarget() { return nsnull; }

View File

@ -50,11 +50,14 @@
*/
#include "nsISupports.h"
#include "nsString.h"
#include "mozFlushType.h"
class nsIParser;
#define NS_ICONTENT_SINK_IID \
{0x7f459e15, 0xd559, 0x4c50, {0x91, 0x30, 0x3a, 0xe7, 0x31, 0x46, 0x67, 0xa9}}
{ 0x94ec4df1, 0x6885, 0x4b1f, \
{ 0x85, 0x10, 0xe3, 0x5f, 0x4f, 0x36, 0xea, 0xaa } }
// The base value for the content ID counter.
// Values greater than or equal to this base value are used
// by each of the content sinks to assign unique values
@ -111,10 +114,9 @@ public:
* Flush content so that the content model is in sync with the state
* of the sink.
*
* @param aNotify true if notifications should be fired in the
* process (instead of deferred for now).
* @param aType the type of flush to perform
*/
virtual void FlushContent(PRBool aNotify)=0;
virtual void FlushPendingNotifications(mozFlushType aType)=0;
/**
* Set the document character set. This should be passed on to the

View File

@ -53,6 +53,7 @@ REQUIRES = xpcom \
docshell \
uriloader \
unicharutil \
content \
$(NULL)
CPPSRCS = nsDebugRobot.cpp nsRobotSink.cpp

View File

@ -104,7 +104,7 @@ public:
NS_IMETHOD WillInterrupt(void) { return NS_OK; }
NS_IMETHOD WillResume(void) { return NS_OK; }
NS_IMETHOD SetParser(nsIParser* aParser) { return NS_OK; }
virtual void FlushContent(PRBool aNotify) { }
virtual void FlushPendingNotifications(mozFlushType aType) { }
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
virtual nsISupports *GetTarget() { return nsnull; }
NS_IMETHOD WillProcessTokens(void) { return NS_OK; }

View File

@ -72,7 +72,7 @@ public:
NS_IMETHOD AddComment(const nsIParserNode& aNode);
NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
virtual void FlushContent(PRBool aNotify) { }
virtual void FlushPendingNotifications(mozFlushType aType) { }
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
virtual nsISupports *GetTarget() { return nsnull; }

View File

@ -49,6 +49,7 @@ PROGRAM = TestParser$(BIN_SUFFIX)
REQUIRES = xpcom \
string \
necko \
content \
$(NULL)
CPPSRCS = \

View File

@ -165,7 +165,7 @@ public:
NS_IMETHOD WillInterrupt(void);
NS_IMETHOD WillResume(void);
NS_IMETHOD SetParser(nsIParser* aParser);
virtual void FlushContent(PRBool aNotify) { }
virtual void FlushPendingNotifications(mozFlushType aType) { }
NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
virtual nsISupports *GetTarget() { return nsnull; }