Skip to content

Commit 831dc2b

Browse files
Force the color property at used value time
Forced colors should now happen at used value time. This change adds two internal properties to store the forced colors values of color and -internal-visited-color. These internal values are then applied to the visited/unvisited color at used value time when appropriate. In addition to color, we also needed to force the used/visited color value of -webkit-text-fill-color and -webkit-text-stroke-color. These are forced to currentColor to match the color properties. This ensures that text color is properly forced in forced colors mode. Note: This change will result in some functional differences with the how colors are inherited in forced colors mode. The related web tests have been updated to reflect this change in behavior. Bug: 970285 Change-Id: I8858077397419edc18e89c2b2817788ef42e904b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2529950 Commit-Queue: Alison Maher <[email protected]> Reviewed-by: Anders Hartvoll Ruud <[email protected]> Reviewed-by: Rune Lillesveen <[email protected]> Reviewed-by: Alex Keng <[email protected]> Cr-Commit-Position: refs/heads/master@{#829996}
1 parent e89a0c3 commit 831dc2b

File tree

4 files changed

+7
-19
lines changed

4 files changed

+7
-19
lines changed

forced-colors-mode/forced-colors-mode-18-ref.html

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,12 @@
1717
</text>
1818
<rect x="0" height="60" y="30" width="180" style="fill: red; stroke: blue;"/>
1919
<foreignObject x="20" y="100" width="160" height="160">
20-
<div xmlns="http://www.w3.org/1999/xhtml" style="color: orange;">
21-
This text should be orange in forced colors mode due to inheritance.
20+
<div xmlns="http://www.w3.org/1999/xhtml" style="color: CanvasText;">
21+
This text should be CanvasText in forced colors mode.
2222
</div>
2323
<svg height="20" width="20">
2424
<rect x="0" height="20" y="0" width="20" style="fill: green; stroke: purple;"/>
2525
</svg>
2626
</foreignObject>
2727
</svg>
28-
29-
<svg height="600" width="600">
30-
<foreignObject x="20" y="100" width="160" height="160" style="color: CanvasText;">
31-
<div xmlns="http://www.w3.org/1999/xhtml">
32-
This text should be CanvasText in forced colors mode.
33-
</div>
34-
</foreignObject>
35-
</svg>
3628
</body>

forced-colors-mode/forced-colors-mode-18.html

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,11 @@
1515
<rect x="0" height="60" y="30" width="180" style="fill: red; stroke: blue;"/>
1616
<foreignObject x="20" y="100" width="160" height="160" style="color: blue;">
1717
<div xmlns="http://www.w3.org/1999/xhtml">
18-
This text should be orange in forced colors mode due to inheritance.
18+
This text should be CanvasText in forced colors mode.
1919
</div>
2020
<svg height="20" width="20">
2121
<rect x="0" height="20" y="0" width="20" style="fill: green; stroke: purple;"/>
2222
</svg>
2323
</foreignObject>
2424
</svg>
25-
26-
<svg height="600" width="600">
27-
<foreignObject x="20" y="100" width="160" height="160" style="color: blue;">
28-
<div xmlns="http://www.w3.org/1999/xhtml">
29-
This text should be CanvasText in forced colors mode.
30-
</div>
31-
</foreignObject>
32-
</svg>
3325
</body>

forced-colors-mode/forced-colors-mode-40.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
div {
1111
background-color: green;
1212
border-color: green;
13+
color: green;
1314
column-rule-color: green;
1415
fill: green;
1516
outline-color: green;
@@ -30,6 +31,7 @@
3031
"border-left-color",
3132
"border-right-color",
3233
"border-top-color",
34+
"color",
3335
"column-rule-color",
3436
"fill",
3537
"outline-color",

forced-colors-mode/forced-colors-mode-41.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
div {
1313
background-color: green;
1414
border-color: green;
15+
color: green;
1516
outline-color: green;
1617
}
1718
</style>
@@ -24,6 +25,7 @@
2425
"border-left-color",
2526
"border-right-color",
2627
"border-top-color",
28+
"color",
2729
"outline-color"
2830
];
2931
for (let property of properties_to_test) {

0 commit comments

Comments
 (0)