Skip to content

Commit

Permalink
[anchor-position] Change |NGLogicalAnchorQuery::Set| to check the list
Browse files Browse the repository at this point in the history
|NGLogicalAnchorQuery| is a linked list to keep multiple
anchors of the same name since r1039118 crrev.com/c/3851201,
because validities change as it is propagated, and queries
resolve to the first valid anchor in the tree order.

This patch changes |NGLogicalAnchorQuery::Set| to find the
|LayoutObject| by traversing the linked list, instead of
checking only the head one. The test hits a DCHECK without
this fix.

This was discussed in a CL review discussion[1].

[1] https://chromium-review.googlesource.com/c/chromium/src/+/3851201/comment/0d5895d2_6792b110/

Bug: 1309178
Change-Id: I4e0746c1cc6b64d3fb10683d5aa5f819e2f590e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3854585
Commit-Queue: Kent Tamura <tkent@chromium.org>
Auto-Submit: Koji Ishii <kojii@chromium.org>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1055563}
  • Loading branch information
kojiishi authored and chromium-wpt-export-bot committed Oct 6, 2022
1 parent 634a5ba commit 820dda9
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions css/css-anchor-position/anchor-name-multicol-004.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!DOCTYPE html>
<title>Anchor name resolution of OOF anchors in multicol</title>
<link rel="help" href="https://tabatkins.github.io/specs/css-anchor-position/#propdef-anchor-name">
<link rel="help" href="https://tabatkins.github.io/specs/css-anchor-position/#anchor-size">
<link rel="author" href="mailto:kojii@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<style>
.relpos {
position: relative;
}
.abspos {
position: absolute;
}
.columns {
column-count: 6;
column-fill: auto;
column-gap: 10px;
column-width: 20px;
width: 170px;
height: 50px;
}
.spacer {
height: 10px;
background: pink;
}
.anchor {
anchor-name: --a1;
margin-left: 5px;
width: 10px;
background: orange;
}
.target {
position: absolute;
background: lime;
opacity: .3;
left: anchor(--a1 left);
top: anchor(--a1 top);
width: anchor-size(--a1 width);
height: anchor-size(--a1 height);
}
</style>
<body onload="checkLayout('.target')">
<div class="spacer"></div>
<div class="relpos">
<div class="columns relpos">
<div class="relpos">
<div class="spacer"></div>
<div class="anchor" style="height: 60px"></div>
<div class="anchor abspos" style="top: 120px; height: 100px"></div>
<div class="target"
data-expected-width=40 data-expected-height=50></div>
</div>
<div class="target"
data-expected-width=40 data-expected-height=50></div>
</div>
</div>
</body>

0 comments on commit 820dda9

Please sign in to comment.