From 583682a5c16de2841cab00dbe9f1d5a6a791899e Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Tue, 29 Dec 1998 04:45:18 +0000 Subject: [PATCH] Renamed FindFrameWithContent() to GetPrimaryFrameFor() --- content/base/src/nsGenericElement.cpp | 2 +- .../html/content/src/nsHTMLFormElement.cpp | 6 ++-- .../content/src/nsHTMLTableRowElement.cpp | 3 +- .../html/document/src/nsHTMLContentSink.cpp | 3 +- content/html/style/src/nsHTMLStyleSheet.cpp | 23 +++++++++------ layout/base/nsIPresShell.h | 20 +++++++++++-- layout/base/nsPresContext.cpp | 2 +- layout/base/nsPresShell.cpp | 28 +++++++++++-------- layout/base/public/nsIPresShell.h | 20 +++++++++++-- layout/base/src/nsGenericElement.cpp | 2 +- layout/base/src/nsPresContext.cpp | 2 +- layout/generic/nsFrame.cpp | 11 +++++--- layout/generic/nsHTMLReflowCommand.cpp | 4 ++- layout/html/base/src/nsFrame.cpp | 11 +++++--- layout/html/base/src/nsHTMLReflowCommand.cpp | 4 ++- layout/html/base/src/nsPresShell.cpp | 28 +++++++++++-------- layout/html/content/src/nsHTMLFormElement.cpp | 6 ++-- .../content/src/nsHTMLTableRowElement.cpp | 3 +- .../html/document/src/nsHTMLContentSink.cpp | 3 +- layout/html/forms/src/nsLabelFrame.cpp | 3 +- layout/html/style/src/nsHTMLStyleSheet.cpp | 23 +++++++++------ layout/style/nsHTMLStyleSheet.cpp | 23 +++++++++------ webshell/tests/viewer/nsBrowserWindow.cpp | 8 ++++-- webshell/tests/viewer/nsWebCrawler.cpp | 3 +- 24 files changed, 162 insertions(+), 79 deletions(-) diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index c75acec12ead..b4bd9582f689 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -1098,7 +1098,7 @@ nsGenericElement::RenderFrame() nsIPresShell* shell; shell = mDocument->GetShellAt(i); nsIFrame* frame; - frame = shell->FindFrameWithContent(mContent); + shell->GetPrimaryFrameFor(mContent, frame); while (nsnull != frame) { nsIViewManager* vm; nsIView* view; diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index 61e4bff81db0..5de938567de4 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -276,7 +276,8 @@ nsHTMLFormElement::Submit() if ((NS_OK == result) && doc) { nsIPresShell *shell = doc->GetShellAt(0); if (nsnull != shell) { - nsIFrame* frame = shell->FindFrameWithContent(this); + nsIFrame* frame; + shell->GetPrimaryFrameFor(this, frame); if (frame) { nsIFormManager* formMan = nsnull; nsresult result = frame->QueryInterface(kIFormManagerIID, (void**)&formMan); @@ -309,7 +310,8 @@ nsHTMLFormElement::Reset() if ((NS_OK == result) && doc) { nsIPresShell *shell = doc->GetShellAt(0); if (nsnull != shell) { - nsIFrame* frame = shell->FindFrameWithContent(this); + nsIFrame* frame; + shell->GetPrimaryFrameFor(this, frame); if (frame) { nsIFormManager* formMan = nsnull; nsresult result = frame->QueryInterface(kIFormManagerIID, (void**)&formMan); diff --git a/content/html/content/src/nsHTMLTableRowElement.cpp b/content/html/content/src/nsHTMLTableRowElement.cpp index 1e41b39551b9..b6b36891e2d2 100644 --- a/content/html/content/src/nsHTMLTableRowElement.cpp +++ b/content/html/content/src/nsHTMLTableRowElement.cpp @@ -117,7 +117,8 @@ void TempList(nsIDOMHTMLTableElement* aTable) { } nsIPresShell* shell = doc->GetShellAt(0); if (nsnull != shell) { - nsIFrame* rootFrame = shell->GetRootFrame(); + nsIFrame* rootFrame; + shell->GetRootFrame(rootFrame); if (nsnull != rootFrame) { rootFrame->List(stdout, 0, nsnull); } diff --git a/content/html/document/src/nsHTMLContentSink.cpp b/content/html/document/src/nsHTMLContentSink.cpp index 3cc946fe16e6..90825614ea4c 100644 --- a/content/html/document/src/nsHTMLContentSink.cpp +++ b/content/html/document/src/nsHTMLContentSink.cpp @@ -1941,7 +1941,8 @@ HTMLContentSink::ScrollToRef() for (i = 0; i < ns; i++) { nsIPresShell* shell = mDocument->GetShellAt(i); if (nsnull != shell) { - nsIFrame* frame = shell->FindFrameWithContent(mRefContent); + nsIFrame* frame; + shell->GetPrimaryFrameFor(mRefContent, frame); if (nsnull != frame) { nsIViewManager* vm = shell->GetViewManager(); if (nsnull != vm) { diff --git a/content/html/style/src/nsHTMLStyleSheet.cpp b/content/html/style/src/nsHTMLStyleSheet.cpp index 959f0239f36b..a67f73beb5d0 100644 --- a/content/html/style/src/nsHTMLStyleSheet.cpp +++ b/content/html/style/src/nsHTMLStyleSheet.cpp @@ -2207,7 +2207,9 @@ nsIFrame* HTMLStyleSheetImpl::GetFrameFor(nsIPresShell* aPresShell, nsIPresContext* aPresContext, nsIContent* aContent) { - nsIFrame* frame = aPresShell->FindFrameWithContent(aContent); + // Get the primary frame associated with the content + nsIFrame* frame; + aPresShell->GetPrimaryFrameFor(aContent, frame); if (nsnull != frame) { // If the primary frame is a scroll frame, then get the scrolled frame. @@ -2375,7 +2377,7 @@ FindPreviousSibling(nsIPresShell* aPresShell, for (PRInt32 index = aIndexInContainer - 1; index >= 0; index--) { nsIContent* precedingContent; aContainer->ChildAt(index, precedingContent); - prevSibling = aPresShell->FindFrameWithContent(precedingContent); + aPresShell->GetPrimaryFrameFor(precedingContent, prevSibling); NS_RELEASE(precedingContent); if (nsnull != prevSibling) { @@ -2409,7 +2411,7 @@ FindNextSibling(nsIPresShell* aPresShell, for (PRInt32 index = aIndexInContainer + 1; index < count; index++) { nsIContent* nextContent; aContainer->ChildAt(index, nextContent); - nextSibling = aPresShell->FindFrameWithContent(nextContent); + aPresShell->GetPrimaryFrameFor(nextContent, nextSibling); NS_RELEASE(nextContent); if (nsnull != nextSibling) { @@ -2454,7 +2456,7 @@ HTMLStyleSheetImpl::ContentInserted(nsIPresContext* aPresContext, // XXX This won't always be true if there's auto-generated before/after // content isAppend = PR_TRUE; - parentFrame = shell->FindFrameWithContent(aContainer); + shell->GetPrimaryFrameFor(aContainer, parentFrame); } else { // Use the prev sibling if we have it; otherwise use the next sibling. @@ -2544,7 +2546,8 @@ HTMLStyleSheetImpl::ContentRemoved(nsIPresContext* aPresContext, nsresult rv = NS_OK; // Find the child frame - nsIFrame* childFrame = shell->FindFrameWithContent(aChild); + nsIFrame* childFrame; + shell->GetPrimaryFrameFor(aChild, childFrame); if (nsnull != childFrame) { // Get the parent frame. @@ -2645,7 +2648,8 @@ HTMLStyleSheetImpl::ContentChanged(nsIPresContext* aPresContext, nsresult rv = NS_OK; // Find the child frame - nsIFrame* frame = shell->FindFrameWithContent(aContent); + nsIFrame* frame; + shell->GetPrimaryFrameFor(aContent, frame); // Notify the first frame that maps the content. It will generate a reflow // command @@ -2675,7 +2679,9 @@ HTMLStyleSheetImpl::AttributeChanged(nsIPresContext* aPresContext, nsresult result = NS_OK; nsIPresShell* shell = aPresContext->GetShell(); - nsIFrame* frame = shell->FindFrameWithContent(aContent); + nsIFrame* frame; + + shell->GetPrimaryFrameFor(aContent, frame); if (nsnull != frame) { PRBool restyle = PR_FALSE; @@ -2755,7 +2761,8 @@ HTMLStyleSheetImpl::StyleRuleChanged(nsIPresContext* aPresContext, PRInt32 aHint) { nsIPresShell* shell = aPresContext->GetShell(); - nsIFrame* frame = shell->GetRootFrame(); + nsIFrame* frame; + shell->GetRootFrame(frame); PRBool reframe = PR_FALSE; PRBool reflow = PR_FALSE; diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 7460c44dcbed..140329da7bf7 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -99,15 +99,29 @@ public: */ NS_IMETHOD StyleChangeReflow() = 0; - virtual nsIFrame* GetRootFrame() = 0; + NS_IMETHOD GetRootFrame(nsIFrame*& aFrame) const = 0; /** * Returns the page sequence frame associated with the frame hierarchy. * Returns NULL if not a paginated view. */ - NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame*& aPageSequenceFrame) = 0; + NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame*& aPageSequenceFrame) const = 0; - virtual nsIFrame* FindFrameWithContent(nsIContent* aContent) = 0; + /** + * Returns the primary frame associated with the content object. + * + * The primary frame is the frame that is most closely associated with the + * content. A frame is more closely associated with the content that another + * frame if the one frame contains directly or indirectly the other frame (e.g., + * when a frame is scrolled there is a scroll frame that contains the frame + * being scrolled). The primary frame is always the first-in-flow. + * + * In the case of absolutely positioned elements and floated elements, + * the primary frame is the frame that is out of the flow and not the + * placeholder frame. + */ + NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent, + nsIFrame*& aPrimaryFrame) const = 0; /** * Get/Set the placeholder frame associated with the specified frame. diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 1f283ec384ba..c21c9a9262cd 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -190,7 +190,7 @@ nsPresContext::PreferenceChanged(const char* aPrefName) nsIFrame* rootFrame; nsIStyleContext* rootStyleContext; - rootFrame = mShell->GetRootFrame(); + mShell->GetRootFrame(rootFrame); if (nsnull != rootFrame) { rootFrame->GetStyleContext(rootStyleContext); rootStyleContext->RemapStyle(this); diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index f8fca69d63a1..0425b38f10b7 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -238,9 +238,9 @@ public: NS_IMETHOD InitialReflow(nscoord aWidth, nscoord aHeight); NS_IMETHOD ResizeReflow(nscoord aWidth, nscoord aHeight); NS_IMETHOD StyleChangeReflow(); - virtual nsIFrame* GetRootFrame(); - NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame*& aPageSequenceFrame); - virtual nsIFrame* FindFrameWithContent(nsIContent* aContent); + NS_IMETHOD GetRootFrame(nsIFrame*& aFrame) const; + NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame*& aPageSequenceFrame) const; + NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent, nsIFrame*& aPrimaryFrame) const; NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame, nsIFrame*& aPlaceholderFrame) const; NS_IMETHOD SetPlaceholderFrameFor(nsIFrame* aFrame, @@ -751,14 +751,15 @@ PresShell::StyleChangeReflow() return NS_OK; //XXX this needs to be real. MMP } -nsIFrame* -PresShell::GetRootFrame() +NS_IMETHODIMP +PresShell::GetRootFrame(nsIFrame*& aFrame) const { - return mRootFrame; + aFrame = mRootFrame; + return NS_OK; } NS_IMETHODIMP -PresShell::GetPageSequenceFrame(nsIPageSequenceFrame*& aPageSequenceFrame) +PresShell::GetPageSequenceFrame(nsIPageSequenceFrame*& aPageSequenceFrame) const { nsIFrame* child; nsIPageSequenceFrame* pageSequence; @@ -1184,12 +1185,13 @@ FindFrameWithContent(nsIFrame* aFrame, nsIContent* aContent) return nsnull; } -nsIFrame* -PresShell::FindFrameWithContent(nsIContent* aContent) +NS_IMETHODIMP +PresShell::GetPrimaryFrameFor(nsIContent* aContent, nsIFrame*& aPrimaryFrame) const { // For the time being do a brute force depth-first search of // the frame tree - return ::FindFrameWithContent(mRootFrame, aContent); + aPrimaryFrame = ::FindFrameWithContent(mRootFrame, aContent); + return NS_OK; } NS_IMETHODIMP @@ -1628,7 +1630,11 @@ PresShell::VerifyIncrementalReflow() // Now that the document has been reflowed, use its frame tree to // compare against our frame tree. - CompareTrees(GetRootFrame(), sh->GetRootFrame()); + nsIFrame* root1; + nsIFrame* root2; + GetRootFrame(root1); + sh->GetRootFrame(root2); + CompareTrees(root1, root2); NS_RELEASE(vm); NS_RELEASE(cx); diff --git a/layout/base/public/nsIPresShell.h b/layout/base/public/nsIPresShell.h index 7460c44dcbed..140329da7bf7 100644 --- a/layout/base/public/nsIPresShell.h +++ b/layout/base/public/nsIPresShell.h @@ -99,15 +99,29 @@ public: */ NS_IMETHOD StyleChangeReflow() = 0; - virtual nsIFrame* GetRootFrame() = 0; + NS_IMETHOD GetRootFrame(nsIFrame*& aFrame) const = 0; /** * Returns the page sequence frame associated with the frame hierarchy. * Returns NULL if not a paginated view. */ - NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame*& aPageSequenceFrame) = 0; + NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame*& aPageSequenceFrame) const = 0; - virtual nsIFrame* FindFrameWithContent(nsIContent* aContent) = 0; + /** + * Returns the primary frame associated with the content object. + * + * The primary frame is the frame that is most closely associated with the + * content. A frame is more closely associated with the content that another + * frame if the one frame contains directly or indirectly the other frame (e.g., + * when a frame is scrolled there is a scroll frame that contains the frame + * being scrolled). The primary frame is always the first-in-flow. + * + * In the case of absolutely positioned elements and floated elements, + * the primary frame is the frame that is out of the flow and not the + * placeholder frame. + */ + NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent, + nsIFrame*& aPrimaryFrame) const = 0; /** * Get/Set the placeholder frame associated with the specified frame. diff --git a/layout/base/src/nsGenericElement.cpp b/layout/base/src/nsGenericElement.cpp index c75acec12ead..b4bd9582f689 100644 --- a/layout/base/src/nsGenericElement.cpp +++ b/layout/base/src/nsGenericElement.cpp @@ -1098,7 +1098,7 @@ nsGenericElement::RenderFrame() nsIPresShell* shell; shell = mDocument->GetShellAt(i); nsIFrame* frame; - frame = shell->FindFrameWithContent(mContent); + shell->GetPrimaryFrameFor(mContent, frame); while (nsnull != frame) { nsIViewManager* vm; nsIView* view; diff --git a/layout/base/src/nsPresContext.cpp b/layout/base/src/nsPresContext.cpp index 1f283ec384ba..c21c9a9262cd 100644 --- a/layout/base/src/nsPresContext.cpp +++ b/layout/base/src/nsPresContext.cpp @@ -190,7 +190,7 @@ nsPresContext::PreferenceChanged(const char* aPrefName) nsIFrame* rootFrame; nsIStyleContext* rootStyleContext; - rootFrame = mShell->GetRootFrame(); + mShell->GetRootFrame(rootFrame); if (nsnull != rootFrame) { rootFrame->GetStyleContext(rootStyleContext); rootStyleContext->RemapStyle(this); diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index cfddc0c14486..2c299117dc42 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1888,8 +1888,10 @@ static void RefreshContentFrames(nsIPresContext& aPresContext, //------------------------------------- // Undraw all the current selected frames // XXX Kludge for now - nsIPresShell * shell = aPresContext.GetShell(); - nsIFrame * rootFrame = shell->GetRootFrame(); + nsIPresShell *shell = aPresContext.GetShell(); + nsIFrame *rootFrame; + + shell->GetRootFrame(rootFrame); PRBool foundStart = PR_FALSE; for (PRInt32 i=0;iGetRootFrame(); + nsIPresShell *shell = aPresContext.GetShell(); + nsIFrame *rootFrame; + shell->GetRootFrame(rootFrame); for (i=0;iFindFrameWithContent(fTrackerContentArrayRemoveList[i])); diff --git a/layout/generic/nsHTMLReflowCommand.cpp b/layout/generic/nsHTMLReflowCommand.cpp index 9e8d3d2997b7..8c99e4559b76 100644 --- a/layout/generic/nsHTMLReflowCommand.cpp +++ b/layout/generic/nsHTMLReflowCommand.cpp @@ -144,7 +144,9 @@ NS_IMETHODIMP nsHTMLReflowCommand::Dispatch(nsIPresContext& aPresContext, #ifdef NS_DEBUG nsIPresShell* shell = aPresContext.GetShell(); if (nsnull != shell) { - NS_ASSERTION(shell->GetRootFrame() == root, "bad root frame"); + nsIFrame* rootFrame; + shell->GetRootFrame(rootFrame); + NS_ASSERTION(rootFrame == root, "bad root frame"); NS_RELEASE(shell); } #endif diff --git a/layout/html/base/src/nsFrame.cpp b/layout/html/base/src/nsFrame.cpp index cfddc0c14486..2c299117dc42 100644 --- a/layout/html/base/src/nsFrame.cpp +++ b/layout/html/base/src/nsFrame.cpp @@ -1888,8 +1888,10 @@ static void RefreshContentFrames(nsIPresContext& aPresContext, //------------------------------------- // Undraw all the current selected frames // XXX Kludge for now - nsIPresShell * shell = aPresContext.GetShell(); - nsIFrame * rootFrame = shell->GetRootFrame(); + nsIPresShell *shell = aPresContext.GetShell(); + nsIFrame *rootFrame; + + shell->GetRootFrame(rootFrame); PRBool foundStart = PR_FALSE; for (PRInt32 i=0;iGetRootFrame(); + nsIPresShell *shell = aPresContext.GetShell(); + nsIFrame *rootFrame; + shell->GetRootFrame(rootFrame); for (i=0;iFindFrameWithContent(fTrackerContentArrayRemoveList[i])); diff --git a/layout/html/base/src/nsHTMLReflowCommand.cpp b/layout/html/base/src/nsHTMLReflowCommand.cpp index 9e8d3d2997b7..8c99e4559b76 100644 --- a/layout/html/base/src/nsHTMLReflowCommand.cpp +++ b/layout/html/base/src/nsHTMLReflowCommand.cpp @@ -144,7 +144,9 @@ NS_IMETHODIMP nsHTMLReflowCommand::Dispatch(nsIPresContext& aPresContext, #ifdef NS_DEBUG nsIPresShell* shell = aPresContext.GetShell(); if (nsnull != shell) { - NS_ASSERTION(shell->GetRootFrame() == root, "bad root frame"); + nsIFrame* rootFrame; + shell->GetRootFrame(rootFrame); + NS_ASSERTION(rootFrame == root, "bad root frame"); NS_RELEASE(shell); } #endif diff --git a/layout/html/base/src/nsPresShell.cpp b/layout/html/base/src/nsPresShell.cpp index f8fca69d63a1..0425b38f10b7 100644 --- a/layout/html/base/src/nsPresShell.cpp +++ b/layout/html/base/src/nsPresShell.cpp @@ -238,9 +238,9 @@ public: NS_IMETHOD InitialReflow(nscoord aWidth, nscoord aHeight); NS_IMETHOD ResizeReflow(nscoord aWidth, nscoord aHeight); NS_IMETHOD StyleChangeReflow(); - virtual nsIFrame* GetRootFrame(); - NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame*& aPageSequenceFrame); - virtual nsIFrame* FindFrameWithContent(nsIContent* aContent); + NS_IMETHOD GetRootFrame(nsIFrame*& aFrame) const; + NS_IMETHOD GetPageSequenceFrame(nsIPageSequenceFrame*& aPageSequenceFrame) const; + NS_IMETHOD GetPrimaryFrameFor(nsIContent* aContent, nsIFrame*& aPrimaryFrame) const; NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame, nsIFrame*& aPlaceholderFrame) const; NS_IMETHOD SetPlaceholderFrameFor(nsIFrame* aFrame, @@ -751,14 +751,15 @@ PresShell::StyleChangeReflow() return NS_OK; //XXX this needs to be real. MMP } -nsIFrame* -PresShell::GetRootFrame() +NS_IMETHODIMP +PresShell::GetRootFrame(nsIFrame*& aFrame) const { - return mRootFrame; + aFrame = mRootFrame; + return NS_OK; } NS_IMETHODIMP -PresShell::GetPageSequenceFrame(nsIPageSequenceFrame*& aPageSequenceFrame) +PresShell::GetPageSequenceFrame(nsIPageSequenceFrame*& aPageSequenceFrame) const { nsIFrame* child; nsIPageSequenceFrame* pageSequence; @@ -1184,12 +1185,13 @@ FindFrameWithContent(nsIFrame* aFrame, nsIContent* aContent) return nsnull; } -nsIFrame* -PresShell::FindFrameWithContent(nsIContent* aContent) +NS_IMETHODIMP +PresShell::GetPrimaryFrameFor(nsIContent* aContent, nsIFrame*& aPrimaryFrame) const { // For the time being do a brute force depth-first search of // the frame tree - return ::FindFrameWithContent(mRootFrame, aContent); + aPrimaryFrame = ::FindFrameWithContent(mRootFrame, aContent); + return NS_OK; } NS_IMETHODIMP @@ -1628,7 +1630,11 @@ PresShell::VerifyIncrementalReflow() // Now that the document has been reflowed, use its frame tree to // compare against our frame tree. - CompareTrees(GetRootFrame(), sh->GetRootFrame()); + nsIFrame* root1; + nsIFrame* root2; + GetRootFrame(root1); + sh->GetRootFrame(root2); + CompareTrees(root1, root2); NS_RELEASE(vm); NS_RELEASE(cx); diff --git a/layout/html/content/src/nsHTMLFormElement.cpp b/layout/html/content/src/nsHTMLFormElement.cpp index 61e4bff81db0..5de938567de4 100644 --- a/layout/html/content/src/nsHTMLFormElement.cpp +++ b/layout/html/content/src/nsHTMLFormElement.cpp @@ -276,7 +276,8 @@ nsHTMLFormElement::Submit() if ((NS_OK == result) && doc) { nsIPresShell *shell = doc->GetShellAt(0); if (nsnull != shell) { - nsIFrame* frame = shell->FindFrameWithContent(this); + nsIFrame* frame; + shell->GetPrimaryFrameFor(this, frame); if (frame) { nsIFormManager* formMan = nsnull; nsresult result = frame->QueryInterface(kIFormManagerIID, (void**)&formMan); @@ -309,7 +310,8 @@ nsHTMLFormElement::Reset() if ((NS_OK == result) && doc) { nsIPresShell *shell = doc->GetShellAt(0); if (nsnull != shell) { - nsIFrame* frame = shell->FindFrameWithContent(this); + nsIFrame* frame; + shell->GetPrimaryFrameFor(this, frame); if (frame) { nsIFormManager* formMan = nsnull; nsresult result = frame->QueryInterface(kIFormManagerIID, (void**)&formMan); diff --git a/layout/html/content/src/nsHTMLTableRowElement.cpp b/layout/html/content/src/nsHTMLTableRowElement.cpp index 1e41b39551b9..b6b36891e2d2 100644 --- a/layout/html/content/src/nsHTMLTableRowElement.cpp +++ b/layout/html/content/src/nsHTMLTableRowElement.cpp @@ -117,7 +117,8 @@ void TempList(nsIDOMHTMLTableElement* aTable) { } nsIPresShell* shell = doc->GetShellAt(0); if (nsnull != shell) { - nsIFrame* rootFrame = shell->GetRootFrame(); + nsIFrame* rootFrame; + shell->GetRootFrame(rootFrame); if (nsnull != rootFrame) { rootFrame->List(stdout, 0, nsnull); } diff --git a/layout/html/document/src/nsHTMLContentSink.cpp b/layout/html/document/src/nsHTMLContentSink.cpp index 3cc946fe16e6..90825614ea4c 100644 --- a/layout/html/document/src/nsHTMLContentSink.cpp +++ b/layout/html/document/src/nsHTMLContentSink.cpp @@ -1941,7 +1941,8 @@ HTMLContentSink::ScrollToRef() for (i = 0; i < ns; i++) { nsIPresShell* shell = mDocument->GetShellAt(i); if (nsnull != shell) { - nsIFrame* frame = shell->FindFrameWithContent(mRefContent); + nsIFrame* frame; + shell->GetPrimaryFrameFor(mRefContent, frame); if (nsnull != frame) { nsIViewManager* vm = shell->GetViewManager(); if (nsnull != vm) { diff --git a/layout/html/forms/src/nsLabelFrame.cpp b/layout/html/forms/src/nsLabelFrame.cpp index 8c8eecd1dcd9..2296dda40d7b 100644 --- a/layout/html/forms/src/nsLabelFrame.cpp +++ b/layout/html/forms/src/nsLabelFrame.cpp @@ -291,7 +291,8 @@ nsLabelFrame::FindForControl(nsIFormControlFrame*& aResultFrame) value.GetStringValue(id); id.Trim(whitespace, PR_TRUE, PR_TRUE); if (id.Equals(forId)) { - nsIFrame* frame = shell->FindFrameWithContent(htmlContent); + nsIFrame* frame; + shell->GetPrimaryFrameFor(htmlContent, frame); if (nsnull != frame) { nsIFormControlFrame* fcFrame = nsnull; result = frame->QueryInterface(kIFormControlFrameIID, (void**)&fcFrame); diff --git a/layout/html/style/src/nsHTMLStyleSheet.cpp b/layout/html/style/src/nsHTMLStyleSheet.cpp index 959f0239f36b..a67f73beb5d0 100644 --- a/layout/html/style/src/nsHTMLStyleSheet.cpp +++ b/layout/html/style/src/nsHTMLStyleSheet.cpp @@ -2207,7 +2207,9 @@ nsIFrame* HTMLStyleSheetImpl::GetFrameFor(nsIPresShell* aPresShell, nsIPresContext* aPresContext, nsIContent* aContent) { - nsIFrame* frame = aPresShell->FindFrameWithContent(aContent); + // Get the primary frame associated with the content + nsIFrame* frame; + aPresShell->GetPrimaryFrameFor(aContent, frame); if (nsnull != frame) { // If the primary frame is a scroll frame, then get the scrolled frame. @@ -2375,7 +2377,7 @@ FindPreviousSibling(nsIPresShell* aPresShell, for (PRInt32 index = aIndexInContainer - 1; index >= 0; index--) { nsIContent* precedingContent; aContainer->ChildAt(index, precedingContent); - prevSibling = aPresShell->FindFrameWithContent(precedingContent); + aPresShell->GetPrimaryFrameFor(precedingContent, prevSibling); NS_RELEASE(precedingContent); if (nsnull != prevSibling) { @@ -2409,7 +2411,7 @@ FindNextSibling(nsIPresShell* aPresShell, for (PRInt32 index = aIndexInContainer + 1; index < count; index++) { nsIContent* nextContent; aContainer->ChildAt(index, nextContent); - nextSibling = aPresShell->FindFrameWithContent(nextContent); + aPresShell->GetPrimaryFrameFor(nextContent, nextSibling); NS_RELEASE(nextContent); if (nsnull != nextSibling) { @@ -2454,7 +2456,7 @@ HTMLStyleSheetImpl::ContentInserted(nsIPresContext* aPresContext, // XXX This won't always be true if there's auto-generated before/after // content isAppend = PR_TRUE; - parentFrame = shell->FindFrameWithContent(aContainer); + shell->GetPrimaryFrameFor(aContainer, parentFrame); } else { // Use the prev sibling if we have it; otherwise use the next sibling. @@ -2544,7 +2546,8 @@ HTMLStyleSheetImpl::ContentRemoved(nsIPresContext* aPresContext, nsresult rv = NS_OK; // Find the child frame - nsIFrame* childFrame = shell->FindFrameWithContent(aChild); + nsIFrame* childFrame; + shell->GetPrimaryFrameFor(aChild, childFrame); if (nsnull != childFrame) { // Get the parent frame. @@ -2645,7 +2648,8 @@ HTMLStyleSheetImpl::ContentChanged(nsIPresContext* aPresContext, nsresult rv = NS_OK; // Find the child frame - nsIFrame* frame = shell->FindFrameWithContent(aContent); + nsIFrame* frame; + shell->GetPrimaryFrameFor(aContent, frame); // Notify the first frame that maps the content. It will generate a reflow // command @@ -2675,7 +2679,9 @@ HTMLStyleSheetImpl::AttributeChanged(nsIPresContext* aPresContext, nsresult result = NS_OK; nsIPresShell* shell = aPresContext->GetShell(); - nsIFrame* frame = shell->FindFrameWithContent(aContent); + nsIFrame* frame; + + shell->GetPrimaryFrameFor(aContent, frame); if (nsnull != frame) { PRBool restyle = PR_FALSE; @@ -2755,7 +2761,8 @@ HTMLStyleSheetImpl::StyleRuleChanged(nsIPresContext* aPresContext, PRInt32 aHint) { nsIPresShell* shell = aPresContext->GetShell(); - nsIFrame* frame = shell->GetRootFrame(); + nsIFrame* frame; + shell->GetRootFrame(frame); PRBool reframe = PR_FALSE; PRBool reflow = PR_FALSE; diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index 959f0239f36b..a67f73beb5d0 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -2207,7 +2207,9 @@ nsIFrame* HTMLStyleSheetImpl::GetFrameFor(nsIPresShell* aPresShell, nsIPresContext* aPresContext, nsIContent* aContent) { - nsIFrame* frame = aPresShell->FindFrameWithContent(aContent); + // Get the primary frame associated with the content + nsIFrame* frame; + aPresShell->GetPrimaryFrameFor(aContent, frame); if (nsnull != frame) { // If the primary frame is a scroll frame, then get the scrolled frame. @@ -2375,7 +2377,7 @@ FindPreviousSibling(nsIPresShell* aPresShell, for (PRInt32 index = aIndexInContainer - 1; index >= 0; index--) { nsIContent* precedingContent; aContainer->ChildAt(index, precedingContent); - prevSibling = aPresShell->FindFrameWithContent(precedingContent); + aPresShell->GetPrimaryFrameFor(precedingContent, prevSibling); NS_RELEASE(precedingContent); if (nsnull != prevSibling) { @@ -2409,7 +2411,7 @@ FindNextSibling(nsIPresShell* aPresShell, for (PRInt32 index = aIndexInContainer + 1; index < count; index++) { nsIContent* nextContent; aContainer->ChildAt(index, nextContent); - nextSibling = aPresShell->FindFrameWithContent(nextContent); + aPresShell->GetPrimaryFrameFor(nextContent, nextSibling); NS_RELEASE(nextContent); if (nsnull != nextSibling) { @@ -2454,7 +2456,7 @@ HTMLStyleSheetImpl::ContentInserted(nsIPresContext* aPresContext, // XXX This won't always be true if there's auto-generated before/after // content isAppend = PR_TRUE; - parentFrame = shell->FindFrameWithContent(aContainer); + shell->GetPrimaryFrameFor(aContainer, parentFrame); } else { // Use the prev sibling if we have it; otherwise use the next sibling. @@ -2544,7 +2546,8 @@ HTMLStyleSheetImpl::ContentRemoved(nsIPresContext* aPresContext, nsresult rv = NS_OK; // Find the child frame - nsIFrame* childFrame = shell->FindFrameWithContent(aChild); + nsIFrame* childFrame; + shell->GetPrimaryFrameFor(aChild, childFrame); if (nsnull != childFrame) { // Get the parent frame. @@ -2645,7 +2648,8 @@ HTMLStyleSheetImpl::ContentChanged(nsIPresContext* aPresContext, nsresult rv = NS_OK; // Find the child frame - nsIFrame* frame = shell->FindFrameWithContent(aContent); + nsIFrame* frame; + shell->GetPrimaryFrameFor(aContent, frame); // Notify the first frame that maps the content. It will generate a reflow // command @@ -2675,7 +2679,9 @@ HTMLStyleSheetImpl::AttributeChanged(nsIPresContext* aPresContext, nsresult result = NS_OK; nsIPresShell* shell = aPresContext->GetShell(); - nsIFrame* frame = shell->FindFrameWithContent(aContent); + nsIFrame* frame; + + shell->GetPrimaryFrameFor(aContent, frame); if (nsnull != frame) { PRBool restyle = PR_FALSE; @@ -2755,7 +2761,8 @@ HTMLStyleSheetImpl::StyleRuleChanged(nsIPresContext* aPresContext, PRInt32 aHint) { nsIPresShell* shell = aPresContext->GetShell(); - nsIFrame* frame = shell->GetRootFrame(); + nsIFrame* frame; + shell->GetRootFrame(frame); PRBool reframe = PR_FALSE; PRBool reflow = PR_FALSE; diff --git a/webshell/tests/viewer/nsBrowserWindow.cpp b/webshell/tests/viewer/nsBrowserWindow.cpp index d52ee19803ce..260728727fd3 100644 --- a/webshell/tests/viewer/nsBrowserWindow.cpp +++ b/webshell/tests/viewer/nsBrowserWindow.cpp @@ -2299,7 +2299,8 @@ DumpFramesRecurse(nsIWebShell* aWebShell, FILE* out, nsString *aFilterName) fprintf(out, "webshell=%p \n", aWebShell); nsIPresShell* shell = GetPresShellFor(aWebShell); if (nsnull != shell) { - nsIFrame* root = shell->GetRootFrame(); + nsIFrame* root; + shell->GetRootFrame(root); if (nsnull != root) { nsIListFilter *filter = nsIFrame::GetFilter(aFilterName); root->List(out, 0, filter); @@ -2398,7 +2399,8 @@ nsBrowserWindow::DumpStyleContexts(FILE* out) if (nsnull == styleSet) { fputs("null style set\n", out); } else { - nsIFrame* root = shell->GetRootFrame(); + nsIFrame* root; + shell->GetRootFrame(root); if (nsnull == root) { fputs("null root frame\n", out); } else { @@ -2471,7 +2473,7 @@ nsBrowserWindow::ShowFrameSize() return; } nsIFrame* root; - root = shell->GetRootFrame(); + shell->GetRootFrame(root); if (nsnull != root) { root->SizeOf(szh); PRUint32 totalSize; diff --git a/webshell/tests/viewer/nsWebCrawler.cpp b/webshell/tests/viewer/nsWebCrawler.cpp index 7725ad481fdb..b8a820b7c503 100644 --- a/webshell/tests/viewer/nsWebCrawler.cpp +++ b/webshell/tests/viewer/nsWebCrawler.cpp @@ -279,7 +279,8 @@ nsWebCrawler:: EndLoadURL(nsIWebShell* aShell, if ((nsnull != mFilter) || (mOutputDir.Length() > 0)) { nsIPresShell* shell = GetPresShell(); if (nsnull != shell) { - nsIFrame* root = shell->GetRootFrame(); + nsIFrame* root; + shell->GetRootFrame(root); if (nsnull != root) { nsIListFilter *filter = nsIFrame::GetFilter(mFilter); if (mOutputDir.Length() > 0)