From f1e9e67f667ef8bda3cbf25ac807d2223a971002 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Thu, 7 Jan 1999 05:03:53 +0000 Subject: [PATCH] Changed ContentRemoved() to also generate a reflow command for the placeholder for an absolutely positioned frame. Also made sure the child list name is properly set for the reflow command for the absolutely positioned frame git-svn-id: svn://10.0.0.236/trunk@17303 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/style/src/nsHTMLStyleSheet.cpp | 63 +++++++++++++++---- .../html/style/src/nsHTMLStyleSheet.cpp | 63 +++++++++++++++---- mozilla/layout/style/nsHTMLStyleSheet.cpp | 63 +++++++++++++++---- 3 files changed, 150 insertions(+), 39 deletions(-) diff --git a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp index ee12c210a40..9ad158d09a0 100644 --- a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp @@ -2571,21 +2571,58 @@ HTMLStyleSheetImpl::ContentRemoved(nsIPresContext* aPresContext, shell->GetPrimaryFrameFor(aChild, childFrame); if (nsnull != childFrame) { - // Get the parent frame. - // Note that we use the content parent, and not the geometric parent, - // in case the frame has been moved out of the flow... - nsIFrame* parentFrame; - childFrame->GetContentParent(parentFrame); - NS_ASSERTION(nsnull != parentFrame, "null content parent frame"); + // See if it's absolutely positioned + const nsStylePosition* position; + childFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position); + if (NS_STYLE_POSITION_ABSOLUTE == position->mPosition) { + // Generate two reflow commands. First for the absolutely positioned + // frame and then for its placeholder frame + nsIFrame* parentFrame; + childFrame->GetGeometricParent(parentFrame); + + // Notify the parent frame with a reflow command. + nsIReflowCommand* reflowCmd; + rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame, + nsIReflowCommand::FrameRemoved, childFrame); + + if (NS_SUCCEEDED(rv)) { + reflowCmd->SetChildListName(nsLayoutAtoms::absoluteList); + shell->AppendReflowCommand(reflowCmd); + NS_RELEASE(reflowCmd); + } - // Notify the parent frame with a reflow command. - nsIReflowCommand* reflowCmd; - rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame, - nsIReflowCommand::FrameRemoved, childFrame); + // Now the placeholder frame + nsIFrame* placeholderFrame; - if (NS_SUCCEEDED(rv)) { - shell->AppendReflowCommand(reflowCmd); - NS_RELEASE(reflowCmd); + shell->GetPlaceholderFrameFor(childFrame, placeholderFrame); + if (nsnull != placeholderFrame) { + placeholderFrame->GetGeometricParent(parentFrame); + rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame, + nsIReflowCommand::FrameRemoved, placeholderFrame); + + if (NS_SUCCEEDED(rv)) { + shell->AppendReflowCommand(reflowCmd); + NS_RELEASE(reflowCmd); + } + } + + } else { + // Get the parent frame. + // Note that we use the content parent, and not the geometric parent, + // in case the frame has been moved out of the flow... + nsIFrame* parentFrame; + childFrame->GetContentParent(parentFrame); + NS_ASSERTION(nsnull != parentFrame, "null content parent frame"); + + // Notify the parent frame with a reflow command. + nsIReflowCommand* reflowCmd; + rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame, + nsIReflowCommand::FrameRemoved, childFrame); + + if (NS_SUCCEEDED(rv)) { + shell->AppendReflowCommand(reflowCmd); + NS_RELEASE(reflowCmd); + } } } diff --git a/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp b/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp index ee12c210a40..9ad158d09a0 100644 --- a/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp +++ b/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp @@ -2571,21 +2571,58 @@ HTMLStyleSheetImpl::ContentRemoved(nsIPresContext* aPresContext, shell->GetPrimaryFrameFor(aChild, childFrame); if (nsnull != childFrame) { - // Get the parent frame. - // Note that we use the content parent, and not the geometric parent, - // in case the frame has been moved out of the flow... - nsIFrame* parentFrame; - childFrame->GetContentParent(parentFrame); - NS_ASSERTION(nsnull != parentFrame, "null content parent frame"); + // See if it's absolutely positioned + const nsStylePosition* position; + childFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position); + if (NS_STYLE_POSITION_ABSOLUTE == position->mPosition) { + // Generate two reflow commands. First for the absolutely positioned + // frame and then for its placeholder frame + nsIFrame* parentFrame; + childFrame->GetGeometricParent(parentFrame); + + // Notify the parent frame with a reflow command. + nsIReflowCommand* reflowCmd; + rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame, + nsIReflowCommand::FrameRemoved, childFrame); + + if (NS_SUCCEEDED(rv)) { + reflowCmd->SetChildListName(nsLayoutAtoms::absoluteList); + shell->AppendReflowCommand(reflowCmd); + NS_RELEASE(reflowCmd); + } - // Notify the parent frame with a reflow command. - nsIReflowCommand* reflowCmd; - rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame, - nsIReflowCommand::FrameRemoved, childFrame); + // Now the placeholder frame + nsIFrame* placeholderFrame; - if (NS_SUCCEEDED(rv)) { - shell->AppendReflowCommand(reflowCmd); - NS_RELEASE(reflowCmd); + shell->GetPlaceholderFrameFor(childFrame, placeholderFrame); + if (nsnull != placeholderFrame) { + placeholderFrame->GetGeometricParent(parentFrame); + rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame, + nsIReflowCommand::FrameRemoved, placeholderFrame); + + if (NS_SUCCEEDED(rv)) { + shell->AppendReflowCommand(reflowCmd); + NS_RELEASE(reflowCmd); + } + } + + } else { + // Get the parent frame. + // Note that we use the content parent, and not the geometric parent, + // in case the frame has been moved out of the flow... + nsIFrame* parentFrame; + childFrame->GetContentParent(parentFrame); + NS_ASSERTION(nsnull != parentFrame, "null content parent frame"); + + // Notify the parent frame with a reflow command. + nsIReflowCommand* reflowCmd; + rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame, + nsIReflowCommand::FrameRemoved, childFrame); + + if (NS_SUCCEEDED(rv)) { + shell->AppendReflowCommand(reflowCmd); + NS_RELEASE(reflowCmd); + } } } diff --git a/mozilla/layout/style/nsHTMLStyleSheet.cpp b/mozilla/layout/style/nsHTMLStyleSheet.cpp index ee12c210a40..9ad158d09a0 100644 --- a/mozilla/layout/style/nsHTMLStyleSheet.cpp +++ b/mozilla/layout/style/nsHTMLStyleSheet.cpp @@ -2571,21 +2571,58 @@ HTMLStyleSheetImpl::ContentRemoved(nsIPresContext* aPresContext, shell->GetPrimaryFrameFor(aChild, childFrame); if (nsnull != childFrame) { - // Get the parent frame. - // Note that we use the content parent, and not the geometric parent, - // in case the frame has been moved out of the flow... - nsIFrame* parentFrame; - childFrame->GetContentParent(parentFrame); - NS_ASSERTION(nsnull != parentFrame, "null content parent frame"); + // See if it's absolutely positioned + const nsStylePosition* position; + childFrame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position); + if (NS_STYLE_POSITION_ABSOLUTE == position->mPosition) { + // Generate two reflow commands. First for the absolutely positioned + // frame and then for its placeholder frame + nsIFrame* parentFrame; + childFrame->GetGeometricParent(parentFrame); + + // Notify the parent frame with a reflow command. + nsIReflowCommand* reflowCmd; + rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame, + nsIReflowCommand::FrameRemoved, childFrame); + + if (NS_SUCCEEDED(rv)) { + reflowCmd->SetChildListName(nsLayoutAtoms::absoluteList); + shell->AppendReflowCommand(reflowCmd); + NS_RELEASE(reflowCmd); + } - // Notify the parent frame with a reflow command. - nsIReflowCommand* reflowCmd; - rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame, - nsIReflowCommand::FrameRemoved, childFrame); + // Now the placeholder frame + nsIFrame* placeholderFrame; - if (NS_SUCCEEDED(rv)) { - shell->AppendReflowCommand(reflowCmd); - NS_RELEASE(reflowCmd); + shell->GetPlaceholderFrameFor(childFrame, placeholderFrame); + if (nsnull != placeholderFrame) { + placeholderFrame->GetGeometricParent(parentFrame); + rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame, + nsIReflowCommand::FrameRemoved, placeholderFrame); + + if (NS_SUCCEEDED(rv)) { + shell->AppendReflowCommand(reflowCmd); + NS_RELEASE(reflowCmd); + } + } + + } else { + // Get the parent frame. + // Note that we use the content parent, and not the geometric parent, + // in case the frame has been moved out of the flow... + nsIFrame* parentFrame; + childFrame->GetContentParent(parentFrame); + NS_ASSERTION(nsnull != parentFrame, "null content parent frame"); + + // Notify the parent frame with a reflow command. + nsIReflowCommand* reflowCmd; + rv = NS_NewHTMLReflowCommand(&reflowCmd, parentFrame, + nsIReflowCommand::FrameRemoved, childFrame); + + if (NS_SUCCEEDED(rv)) { + shell->AppendReflowCommand(reflowCmd); + NS_RELEASE(reflowCmd); + } } }