commit 175e4ab73d6ac0fd05030107546e969af208071d
parent f465bef00d657c5295a5e309a5ae38886bdd1272
Author: David Shin <dshin@mozilla.com>
Date: Tue, 16 Dec 2025 22:31:59 +0000
Bug 2006352: Compensate for scroll when only using anchor-center. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D276670
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/layout/generic/AbsoluteContainingBlock.cpp b/layout/generic/AbsoluteContainingBlock.cpp
@@ -777,12 +777,14 @@ static nscoord OffsetToAlignedStaticPos(
Maybe<CSSAlignUtils::AnchorAlignInfo> anchorAlignInfo;
if (alignConst == StyleAlignFlags::ANCHOR_CENTER &&
aKidReflowInput.mAnchorPosResolutionCache) {
- const auto* referenceData =
+ auto* referenceData =
aKidReflowInput.mAnchorPosResolutionCache->mReferenceData;
if (referenceData) {
const auto* cachedData =
referenceData->Lookup(referenceData->mDefaultAnchorName);
if (cachedData && *cachedData) {
+ referenceData->AdjustCompensatingForScroll(
+ aAbsPosCBWM.PhysicalAxis(aAbsPosCBAxis));
const auto& data = cachedData->ref();
if (data.mOffsetData) {
const nsSize containerSize =
diff --git a/testing/web-platform/meta/css/css-anchor-position/anchor-center-scroll.html.ini b/testing/web-platform/meta/css/css-anchor-position/anchor-center-scroll.html.ini
@@ -1,2 +0,0 @@
-[anchor-center-scroll.html]
- expected: FAIL