Skip to content

Disallow vendor-prefixed and allow other properties in highlight pseudo-elements#62580

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
Ahmad-S792:eng/Disallow-vendor-prefixed-properties-in-highlight-pseudo-elements
Apr 13, 2026
Merged

Disallow vendor-prefixed and allow other properties in highlight pseudo-elements#62580
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
Ahmad-S792:eng/Disallow-vendor-prefixed-properties-in-highlight-pseudo-elements

Conversation

@Ahmad-S792
Copy link
Copy Markdown
Contributor

@Ahmad-S792 Ahmad-S792 commented Apr 12, 2026

a30d9c1

Disallow vendor-prefixed and allow other properties in highlight pseudo-elements
https://bugs.webkit.org/show_bug.cgi?id=312085
rdar://174590593

Reviewed by Antti Koivisto.

The CSS Pseudo 4 spec [1] states that vendor-prefixed properties such as
-webkit-text-fill-color are not applicable to highlight pseudo-elements.

This adds a PropertyAllowlist for highlight pseudos (::selection,
::highlight(), ::spelling-error, ::grammar-error, ::target-text) with
the spec-defined set of applicable properties: color, background-color,
text-decoration and sub-properties, text-shadow, stroke-color,
stroke-width, and custom properties.

Also consolidates propertyAllowlistForPseudoElement() and
determinePropertyAllowlist() to use switch statements instead of
repeated if-chains.

[1] https://drafts.csswg.org/css-pseudo-4/#highlight-styling

* LayoutTests/TestExpectations: Progressions
* LayoutTests/platform/ios/TestExpectations: Skip Test on iOS
* LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/highlight-cascade/highlight-cascade-007-expected.txt: Ditto
* Source/WebCore/style/PropertyAllowlist.cpp:
(WebCore::Style::propertyAllowlistForPseudoElement):
(WebCore::Style::isValidHighlightStyleProperty):
* Source/WebCore/style/PropertyAllowlist.h:
* Source/WebCore/style/PropertyCascade.cpp:
(WebCore::Style::PropertyCascade::addMatch):
* Source/WebCore/style/RuleData.cpp:
(WebCore::Style::determinePropertyAllowlist):
* Source/WebCore/style/RuleData.h:

Canonical link: https://commits.webkit.org/311073@main

9c63fcc

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ⏳ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ❌ 🧪 win-tests ⏳ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ⏳ 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@Ahmad-S792 Ahmad-S792 self-assigned this Apr 12, 2026
@Ahmad-S792 Ahmad-S792 added the CSS Cascading Style Sheets implementation label Apr 12, 2026
@Ahmad-S792 Ahmad-S792 marked this pull request as draft April 12, 2026 08:05
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Apr 12, 2026
@Ahmad-S792 Ahmad-S792 removed the merging-blocked Applied to prevent a change from being merged label Apr 12, 2026
@Ahmad-S792 Ahmad-S792 changed the title Disallow vendor-prefixed properties in highlight pseudo-elements Disallow vendor-prefixed and allow other properties in highlight pseudo-elements Apr 12, 2026
@Ahmad-S792 Ahmad-S792 force-pushed the eng/Disallow-vendor-prefixed-properties-in-highlight-pseudo-elements branch from bd5b74a to 2e84a96 Compare April 12, 2026 10:24
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Apr 12, 2026
@Ahmad-S792 Ahmad-S792 removed the merging-blocked Applied to prevent a change from being merged label Apr 12, 2026
@Ahmad-S792 Ahmad-S792 force-pushed the eng/Disallow-vendor-prefixed-properties-in-highlight-pseudo-elements branch from 2e84a96 to 3ee5ba3 Compare April 12, 2026 21:34
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Apr 12, 2026
@Ahmad-S792 Ahmad-S792 removed the merging-blocked Applied to prevent a change from being merged label Apr 12, 2026
@Ahmad-S792 Ahmad-S792 force-pushed the eng/Disallow-vendor-prefixed-properties-in-highlight-pseudo-elements branch from 3ee5ba3 to 9c63fcc Compare April 12, 2026 22:30
@Ahmad-S792 Ahmad-S792 marked this pull request as ready for review April 12, 2026 23:26
@Ahmad-S792 Ahmad-S792 requested review from anttijk, graouts and nt1m April 12, 2026 23:26
@Ahmad-S792 Ahmad-S792 added the merge-queue Applied to send a pull request to merge-queue label Apr 13, 2026
…do-elements

https://bugs.webkit.org/show_bug.cgi?id=312085
rdar://174590593

Reviewed by Antti Koivisto.

The CSS Pseudo 4 spec [1] states that vendor-prefixed properties such as
-webkit-text-fill-color are not applicable to highlight pseudo-elements.

This adds a PropertyAllowlist for highlight pseudos (::selection,
::highlight(), ::spelling-error, ::grammar-error, ::target-text) with
the spec-defined set of applicable properties: color, background-color,
text-decoration and sub-properties, text-shadow, stroke-color,
stroke-width, and custom properties.

Also consolidates propertyAllowlistForPseudoElement() and
determinePropertyAllowlist() to use switch statements instead of
repeated if-chains.

[1] https://drafts.csswg.org/css-pseudo-4/#highlight-styling

* LayoutTests/TestExpectations: Progressions
* LayoutTests/platform/ios/TestExpectations: Skip Test on iOS
* LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/highlight-cascade/highlight-cascade-007-expected.txt: Ditto
* Source/WebCore/style/PropertyAllowlist.cpp:
(WebCore::Style::propertyAllowlistForPseudoElement):
(WebCore::Style::isValidHighlightStyleProperty):
* Source/WebCore/style/PropertyAllowlist.h:
* Source/WebCore/style/PropertyCascade.cpp:
(WebCore::Style::PropertyCascade::addMatch):
* Source/WebCore/style/RuleData.cpp:
(WebCore::Style::determinePropertyAllowlist):
* Source/WebCore/style/RuleData.h:

Canonical link: https://commits.webkit.org/311073@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Disallow-vendor-prefixed-properties-in-highlight-pseudo-elements branch from 9c63fcc to a30d9c1 Compare April 13, 2026 11:51
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 311073@main (a30d9c1): https://commits.webkit.org/311073@main

Reviewed commits have been landed. Closing PR #62580 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit a30d9c1 into WebKit:main Apr 13, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CSS Cascading Style Sheets implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants