-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[anchor-position] Support percentage
This patch supports the percentage values in the `anchor()` function as defined in the spec[1]. [1] https://drafts.csswg.org/css-anchor-1/#anchor-pos Bug: 1382524 Change-Id: I9bf73f0bf98904289992d7276e165dd199be8c5d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4061808 Auto-Submit: Koji Ishii <kojii@chromium.org> Reviewed-by: Kent Tamura <tkent@chromium.org> Commit-Queue: Kent Tamura <tkent@chromium.org> Commit-Queue: Koji Ishii <kojii@chromium.org> Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Cr-Commit-Position: refs/heads/main@{#1076691}
- Loading branch information
Showing
4 changed files
with
143 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
third_party/blink/web_tests/external/wpt/css/css-anchor-position/anchor-position-004.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<!DOCTYPE html> | ||
<title>The `anchor()` function with percentages</title> | ||
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#anchor-pos"> | ||
<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; | ||
width: 200px; | ||
outline: 1px solid; | ||
} | ||
.vrl-rtl { | ||
writing-mode: vertical-rl; | ||
direction: rtl; | ||
} | ||
.spacer { | ||
background: yellow; | ||
width: 10px; | ||
height: 10px; | ||
} | ||
#anchor { | ||
anchor-name: --a1; | ||
margin: 20px; | ||
width: 100px; | ||
height: 200px; | ||
background: orange; | ||
} | ||
.target { | ||
position: absolute; | ||
} | ||
</style> | ||
<body onload="checkLayout('.target')"> | ||
<div class="relpos"> | ||
<div class="spacer"></div> | ||
<div id="anchor"></div> | ||
|
||
<div class="target" style="left: anchor(--a1 0%)" | ||
data-offset-x="20"></div> | ||
<div class="target" style="left: anchor(--a1 20%)" | ||
data-offset-x="40"></div> | ||
<div class="target" style="left: anchor(--a1 50%)" | ||
data-offset-x="70"></div> | ||
<div class="target" style="left: anchor(--a1 80%)" | ||
data-offset-x="100"></div> | ||
<div class="target" style="left: anchor(--a1 100%)" | ||
data-offset-x="120"></div> | ||
|
||
<div class="target" style="right: anchor(--a1 0%)" | ||
data-offset-x="20"></div> | ||
<div class="target" style="right: anchor(--a1 20%)" | ||
data-offset-x="40"></div> | ||
<div class="target" style="right: anchor(--a1 50%)" | ||
data-offset-x="70"></div> | ||
<div class="target" style="right: anchor(--a1 80%)" | ||
data-offset-x="100"></div> | ||
<div class="target" style="right: anchor(--a1 100%)" | ||
data-offset-x="120"></div> | ||
|
||
<div class="target" style="top: anchor(--a1 0%)" | ||
data-offset-y="30"></div> | ||
<div class="target" style="top: anchor(--a1 20%)" | ||
data-offset-y="70"></div> | ||
<div class="target" style="top: anchor(--a1 50%)" | ||
data-offset-y="130"></div> | ||
<div class="target" style="top: anchor(--a1 80%)" | ||
data-offset-y="190"></div> | ||
<div class="target" style="top: anchor(--a1 100%)" | ||
data-offset-y="230"></div> | ||
|
||
<div class="target" style="bottom: anchor(--a1 0%)" | ||
data-offset-y="30"></div> | ||
<div class="target" style="bottom: anchor(--a1 20%)" | ||
data-offset-y="70"></div> | ||
<div class="target" style="bottom: anchor(--a1 50%)" | ||
data-offset-y="130"></div> | ||
<div class="target" style="bottom: anchor(--a1 80%)" | ||
data-offset-y="190"></div> | ||
<div class="target" style="bottom: anchor(--a1 100%)" | ||
data-offset-y="230"></div> | ||
</div> | ||
|
||
<div class="vrl-rtl relpos"> | ||
<div class="spacer"></div> | ||
<div id="anchor"></div> | ||
|
||
<div class="target" style="left: anchor(--a1 0%)" | ||
data-offset-x="170"></div> | ||
<div class="target" style="left: anchor(--a1 100%)" | ||
data-offset-x="70"></div> | ||
|
||
<div class="target" style="right: anchor(--a1 0%)" | ||
data-offset-x="170"></div> | ||
<div class="target" style="right: anchor(--a1 100%)" | ||
data-offset-x="70"></div> | ||
|
||
<div class="target" style="top: anchor(--a1 0%)" | ||
data-offset-y="220"></div> | ||
<div class="target" style="top: anchor(--a1 100%)" | ||
data-offset-y="20"></div> | ||
|
||
<div class="target" style="bottom: anchor(--a1 0%)" | ||
data-offset-y="220"></div> | ||
<div class="target" style="bottom: anchor(--a1 100%)" | ||
data-offset-y="20"></div> | ||
</div> | ||
</body> |