commit bea800de3bb2e1a29db79dfc16ee6adfc99c4990
parent ca2157db60a3ead8bf8a6c492009765463e06d9a
Author: David Shin <dshin@mozilla.com>
Date: Mon, 20 Oct 2025 20:03:23 +0000
Bug 1995280: position-area uses the union of CB rect & anchor rect. r=layout-anchor-positioning-reviewers,layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D269258
Diffstat:
4 files changed, 6 insertions(+), 61 deletions(-)
diff --git a/layout/base/AnchorPositioningUtils.cpp b/layout/base/AnchorPositioningUtils.cpp
@@ -798,18 +798,19 @@ nsRect AnchorPositioningUtils::AdjustAbsoluteContainingBlockRectForPositionArea(
// | | | |
// ttbEdges[3] +------------+------------+------------+
- nscoord ltrEdges[4] = {aCBRect.x, aAnchorRect.x,
+ const nsRect gridRect = aCBRect.Union(aAnchorRect);
+ nscoord ltrEdges[4] = {gridRect.x, aAnchorRect.x,
aAnchorRect.x + aAnchorRect.width,
- aCBRect.x + aCBRect.width};
- nscoord ttbEdges[4] = {aCBRect.y, aAnchorRect.y,
+ gridRect.x + gridRect.width};
+ nscoord ttbEdges[4] = {gridRect.y, aAnchorRect.y,
aAnchorRect.y + aAnchorRect.height,
- aCBRect.y + aCBRect.height};
+ gridRect.y + gridRect.height};
ltrEdges[1] = std::clamp(ltrEdges[1], ltrEdges[0], ltrEdges[3]);
ltrEdges[2] = std::clamp(ltrEdges[2], ltrEdges[0], ltrEdges[3]);
ttbEdges[1] = std::clamp(ttbEdges[1], ttbEdges[0], ttbEdges[3]);
ttbEdges[2] = std::clamp(ttbEdges[2], ttbEdges[0], ttbEdges[3]);
- nsRect res = aCBRect;
+ nsRect res = gridRect;
// PositionArea, resolved to only contain Left/Right/Top/Bottom values.
StylePositionArea posArea =
diff --git a/testing/web-platform/meta/css/css-anchor-position/position-area-anchor-outside.html.ini b/testing/web-platform/meta/css/css-anchor-position/position-area-anchor-outside.html.ini
@@ -1,33 +1,6 @@
[position-area-anchor-outside.html]
- [Offsets for position-area: left span-all]
- expected: FAIL
-
- [Offsets for position-area: span-left span-all]
- expected: FAIL
-
[Offsets for position-area: span-all center]
expected: FAIL
- [Offsets for position-area: span-right span-all]
- expected: FAIL
-
- [Offsets for position-area: right span-all]
- expected: FAIL
-
- [Offsets for position-area: top span-all]
- expected: FAIL
-
- [Offsets for position-area: span-top span-all]
- expected: FAIL
-
[Offsets for position-area: center span-all]
expected: FAIL
-
- [Offsets for position-area: span-bottom span-all]
- expected: FAIL
-
- [Offsets for position-area: bottom span-all]
- expected: FAIL
-
- [Offsets for position-area: span-all]
- expected: FAIL
diff --git a/testing/web-platform/meta/css/css-anchor-position/position-area-anchor-partially-outside.html.ini b/testing/web-platform/meta/css/css-anchor-position/position-area-anchor-partially-outside.html.ini
@@ -1,33 +1,6 @@
[position-area-anchor-partially-outside.html]
- [Offsets for position-area: left span-all]
- expected: FAIL
-
- [Offsets for position-area: span-left span-all]
- expected: FAIL
-
[Offsets for position-area: span-all center]
expected: FAIL
- [Offsets for position-area: span-right span-all]
- expected: FAIL
-
- [Offsets for position-area: right span-all]
- expected: FAIL
-
- [Offsets for position-area: top span-all]
- expected: FAIL
-
- [Offsets for position-area: span-top span-all]
- expected: FAIL
-
[Offsets for position-area: center span-all]
expected: FAIL
-
- [Offsets for position-area: span-bottom span-all]
- expected: FAIL
-
- [Offsets for position-area: bottom span-all]
- expected: FAIL
-
- [Offsets for position-area: span-all]
- expected: FAIL
diff --git a/testing/web-platform/meta/css/css-anchor-position/position-try-fallbacks-004.html.ini b/testing/web-platform/meta/css/css-anchor-position/position-try-fallbacks-004.html.ini
@@ -1,2 +0,0 @@
-[position-try-fallbacks-004.html]
- expected: FAIL