commit 71bbc300d9e01d250af91993c8ef0caceda98243
parent 171d9a28dd432f53bbd3fdb7603d28d39fb194d7
Author: Jonathan Watt <jwatt@jwatt.org>
Date: Thu, 11 Dec 2025 18:28:27 +0000
Bug 2005526. Fix position-area alignment for popovers (auto margins). r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D275999
Diffstat:
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h
@@ -419,6 +419,12 @@ struct AnchorResolvedMarginHelper {
if (aValue.HasAnchorPositioningFunction()) {
return ResolveAnchor(aValue, aAxis, aParams);
}
+ // For `position-area` values other than `none`, the used value of `auto`
+ // margin properties resolves to 0:
+ // <https://drafts.csswg.org/css-anchor-position-1/#valdef-position-area-position-area>
+ if (aValue.IsAuto() && !aParams.mPositionArea.IsNone()) {
+ return Zero();
+ }
return AnchorResolvedMargin::NonOwning(&aValue);
}
diff --git a/testing/web-platform/meta/html/semantics/popovers/popover-alignment-002.html.ini b/testing/web-platform/meta/html/semantics/popovers/popover-alignment-002.html.ini
@@ -1,2 +0,0 @@
-[popover-alignment-002.html]
- expected: FAIL