From a595e9b30a5631db40290c19a5eb030bde910974 Mon Sep 17 00:00:00 2001 From: "vidur%netscape.com" Date: Fri, 29 Oct 1999 19:07:24 +0000 Subject: [PATCH] Fix for double frame creation for scripts that document.write content that causes sink context creation. Fix that allows the last children of a body to be flushed. R=harishd git-svn-id: svn://10.0.0.236/trunk@52232 18797224-902f-48f8-a5cc-f745e15eee43 --- .../content/html/document/src/nsHTMLContentSink.cpp | 13 +++++-------- .../layout/html/document/src/nsHTMLContentSink.cpp | 13 +++++-------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index 531820a5ae8..c6c04586e86 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -1066,7 +1066,7 @@ SinkContext::DidAddContent(nsIContent* aContent, PRBool aDidNotify) // If we just added content to a node for which // an insertion happen, we need to do an immediate // notification for that insertion. - if ((0 < mStackPos) && + if (!aDidNotify && (0 < mStackPos) && (mStack[mStackPos-1].mInsertionPoint != -1)) { nsIContent* parent = mStack[mStackPos-1].mContent; @@ -2328,15 +2328,12 @@ HTMLContentSink::CloseBody(const nsIParserNode& aNode) NS_STOP_STOPWATCH(mWatch) return rv; } + // Flush out anything that's left + SINK_TRACE(SINK_TRACE_REFLOW, + ("HTMLContentSink::CloseBody: layout final body content")); + mCurrentContext->FlushTags(); mCurrentContext->CloseContainer(aNode); - if (didFlush) { - SINK_TRACE(SINK_TRACE_REFLOW, - ("HTMLContentSink::CloseBody: layout final body text")); - // Trigger a reflow for the flushed text - mCurrentContext->FlushTags(); - } - RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseBody()\n")); NS_STOP_STOPWATCH(mWatch) return NS_OK; diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp index 531820a5ae8..c6c04586e86 100644 --- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp @@ -1066,7 +1066,7 @@ SinkContext::DidAddContent(nsIContent* aContent, PRBool aDidNotify) // If we just added content to a node for which // an insertion happen, we need to do an immediate // notification for that insertion. - if ((0 < mStackPos) && + if (!aDidNotify && (0 < mStackPos) && (mStack[mStackPos-1].mInsertionPoint != -1)) { nsIContent* parent = mStack[mStackPos-1].mContent; @@ -2328,15 +2328,12 @@ HTMLContentSink::CloseBody(const nsIParserNode& aNode) NS_STOP_STOPWATCH(mWatch) return rv; } + // Flush out anything that's left + SINK_TRACE(SINK_TRACE_REFLOW, + ("HTMLContentSink::CloseBody: layout final body content")); + mCurrentContext->FlushTags(); mCurrentContext->CloseContainer(aNode); - if (didFlush) { - SINK_TRACE(SINK_TRACE_REFLOW, - ("HTMLContentSink::CloseBody: layout final body text")); - // Trigger a reflow for the flushed text - mCurrentContext->FlushTags(); - } - RAPTOR_STOPWATCH_DEBUGTRACE(("Stop: nsHTMLContentSink::CloseBody()\n")); NS_STOP_STOPWATCH(mWatch) return NS_OK;