Skip to content

Commit

Permalink
[css-nesting] Remove feature flag
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=270793
rdar://124389194

Reviewed by Matthieu Dubet and Anne van Kesteren.

Some WebVTT user agent CSS and WebInspector CSS are starting to rely on nesting, turning it off will break core functionality.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/css/CSSStyleRule.idl:
* Source/WebCore/css/parser/CSSParserContext.cpp:
(WebCore::add):
* Source/WebCore/css/parser/CSSParserContext.h:
* Source/WebCore/css/parser/CSSParserImpl.h:
(WebCore::CSSParserImpl::isStyleNestedContext):
* Source/WebCore/css/parser/CSSSelectorParser.cpp:
(WebCore::CSSSelectorParser::consumeSimpleSelector):
* Source/WebCore/css/parser/CSSSelectorParserContext.cpp:
(WebCore::CSSSelectorParserContext::CSSSelectorParserContext):
(WebCore::add):
* Source/WebCore/css/parser/CSSSelectorParserContext.h:

Canonical link: https://commits.webkit.org/275922@main
  • Loading branch information
nt1m committed Mar 11, 2024
1 parent 0a93df5 commit e7871ab
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 40 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 @@ -1183,20 +1183,6 @@ CSSMotionPathEnabled:
WebCore:
default: true

CSSNestingEnabled:
type: bool
status: stable
category: css
humanReadableName: "CSS Nesting"
humanReadableDescription: "Enable support for CSS nesting https://www.w3.org/TR/css-nesting-1/"
defaultValue:
WebKitLegacy:
default: true
WebKit:
default: true
WebCore:
default: true

CSSOMViewScrollingAPIEnabled:
type: bool
status: stable
Expand Down
6 changes: 3 additions & 3 deletions Source/WebCore/css/CSSStyleRule.idl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ typedef USVString CSSOMString;
// https://drafts.css-houdini.org/css-typed-om/#declared-stylepropertymap-objects
[SameObject, EnabledBySetting=CSSTypedOMEnabled] readonly attribute StylePropertyMap styleMap;

[EnabledBySetting=CSSNestingEnabled, SameObject] readonly attribute CSSRuleList cssRules;
[EnabledBySetting=CSSNestingEnabled] unsigned long insertRule(CSSOMString rule, optional unsigned long index = 0);
[EnabledBySetting=CSSNestingEnabled] undefined deleteRule(unsigned long index);
[SameObject] readonly attribute CSSRuleList cssRules;
unsigned long insertRule(CSSOMString rule, optional unsigned long index = 0);
undefined deleteRule(unsigned long index);
};
30 changes: 14 additions & 16 deletions Source/WebCore/css/parser/CSSParserContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ CSSParserContext::CSSParserContext(const Document& document, const URL& sheetBas
, gradientInterpolationColorSpacesEnabled { document.settings().cssGradientInterpolationColorSpacesEnabled() }
, subgridEnabled { document.settings().subgridEnabled() }
, masonryEnabled { document.settings().masonryEnabled() }
, cssNestingEnabled { document.settings().cssNestingEnabled() }
#if ENABLE(CSS_PAINTING_API)
, cssPaintingAPIEnabled { document.settings().cssPaintingAPIEnabled() }
#endif
Expand Down Expand Up @@ -147,23 +146,22 @@ void add(Hasher& hasher, const CSSParserContext& context)
| context.gradientInterpolationColorSpacesEnabled << 15
| context.subgridEnabled << 16
| context.masonryEnabled << 17
| context.cssNestingEnabled << 18
| context.cssPaintingAPIEnabled << 19
| context.cssScopeAtRuleEnabled << 20
| context.cssTextUnderlinePositionLeftRightEnabled << 21
| context.cssWordBreakAutoPhraseEnabled << 22
| context.popoverAttributeEnabled << 23
| context.sidewaysWritingModesEnabled << 24
| context.cssTextWrapPrettyEnabled << 25
| context.highlightAPIEnabled << 26
| context.grammarAndSpellingPseudoElementsEnabled << 27
| context.customStateSetEnabled << 28
| context.thumbAndTrackPseudoElementsEnabled << 29
| 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
#if ENABLE(SERVICE_CONTROLS)
| context.imageControlsEnabled << 30
| context.imageControlsEnabled << 29
#endif
| context.lightDarkEnabled << 31
| (uint64_t)context.mode << 32; // This is multiple bits, so keep it last.
| context.lightDarkEnabled << 30
| (uint64_t)context.mode << 31; // 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 @@ -91,7 +91,6 @@ struct CSSParserContext {
bool gradientInterpolationColorSpacesEnabled : 1 { false };
bool subgridEnabled : 1 { false };
bool masonryEnabled : 1 { false };
bool cssNestingEnabled : 1 { false };
bool cssPaintingAPIEnabled : 1 { false };
bool cssScopeAtRuleEnabled : 1 { false };
bool cssStartingStyleAtRuleEnabled : 1 { false };
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/css/parser/CSSParserImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class CSSParserImpl {

bool isStyleNestedContext()
{
return (m_isAlwaysNestedContext == CSSParserEnum::IsNestedContext::Yes || m_styleRuleNestingLevel) && context().cssNestingEnabled;
return m_isAlwaysNestedContext == CSSParserEnum::IsNestedContext::Yes || m_styleRuleNestingLevel;
}

bool isNestedContext()
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/css/parser/CSSSelectorParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ std::unique_ptr<MutableCSSSelector> CSSSelectorParser::consumeSimpleSelector(CSS
selector = consumeId(range);
else if (token.type() == DelimiterToken && token.delimiter() == '.')
selector = consumeClass(range);
else if (token.type() == DelimiterToken && token.delimiter() == '&' && m_context.cssNestingEnabled)
else if (token.type() == DelimiterToken && token.delimiter() == '&')
selector = consumeNesting(range);
else if (token.type() == LeftBracketToken)
selector = consumeAttribute(range);
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 @@ -34,7 +34,6 @@ namespace WebCore {

CSSSelectorParserContext::CSSSelectorParserContext(const CSSParserContext& context)
: mode(context.mode)
, cssNestingEnabled(context.cssNestingEnabled)
, customStateSetEnabled(context.customStateSetEnabled)
, focusVisibleEnabled(context.focusVisibleEnabled)
, grammarAndSpellingPseudoElementsEnabled(context.grammarAndSpellingPseudoElementsEnabled)
Expand All @@ -51,7 +50,6 @@ CSSSelectorParserContext::CSSSelectorParserContext(const CSSParserContext& conte

CSSSelectorParserContext::CSSSelectorParserContext(const Document& document)
: mode(document.inQuirksMode() ? HTMLQuirksMode : HTMLStandardMode)
, cssNestingEnabled(document.settings().cssNestingEnabled())
, customStateSetEnabled(document.settings().customStateSetEnabled())
, focusVisibleEnabled(document.settings().focusVisibleEnabled())
, grammarAndSpellingPseudoElementsEnabled(document.settings().grammarAndSpellingPseudoElementsEnabled())
Expand All @@ -70,7 +68,6 @@ void add(Hasher& hasher, const CSSSelectorParserContext& context)
{
add(hasher,
context.mode,
context.cssNestingEnabled,
context.customStateSetEnabled,
context.focusVisibleEnabled,
context.grammarAndSpellingPseudoElementsEnabled,
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 @@ -36,7 +36,6 @@ class Document;

struct CSSSelectorParserContext {
CSSParserMode mode { CSSParserMode::HTMLStandardMode };
bool cssNestingEnabled { false };
bool customStateSetEnabled { false };
bool focusVisibleEnabled { false };
bool grammarAndSpellingPseudoElementsEnabled { false };
Expand Down

0 comments on commit e7871ab

Please sign in to comment.