Skip to content

Commit

Permalink
[anchor-position] Fix anchor query scopes in multicol
Browse files Browse the repository at this point in the history
When the containing block of querying element doesn't have
anchor queries, |CalculateOffset| should use an empty
|NGLogicalAnchorQuery|.

However, |LayoutFragmentainerDescendants| passed |nullptr|,
which means to use |container_builder_->AnchorQuery()|. In
multicol, this means to use the anchor query for the multicol
container.

This patch fixes the situation by passing an empty
|NGLogicalAnchorQuery|.

Bug: 1309178
Change-Id: Ibb64d3f7932eb677f70063cee303b2e62ca5b918
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3922615
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: Alison Maher <almaher@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1052100}
  • Loading branch information
kojiishi authored and chromium-wpt-export-bot committed Sep 27, 2022
1 parent 2fa24e2 commit 59999a1
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions css/css-anchor-position/anchor-name-multicol-001.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!DOCTYPE html>
<title>Anchors in a different containing block 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;
}
.columns {
column-count: 2;
column-fill: auto;
column-gap: 10px;
column-width: 100px;
width: 210px;
height: 100px;
}
.spacer {
height: 10px;
background: pink;
}
.anchor1 {
anchor-name: --a1;
margin-left: 10px;
width: 40px;
height: 20px;
background: orange;
}
.target {
position: absolute;
left: anchor(--a1 left);
top: anchor(--a1 top);
width: anchor-size(--a1 width);
height: anchor-size(--a1 height);
background: lime;
opacity: .3;
}
</style>
<body onload="checkLayout('.target')">
<div class="columns">
<div class="relpos">
<div class="spacer"></div>
<div class="anchor1"></div>
</div>
<div class="relpos">
<div class="target"
data-offset-x=0 data-offset-y=0
data-expected-width=0 data-expected-height=0></div>
</div>
</div>
</body>

0 comments on commit 59999a1

Please sign in to comment.