diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index c1f34d4aa4ed..a86855f29a99 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -1227,49 +1227,6 @@ nsLayoutUtils::GetDisplayPortForVisibilityTesting( return usingDisplayPort; } -/* static */ nsRect -nsLayoutUtils::GetDisplayPortOrFallbackToScrollPort(nsIScrollableFrame* aScrollableFrame) -{ - MOZ_ASSERT(aScrollableFrame); - - nsIFrame* scrollableFrameAsFrame = do_QueryFrame(aScrollableFrame); - MOZ_ASSERT(scrollableFrameAsFrame); - - nsIContent* contentForDisplayPort = scrollableFrameAsFrame->GetContent(); - MOZ_ASSERT(contentForDisplayPort); - - nsRect displayPort; - bool usingDisplayPort = - GetDisplayPortForVisibilityTesting(contentForDisplayPort, - &displayPort, - RelativeTo::ScrollFrame); - - return usingDisplayPort ? displayPort - : aScrollableFrame->GetScrollPortRect(); -} - -/* static */ nsRect -nsLayoutUtils::TransformAndIntersectRect(nsIFrame* aFrom, - const nsRect& aFromRect, - nsIFrame* aTo, - const nsRect& aToRect) -{ - if (MOZ_UNLIKELY(!aFrom)) { - return nsRect(); // Treat as no intersection. - } - if (MOZ_UNLIKELY(!aTo)) { - return nsRect(); // Treat as no intersection. - } - - nsRect fromRectInToSpace = aFromRect; - TransformResult result = TransformRect(aFrom, aTo, fromRectInToSpace); - if (MOZ_UNLIKELY(result != TransformResult::TRANSFORM_SUCCEEDED)) { - return nsRect(); // Treat as no intersection. - } - - return aToRect.Intersect(fromRectInToSpace); -} - bool nsLayoutUtils::SetDisplayPortMargins(nsIContent* aContent, nsIPresShell* aPresShell, @@ -3313,49 +3270,7 @@ nsLayoutUtils::GetAsyncScrollableAncestorFrame(nsIFrame* aTarget) uint32_t flags = nsLayoutUtils::SCROLLABLE_ALWAYS_MATCH_ROOT | nsLayoutUtils::SCROLLABLE_ONLY_ASYNC_SCROLLABLE | nsLayoutUtils::SCROLLABLE_FIXEDPOS_FINDS_ROOT; - return GetNearestScrollableFrame(aTarget, flags); -} - -nsIScrollableFrame* -nsLayoutUtils::GetAsyncScrollableProperAncestorFrame(nsIFrame* aTarget) -{ - nsIFrame* parent = GetCrossDocParentFrame(aTarget); - if (!parent) { - return nullptr; - } - - return GetAsyncScrollableAncestorFrame(parent); -} - -/* static */ nsIFrame* -nsLayoutUtils::GetAsyncScrollableProperAncestorFrameOrFallback(nsIFrame* aTarget) -{ - MOZ_ASSERT(aTarget); - - nsIScrollableFrame* scrollableFrame = - GetAsyncScrollableProperAncestorFrame(aTarget); - if (scrollableFrame) { - return do_QueryFrame(scrollableFrame); // We got an actual scrollable frame. - } - - if (aTarget->PresContext()->Document()->IsHTMLDocument()) { - // Don't fall back for HTML documents, which should have a root scrollable - // frame. - return nullptr; - } - - // We'll have to fall back to the root frame. - nsIPresShell* presShell = aTarget->PresContext()->GetPresShell(); - if (!presShell) { - return nullptr; - } - - nsIFrame* rootFrame = presShell->GetRootFrame(); - if (rootFrame == aTarget) { - return nullptr; // Exclude |aTarget| itself. - } - - return rootFrame; // May be null. + return nsLayoutUtils::GetNearestScrollableFrame(aTarget, flags); } void diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 9be53083c684..3db939d72508 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -210,12 +210,6 @@ public: nsRect* aResult, RelativeTo aRelativeTo = RelativeTo::ScrollPort); - /** - * @return the critical displayport associated with @aScrollableFrame, or if - * it does not have a displayport, the associated scrollport. - */ - static nsRect GetDisplayPortOrFallbackToScrollPort(nsIScrollableFrame* aScrollableFrame); - enum class RepaintMode : uint8_t { Repaint, DoNotRepaint @@ -918,16 +912,6 @@ public: static TransformResult TransformRect(nsIFrame* aFromFrame, nsIFrame* aToFrame, nsRect& aRect); - /** - * Transforms @aFromRect from the space of @aFrom to the space of @aTo, and - * intersects it with @aToRect. - * - * @return The result of the intersection, or the empty rect if - * TransformRect would've returned something other than TRANSFORM_SUCCEEDED. - */ - static nsRect TransformAndIntersectRect(nsIFrame* aFrom, const nsRect& aFromRect, - nsIFrame* aTo, const nsRect& aToRect); - /** * Get the border-box of aElement's primary frame, transformed it to be * relative to aFrame. @@ -2729,25 +2713,8 @@ public: static void MaybeCreateDisplayPort(nsDisplayListBuilder& aBuilder, nsIFrame* aScrollFrame); - /** - * @return the nearest async scrollable ancestor frame of @aTarget, including - * @aTarget itself if @aTarget is async scrollable. - */ static nsIScrollableFrame* GetAsyncScrollableAncestorFrame(nsIFrame* aTarget); - /** - * @return the nearest async scrollable ancestor frame of @aTarget, excluding - * @aTarget itself. - */ - static nsIScrollableFrame* GetAsyncScrollableProperAncestorFrame(nsIFrame* aTarget); - - /** - * @return the nearest async scrollable ancestor frame of @aTarget, excluding - * @aTarget itself. If there is no async scrollable ancestor frame, falls back - * to the root frame. - */ - static nsIFrame* GetAsyncScrollableProperAncestorFrameOrFallback(nsIFrame* aTarget); - /** * Sets a zero margin display port on all proper ancestors of aFrame that * are async scrollable.