From 74d05f0dd8dba059a266de0c257e635150a8ae1d Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Sat, 9 Jun 2012 00:22:51 +1200 Subject: [PATCH] Bug 731293. Add nsLayoutUtils::GetParentOrPlaceholderForCrossDoc. r=mats --- layout/base/nsLayoutUtils.cpp | 12 +++++++++++- layout/base/nsLayoutUtils.h | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index b00c703fd54..f909d29382e 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -2109,11 +2109,21 @@ nsLayoutUtils::GetParentOrPlaceholderFor(nsIFrame* aFrame) { if ((aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) && !aFrame->GetPrevInFlow()) { - return aFrame->PresContext()->PresShell()->FrameManager()->GetPlaceholderFrameFor(aFrame); + return aFrame->PresContext()->PresShell()->FrameManager()-> + GetPlaceholderFrameFor(aFrame); } return aFrame->GetParent(); } +nsIFrame* +nsLayoutUtils::GetParentOrPlaceholderForCrossDoc(nsIFrame* aFrame) +{ + nsIFrame* f = GetParentOrPlaceholderFor(aFrame); + if (f) + return f; + return GetCrossDocParentFrame(aFrame); +} + nsIFrame* nsLayoutUtils::GetNextContinuationOrSpecialSibling(nsIFrame *aFrame) { diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index b60f331a8cc..68d0cf0c6d8 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -811,6 +811,12 @@ public: */ static nsIFrame* GetParentOrPlaceholderFor(nsIFrame* aFrame); + /** + * If aFrame is an out of flow frame, return its placeholder, otherwise + * return its (possibly cross-doc) parent. + */ + static nsIFrame* GetParentOrPlaceholderForCrossDoc(nsIFrame* aFrame); + /** * Get a frame's next-in-flow, or, if it doesn't have one, its special sibling. */