diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 7c338e216d6f..ac1eb6d99a82 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -61,6 +61,12 @@ using namespace mozilla::layers; using namespace mozilla::dom; typedef FrameMetrics::ViewID ViewID; +static inline nsIFrame* +GetTransformRootFrame(nsIFrame* aFrame) +{ + return nsLayoutUtils::GetTransformRootFrame(aFrame); +} + static void AddTransformFunctions(nsCSSValueList* aList, nsStyleContext* aContext, nsPresContext* aPresContext, @@ -2878,15 +2884,6 @@ nsDisplayBoxShadowInner::ComputeVisibility(nsDisplayListBuilder* aBuilder, return true; } -nsIFrame *GetTransformRootFrame(nsIFrame* aFrame) -{ - nsIFrame *parent = nsLayoutUtils::GetCrossDocParentFrame(aFrame); - while (parent && parent->Preserves3DChildren()) { - parent = nsLayoutUtils::GetCrossDocParentFrame(parent); - } - return parent; -} - nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList) : nsDisplayItem(aBuilder, aFrame) { diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 64e381d266ab..8d830ce00719 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -4803,6 +4803,16 @@ nsLayoutUtils::GetReferenceFrame(nsIFrame* aFrame) } } +/* static */ nsIFrame* +nsLayoutUtils::GetTransformRootFrame(nsIFrame* aFrame) +{ + nsIFrame *parent = nsLayoutUtils::GetCrossDocParentFrame(aFrame); + while (parent && parent->Preserves3DChildren()) { + parent = nsLayoutUtils::GetCrossDocParentFrame(parent); + } + return parent; +} + /* static */ uint32_t nsLayoutUtils::GetTextRunFlagsForStyle(nsStyleContext* aStyleContext, const nsStyleFont* aStyleFont, diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 3b81498d2b4d..a195d72c9b48 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -1520,7 +1520,8 @@ public: * Get the reference frame that would be used when constructing a * display item for this frame. (Note, however, that * nsDisplayTransform use the reference frame appropriate for their - * parent, rather than using their own frame as a reference frame.) + * GetTransformRootFrame(), rather than using their own frame as a + * reference frame.) * * This duplicates some of the logic of GetDisplayRootFrame above and * of nsDisplayListBuilder::FindReferenceFrameFor. @@ -1530,6 +1531,16 @@ public: */ static nsIFrame* GetReferenceFrame(nsIFrame* aFrame); + /** + * Get the parent of this frame, except if that parent is part of a + * preserve-3d hierarchy, get the parent of the root of the + * preserve-3d hierarchy. + * + * (This is used as the starting point for reference frame computation + * for nsDisplayTransform display items.) + */ + static nsIFrame* GetTransformRootFrame(nsIFrame* aFrame); + /** * Get textrun construction flags determined by a given style; in particular * some combination of: