commit 9522b8c2daf58c0d47fa1e5408dab2445ca0affb
parent fe705f5d1467ed63cc38170af8f3fa173b868c41
Author: David Shin <dshin@mozilla.com>
Date: Fri, 31 Oct 2025 02:19:02 +0000
Bug 1987961: Stop taking scroll offset into account during anchor positioning offset resolution. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D266465
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/layout/base/AnchorPositioningUtils.cpp b/layout/base/AnchorPositioningUtils.cpp
@@ -434,7 +434,8 @@ Maybe<AnchorPosInfo> AnchorPositioningUtils::GetAnchorPosRect(
if (aCBRectIsvalid) {
const nsRect result =
nsLayoutUtils::GetCombinedFragmentRects(aAnchor, true);
- const auto offset = aAnchor->GetOffsetTo(aAbsoluteContainingBlock);
+ const auto offset =
+ aAnchor->GetOffsetToIgnoringScrolling(aAbsoluteContainingBlock);
// Easy, just use the existing function.
return Some(result + offset);
}
@@ -458,7 +459,7 @@ Maybe<AnchorPosInfo> AnchorPositioningUtils::GetAnchorPosRect(
// going to do it again here, which feels a little wasteful.
const nsRect rectToContainerChild =
nsLayoutUtils::GetCombinedFragmentRects(aAnchor, true);
- const auto offset = aAnchor->GetOffsetTo(containerChild);
+ const auto offset = aAnchor->GetOffsetToIgnoringScrolling(containerChild);
return Some(rectToContainerChild + offset + containerChild->GetPosition());
}();
return rect.map([&](const nsRect& aRect) {