Skip to content

Commit b4bde5b

Browse files
lilleschromium-wpt-export-bot
authored andcommitted
Pass node for tree counting conversions for gradients
Gradients (incorrectly) resolves computed values at paint time, which means we need the Element available for the CSSToLengthConversionData. We used to pass in a nullptr which would crash. Instead, pass the LayoutObject's node (or the Document if null) down to the GetImage() calls and use that node for tree counting if it is an element. Otherwise fall back to the documentElement. The correct solution is to compute gradients at computed value time, but that's a larger project. Bug: 410960656, 40620723 Change-Id: I97eafed237d5c148be05c53fe9fe3e3647b96fe0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6523441 Reviewed-by: Anders Hartvoll Ruud Commit-Queue: Rune Lillesveen Cr-Commit-Position: refs/heads/main@{#1458005}
1 parent 883e4ef commit b4bde5b

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
>
2+
<title>CSS Test Referencetitle>
3+
<style>
4+
body {
5+
background-position: top left;
6+
background-repeat: no-repeat;
7+
background-size: 100px 100px;
8+
background-image: linear-gradient(blue 40px, yellow);
9+
}
10+
style>
11+
<body>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
>
2+
<title>CSS Images Test: Linear gradient with sibling-index()title>
3+
<link rel="help" href="https://drafts.csswg.org/css-images/#linear-gradients">
4+
<link rel="help" href="https://drafts.csswg.org/css-values-5/#tree-counting">
5+
<link rel="match" href="linear-gradient-body-sibling-index-ref.html">
6+
<link rel="assert" content"sibling-index() is 2 for body">
7+
<style>
8+
body {
9+
background-position: top left;
10+
background-repeat: no-repeat;
11+
background-size: 100px 100px;
12+
background-image: linear-gradient(blue calc(20px * sibling-index()), yellow);
13+
}
14+
style>
15+
<body>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
>
2+
<title>CSS Test Referencetitle>
3+
<style>
4+
div { width: 100px; height: 100px; }
5+
style>
6+
<div style="background: linear-gradient(blue 20px, yellow)">div>
7+
<div style="background: linear-gradient(blue 50px, yellow)">div>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
>
2+
<title>CSS Images Test: Linear gradient with sibling-index()title>
3+
<link rel="help" href="https://drafts.csswg.org/css-images/#linear-gradients">
4+
<link rel="help" href="https://drafts.csswg.org/css-values-5/#tree-counting">
5+
<link rel="match" href="linear-gradient-sibling-index-ref.html">
6+
<style>
7+
.grad {
8+
width: 100px;
9+
height: 100px;
10+
background: linear-gradient(blue calc(10px * sibling-index()), yellow);
11+
}
12+
style>
13+
<div>
14+
<div>div>
15+
<div class="grad">div>
16+
<div>div>
17+
<div>div>
18+
<div class="grad">div>
19+
div>

0 commit comments

Comments
 (0)