Skip to content

Commit 61e3989

Browse files
committed
Bug 1974382: Avoid short-circuit evaluation on frame ancestor lookup. r=layout-anchor-positioning-reviewers,dshin
Differential Revision: https://phabricator.services.mozilla.com/D255501
1 parent c21afb6 commit 61e3989

12 files changed

+11
-15
lines changed

layout/base/PresShell.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12040,7 +12040,7 @@ void PresShell::AddAnchorPosAnchor(const nsAtom* aName, nsIFrame* aFrame) {
1204012040
nsIFrame* mFrame;
1204112041

1204212042
int32_t operator()(nsIFrame* aOther) const {
12043-
return nsLayoutUtils::CompareTreePosition(aOther, mFrame, nullptr);
12043+
return nsLayoutUtils::CompareTreePosition(mFrame, aOther, nullptr);
1204412044
}
1204512045
};
1204612046

layout/base/nsLayoutUtils.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,8 +1161,9 @@ int32_t nsLayoutUtils::DoCompareTreePosition(
11611161
}
11621162

11631163
AutoTArray<const nsIFrame*, 20> frame1Ancestors;
1164-
if (aCommonAncestor &&
1165-
!FillAncestors(aFrame1, aCommonAncestor, &frame1Ancestors)) {
1164+
const nsIFrame* frame1CommonAncestor =
1165+
FillAncestors(aFrame1, aCommonAncestor, &frame1Ancestors);
1166+
if (aCommonAncestor && !frame1CommonAncestor) {
11661167
// We reached the root of the frame tree ... if aCommonAncestor was set,
11671168
// it is wrong
11681169
return DoCompareTreePosition(aFrame1, aFrame2, nullptr);

testing/web-platform/meta/css/css-anchor-position/anchor-getComputedStyle-001.html.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[anchor-getComputedStyle-001.html]
2+
expected: CRASH
23
[Basic case]
34
expected: FAIL
45

testing/web-platform/meta/css/css-anchor-position/anchor-getComputedStyle-002.html.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[anchor-getComputedStyle-002.html]
2+
expected: CRASH
23
[getComputedStyle() with fragmented containing block in multicolumn layout]
34
expected: FAIL
45

testing/web-platform/meta/css/css-anchor-position/anchor-name-in-shadow.html.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@
33
if (os == "android") and fission: [TIMEOUT, OK]
44
[anchor() in shadow tree should not match host anchor-name]
55
expected: FAIL
6-
7-
[anchor-name should not leak out of a shadow tree]
8-
expected: FAIL
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
[anchor-position-003.html]
22
expected:
33
if (os == "android") and fission: [OK, TIMEOUT]
4-
[.target 1]
5-
expected: FAIL

testing/web-platform/meta/css/css-anchor-position/anchor-position-circular.html.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

testing/web-platform/meta/css/css-anchor-position/anchor-scope-basic.html.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
[Sibling can not anchor into anchor-scope, even when anchor-name present]
2121
expected: FAIL
2222

23-
[anchor-scope:all on common ancestor]
23+
[anchor-scope:all scopes multiple names]
2424
expected: FAIL
2525

26-
[anchor-scope:--a on common ancestor]
26+
[anchor-scope:--a,--b scopes --a and --b]
2727
expected: FAIL

testing/web-platform/meta/css/css-anchor-position/anchor-scope-dynamic.html.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,3 @@
77

88
[anchor-scope:--a appearing dynamically scopes only --a]
99
expected: FAIL
10-
11-
[anchor-scope:--b appearing dynamically (--b never referenced)]
12-
expected: FAIL
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[anchor-scope-shadow-names.html]
2+
expected: CRASH
23
[anchor-scope in ::part() affects slotted-in element]
34
expected: FAIL

0 commit comments

Comments
 (0)