From e5c00922658c9b204c80e9f69b2f0c44b6576701 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Mon, 5 Apr 1999 23:32:11 +0000 Subject: [PATCH] Better handling of incremental reflow --- layout/base/nsCSSFrameConstructor.cpp | 25 +++++++++++++++++-- .../html/style/src/nsCSSFrameConstructor.cpp | 25 +++++++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index adf5d9fae9b..f64294eed72 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -3585,8 +3585,29 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, // Notify the parent frame passing it the list of new frames if (NS_SUCCEEDED(result)) { - result = adjustedParentFrame->AppendFrames(*aPresContext, *shell, - nsnull, firstAppendedFrame); + nsIFrame* firstChild; + adjustedParentFrame->FirstChild(nsnull, &firstChild); + nsFrameList frames(firstChild); + + // See if the parent has a :after pseudo-element + nsIFrame* lastChild = frames.LastChild(); + PRBool lastIsGenerated = PR_FALSE; + if (lastChild) { + nsFrameState state; + + lastChild->GetFrameState(&state); + if (state & NS_FRAME_GENERATED_CONTENT) { + lastIsGenerated = PR_TRUE; + } + } + + if (lastIsGenerated) { + result = adjustedParentFrame->InsertFrames(*aPresContext, *shell, + nsnull, lastChild, firstAppendedFrame); + } else { + result = adjustedParentFrame->AppendFrames(*aPresContext, *shell, + nsnull, firstAppendedFrame); + } // If there are new absolutely positioned child frames, then notify // the parent diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index adf5d9fae9b..f64294eed72 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -3585,8 +3585,29 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext, // Notify the parent frame passing it the list of new frames if (NS_SUCCEEDED(result)) { - result = adjustedParentFrame->AppendFrames(*aPresContext, *shell, - nsnull, firstAppendedFrame); + nsIFrame* firstChild; + adjustedParentFrame->FirstChild(nsnull, &firstChild); + nsFrameList frames(firstChild); + + // See if the parent has a :after pseudo-element + nsIFrame* lastChild = frames.LastChild(); + PRBool lastIsGenerated = PR_FALSE; + if (lastChild) { + nsFrameState state; + + lastChild->GetFrameState(&state); + if (state & NS_FRAME_GENERATED_CONTENT) { + lastIsGenerated = PR_TRUE; + } + } + + if (lastIsGenerated) { + result = adjustedParentFrame->InsertFrames(*aPresContext, *shell, + nsnull, lastChild, firstAppendedFrame); + } else { + result = adjustedParentFrame->AppendFrames(*aPresContext, *shell, + nsnull, firstAppendedFrame); + } // If there are new absolutely positioned child frames, then notify // the parent