Skip to content

Commit

Permalink
Remove HasPseudoClassEnabled preference
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=271151

Reviewed by Antti Koivisto.

It's been stable for over a year.

Potentially some more code could be cleaned up in
ContentExtensionParser given how this was added in 259068@main, but
changes have been made there meanwhile and this might well be needed
for other CSS-related preferences in the future.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/contentextensions/ContentExtensionParser.cpp:
(WebCore::ContentExtensions::isValidCSSSelector):
(WebCore::ContentExtensions::contentExtensionCSSParserContext):
* Source/WebCore/css/CSSPseudoSelectors.json:
* Source/WebCore/css/parser/CSSParserContext.cpp:
(WebCore::add):
* Source/WebCore/css/parser/CSSParserContext.h:
* Source/WebCore/css/parser/CSSSelectorParserContext.cpp:
(WebCore::CSSSelectorParserContext::CSSSelectorParserContext):
(WebCore::add):
* Source/WebCore/css/parser/CSSSelectorParserContext.h:

Canonical link: https://commits.webkit.org/276272@main
  • Loading branch information
annevk committed Mar 18, 2024
1 parent 904dc91 commit e13808a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 44 deletions.
14 changes: 0 additions & 14 deletions Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2981,20 +2981,6 @@ HTTPEquivEnabled:
WebCore:
default: true

HasPseudoClassEnabled:
type: bool
status: stable
category: css
humanReadableName: ":has() pseudo-class"
humanReadableDescription: "Enable :has() pseudo-class"
defaultValue:
WebKitLegacy:
default: true
WebKit:
default: true
WebCore:
default: true

HiddenPageCSSAnimationSuspensionEnabled:
type: bool
status: embedder
Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/contentextensions/ContentExtensionParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,13 @@ bool isValidCSSSelector(const String& selector)
// we want to use quirks mode in parsing, but automatic mode when actually applying the content blocker styles.
// FIXME: rdar://105733691 (Parse/apply content blocker style sheets in both standards and quirks mode lazily).
WebCore::CSSParserContext context(HTMLQuirksMode);
context.hasPseudoClassEnabled = true;
CSSParser parser(context);
return !!parser.parseSelectorList(selector);
}

WebCore::CSSParserContext contentExtensionCSSParserContext()
{
WebCore::CSSParserContext context(HTMLStandardMode);
context.hasPseudoClassEnabled = true;
return context;
}

Expand Down
3 changes: 1 addition & 2 deletions Source/WebCore/css/CSSPseudoSelectors.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@
"conditional": "ENABLE(VIDEO)"
},
"has": {
"argument": "required",
"settings-flag": "hasPseudoClassEnabled"
"argument": "required"
},
"horizontal": {
"comment": "For scrollbar styling.",
Expand Down
40 changes: 19 additions & 21 deletions Source/WebCore/css/parser/CSSParserContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ CSSParserContext::CSSParserContext(const Document& document, const URL& sheetBas
#endif
, useLegacyBackgroundSizeShorthandBehavior { document.settings().useLegacyBackgroundSizeShorthandBehavior() }
, focusVisibleEnabled { document.settings().focusVisibleEnabled() }
, hasPseudoClassEnabled { document.settings().hasPseudoClassEnabled() }
, cascadeLayersEnabled { document.settings().cssCascadeLayersEnabled() }
, gradientPremultipliedAlphaInterpolationEnabled { document.settings().cssGradientPremultipliedAlphaInterpolationEnabled() }
, gradientInterpolationColorSpacesEnabled { document.settings().cssGradientInterpolationColorSpacesEnabled() }
Expand Down Expand Up @@ -139,28 +138,27 @@ void add(Hasher& hasher, const CSSParserContext& context)
#endif
| context.useLegacyBackgroundSizeShorthandBehavior << 10
| context.focusVisibleEnabled << 11
| context.hasPseudoClassEnabled << 12
| context.cascadeLayersEnabled << 13
| context.gradientPremultipliedAlphaInterpolationEnabled << 14
| context.gradientInterpolationColorSpacesEnabled << 15
| context.masonryEnabled << 16
| context.cssNestingEnabled << 17
| context.cssPaintingAPIEnabled << 18
| context.cssScopeAtRuleEnabled << 19
| context.cssTextUnderlinePositionLeftRightEnabled << 20
| context.cssWordBreakAutoPhraseEnabled << 21
| context.popoverAttributeEnabled << 22
| context.sidewaysWritingModesEnabled << 23
| context.cssTextWrapPrettyEnabled << 24
| context.highlightAPIEnabled << 25
| context.grammarAndSpellingPseudoElementsEnabled << 26
| context.customStateSetEnabled << 27
| context.thumbAndTrackPseudoElementsEnabled << 28
| context.cascadeLayersEnabled << 12
| context.gradientPremultipliedAlphaInterpolationEnabled << 13
| context.gradientInterpolationColorSpacesEnabled << 14
| context.masonryEnabled << 15
| context.cssNestingEnabled << 16
| context.cssPaintingAPIEnabled << 17
| context.cssScopeAtRuleEnabled << 18
| context.cssTextUnderlinePositionLeftRightEnabled << 19
| context.cssWordBreakAutoPhraseEnabled << 20
| context.popoverAttributeEnabled << 21
| context.sidewaysWritingModesEnabled << 22
| context.cssTextWrapPrettyEnabled << 23
| context.highlightAPIEnabled << 24
| context.grammarAndSpellingPseudoElementsEnabled << 25
| context.customStateSetEnabled << 26
| context.thumbAndTrackPseudoElementsEnabled << 27
#if ENABLE(SERVICE_CONTROLS)
| context.imageControlsEnabled << 29
| context.imageControlsEnabled << 28
#endif
| context.lightDarkEnabled << 30
| (uint64_t)context.mode << 31; // This is multiple bits, so keep it last.
| context.lightDarkEnabled << 29
| (uint64_t)context.mode << 30; // This is multiple bits, so keep it last.
add(hasher, context.baseURL, context.charset, context.propertySettings, bits);
}

Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/css/parser/CSSParserContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ struct CSSParserContext {
#endif
bool useLegacyBackgroundSizeShorthandBehavior : 1 { false };
bool focusVisibleEnabled : 1 { false };
bool hasPseudoClassEnabled : 1 { false };
bool cascadeLayersEnabled : 1 { false };
bool gradientPremultipliedAlphaInterpolationEnabled : 1 { false };
bool gradientInterpolationColorSpacesEnabled : 1 { false };
Expand Down
3 changes: 0 additions & 3 deletions Source/WebCore/css/parser/CSSSelectorParserContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ CSSSelectorParserContext::CSSSelectorParserContext(const CSSParserContext& conte
, customStateSetEnabled(context.customStateSetEnabled)
, focusVisibleEnabled(context.focusVisibleEnabled)
, grammarAndSpellingPseudoElementsEnabled(context.grammarAndSpellingPseudoElementsEnabled)
, hasPseudoClassEnabled(context.hasPseudoClassEnabled)
, highlightAPIEnabled(context.highlightAPIEnabled)
#if ENABLE(SERVICE_CONTROLS)
, imageControlsEnabled(context.imageControlsEnabled)
Expand All @@ -55,7 +54,6 @@ CSSSelectorParserContext::CSSSelectorParserContext(const Document& document)
, customStateSetEnabled(document.settings().customStateSetEnabled())
, focusVisibleEnabled(document.settings().focusVisibleEnabled())
, grammarAndSpellingPseudoElementsEnabled(document.settings().grammarAndSpellingPseudoElementsEnabled())
, hasPseudoClassEnabled(document.settings().hasPseudoClassEnabled())
, highlightAPIEnabled(document.settings().highlightAPIEnabled())
#if ENABLE(SERVICE_CONTROLS)
, imageControlsEnabled(document.settings().imageControlsEnabled())
Expand All @@ -74,7 +72,6 @@ void add(Hasher& hasher, const CSSSelectorParserContext& context)
context.customStateSetEnabled,
context.focusVisibleEnabled,
context.grammarAndSpellingPseudoElementsEnabled,
context.hasPseudoClassEnabled,
context.highlightAPIEnabled,
#if ENABLE(SERVICE_CONTROLS)
context.imageControlsEnabled,
Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/css/parser/CSSSelectorParserContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ struct CSSSelectorParserContext {
bool customStateSetEnabled { false };
bool focusVisibleEnabled { false };
bool grammarAndSpellingPseudoElementsEnabled { false };
bool hasPseudoClassEnabled { false };
bool highlightAPIEnabled { false };
#if ENABLE(SERVICE_CONTROLS)
bool imageControlsEnabled { false };
Expand Down

0 comments on commit e13808a

Please sign in to comment.