-
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
::marker
does not support defining CSS variables
https://bugs.webkit.org/show_bug.cgi?id=241566 rdar://problem/95551387 Reviewed by Tim Nguyen and Antti Koivisto. This aligns WebKit with Firefox and Chrome. It adds CSSPropertyCustom into isValidMarkerStyleProperty and isValidCueStyleProperty. This also adds two new Web Platform Tests for css marker. * LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-variable-computed-style-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-variable-computed-style.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-variable-expected.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-variable-ref.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-variable.html: Added. * Source/WebCore/style/PropertyAllowlist.cpp: (WebCore::Style::isValidMarkerStyleProperty): (WebCore::Style::isValidCueStyleProperty): Canonical link: https://commits.webkit.org/257711@main
- Loading branch information
Showing
6 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
...mported/w3c/web-platform-tests/css/css-pseudo/marker-variable-computed-style-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,6 @@ | ||
Item 1 | ||
Item 2 | ||
|
||
PASS getComputedStyle() for opacity defined by variable in ::marker | ||
PASS getComputedStyle() for color defined by variable in ::marker | ||
|
44 changes: 44 additions & 0 deletions
44
...tTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-variable-computed-style.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,44 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="author" title="Karl Dubost" href="https://github.com/karlcow" /> | ||
<link rel="help" href="https://w3c.github.io/csswg-drafts/css-pseudo/#marker-pseudo" /> | ||
<link rel="help" href="https://w3c.github.io/csswg-drafts/css-variables/#defining-variables" /> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<title>::marker with variables</title> | ||
<style> | ||
.firstTest::marker { | ||
--alpha: 0.75; | ||
color: rgba(0 128 0 / var(--alpha)); | ||
} | ||
|
||
.secondTest::marker { | ||
--color: rgb(0 128 0); | ||
color: var(--color); | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<ul> | ||
<li class="firstTest">Item 1</li> | ||
<li class="secondTest">Item 2</li> | ||
</ul> | ||
<script> | ||
test(() => { | ||
let firstTest = document.querySelector('.firstTest'); | ||
let markerStyle = getComputedStyle(firstTest, '::marker'); | ||
assert_equals(markerStyle.color, "rgba(0, 128, 0, 0.75)", "color is green with 0.75 opacity."); | ||
}, `getComputedStyle() for opacity defined by variable in ::marker`); | ||
test(() => { | ||
let secondTest = document.querySelector('.secondTest'); | ||
let markerStyle = getComputedStyle(secondTest, '::marker'); | ||
assert_equals(markerStyle.color, "rgb(0, 128, 0)", "color is green."); | ||
}, `getComputedStyle() for color defined by variable in ::marker`); | ||
</script> | ||
</body> | ||
|
||
</html> |
31 changes: 31 additions & 0 deletions
31
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-variable-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,31 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="author" title="Karl Dubost" href="https://github.com/karlcow" /> | ||
<link | ||
rel="help" | ||
href="https://w3c.github.io/csswg-drafts/css-pseudo/#marker-pseudo" | ||
/> | ||
<link | ||
rel="help" | ||
href="https://w3c.github.io/csswg-drafts/css-variables/#defining-variables" | ||
/> | ||
<title>::marker with variables</title> | ||
<style> | ||
.firstTest::marker { | ||
color: rgb(255 119 0 / 0.75); | ||
} | ||
|
||
.secondTest::marker { | ||
color: rgb(255 119 0); | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<ul> | ||
<li class="firstTest">Item 1</li> | ||
<li class="secondTest">Item 2</li> | ||
</ul> | ||
</body> | ||
</html> |
31 changes: 31 additions & 0 deletions
31
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-variable-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,31 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="author" title="Karl Dubost" href="https://github.com/karlcow" /> | ||
<link | ||
rel="help" | ||
href="https://w3c.github.io/csswg-drafts/css-pseudo/#marker-pseudo" | ||
/> | ||
<link | ||
rel="help" | ||
href="https://w3c.github.io/csswg-drafts/css-variables/#defining-variables" | ||
/> | ||
<title>::marker with variables</title> | ||
<style> | ||
.firstTest::marker { | ||
color: rgb(255 119 0 / 0.75); | ||
} | ||
|
||
.secondTest::marker { | ||
color: rgb(255 119 0); | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<ul> | ||
<li class="firstTest">Item 1</li> | ||
<li class="secondTest">Item 2</li> | ||
</ul> | ||
</body> | ||
</html> |
30 changes: 30 additions & 0 deletions
30
LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-variable.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,30 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="author" title="Karl Dubost" href="https://github.com/karlcow" /> | ||
<link rel="help" href="https://w3c.github.io/csswg-drafts/css-pseudo/#marker-pseudo" /> | ||
<link rel="help" href="https://w3c.github.io/csswg-drafts/css-variables/#defining-variables" /> | ||
<link rel="match" href="marker-variable-ref.html"> | ||
<title>::marker with variables</title> | ||
<style> | ||
.firstTest::marker { | ||
--alpha: 0.75; | ||
color: rgb(255 119 0 / var(--alpha)); | ||
} | ||
|
||
.secondTest::marker { | ||
--color: rgb(255 119 0); | ||
color: var(--color); | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<ul> | ||
<li class="firstTest">Item 1</li> | ||
<li class="secondTest">Item 2</li> | ||
</ul> | ||
</body> | ||
|
||
</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