-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CSS] color-mix() should respect :visited style to resolve "currentco…
…lor" https://bugs.webkit.org/show_bug.cgi?id=259063 rdar://112419198 Reviewed by Tim Nguyen. This patch passes the visitedLink parameter down the stack to correctly resolve "currentcolor". * LayoutTests/imported/w3c/web-platform-tests/css/css-color/color-mix-currentcolor-visited-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-color/color-mix-currentcolor-visited-getcomputedstyle-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-color/color-mix-currentcolor-visited-getcomputedstyle.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-color/color-mix-currentcolor-visited-ref.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-color/color-mix-currentcolor-visited.html: Added. * Source/WebCore/rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::colorResolvingCurrentColor const): * Source/WebCore/rendering/style/RenderStyle.h: * Source/WebCore/style/StyleBuilderState.cpp: (WebCore::Style::BuilderState::colorFromPrimitiveValueWithResolvedCurrentColor const): Deleted. * Source/WebCore/style/StyleBuilderState.h: Canonical link: https://commits.webkit.org/267271@main
- Loading branch information
Showing
9 changed files
with
59 additions
and
11 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
...mported/w3c/web-platform-tests/css/css-color/color-mix-currentcolor-visited-expected.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,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<meta charset="utf-8"> | ||
<title>currentcolor is taken from :visited pseudo-class correctly in color-mix()</title> | ||
<style> | ||
a { color: green; background-color: color-mix(in srgb, green, white 75%); } | ||
</style> | ||
|
||
<a href="unvisited">This background should be green and not red</a> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
...platform-tests/css/css-color/color-mix-currentcolor-visited-getcomputedstyle-expected.txt
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,4 @@ | ||
This background should be green and not red | ||
|
||
PASS Property background-color value 'color-mix(in srgb, currentcolor, white)' should not leak :visited for computed style | ||
|
17 changes: 17 additions & 0 deletions
17
...w3c/web-platform-tests/css/css-color/color-mix-currentcolor-visited-getcomputedstyle.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,17 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>color-mix and currentcolor with :visited don't leak information via getComputedStyle</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/css/support/computed-testcommon.js"></script> | ||
|
||
<style> | ||
a:link { color: red; } | ||
a:visited { color: green; } | ||
</style> | ||
|
||
<a href=""><span id="target">This background should be green and not red</span></a> | ||
|
||
<script> | ||
test_computed_value("background-color", "color-mix(in srgb, currentcolor, white)", "color(srgb 1 0.5 0.5)", "should not leak :visited for computed style"); | ||
</script> |
10 changes: 10 additions & 0 deletions
10
...sts/imported/w3c/web-platform-tests/css/css-color/color-mix-currentcolor-visited-ref.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,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<meta charset="utf-8"> | ||
<title>currentcolor is taken from :visited pseudo-class correctly in color-mix()</title> | ||
<style> | ||
a { color: green; background-color: color-mix(in srgb, green, white 75%); } | ||
</style> | ||
|
||
<a href="unvisited">This background should be green and not red</a> | ||
</html> |
14 changes: 14 additions & 0 deletions
14
...utTests/imported/w3c/web-platform-tests/css/css-color/color-mix-currentcolor-visited.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,14 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<link rel="match" href="color-mix-currentcolor-visited-ref.html"> | ||
<title>currentcolor is taken from :visited pseudo-class correctly in color-mix()</title> | ||
<link rel="help" href="https://drafts.csswg.org/css-color-5/#color-mix"> | ||
<link rel="author" title="Matthieu Dubet" href="https://github.com/mdubet"> | ||
<style> | ||
a:link { color: red; } | ||
a:visited { color: green; } | ||
span { | ||
background-color: color-mix(in srgb, currentcolor, white 75%); | ||
} | ||
</style> | ||
<a href=""><span>This background should be green and not red</span></a> |
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
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