Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 85f439ac76ff4256c6a9e662e309e82b11da10f4
      
https://github.com/WebKit/WebKit/commit/85f439ac76ff4256c6a9e662e309e82b11da10f4
  Author: Matthieu Dubet <m_du...@apple.com>
  Date:   2024-10-01 (Tue, 01 Oct 2024)

  Changed paths:
    M LayoutTests/fast/css/cssom-insertrule-crash-expected.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/nested-declarations-matching-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/nested-declarations-matching.html
    M Source/WebCore/css/CSSGroupingRule.cpp
    M Source/WebCore/css/CSSRule.cpp
    M Source/WebCore/css/CSSRule.h
    M Source/WebCore/css/CSSStyleRule.cpp
    M Source/WebCore/css/parser/CSSParser.cpp
    M Source/WebCore/css/parser/CSSParser.h
    M Source/WebCore/css/parser/CSSParserEnum.h
    M Source/WebCore/css/parser/CSSParserImpl.cpp
    M Source/WebCore/css/parser/CSSParserImpl.h
    M Source/WebCore/css/parser/CSSSelectorParser.cpp
    M Source/WebCore/css/parser/CSSSelectorParser.h
    M Source/WebCore/css/parser/CSSSupportsParser.cpp
    M Source/WebCore/css/parser/CSSSupportsParser.h
    M Source/WebCore/inspector/InspectorStyleSheet.cpp

  Log Message:
  -----------
  [CSS] Fix nested setSelectorText() to prepend implicit selector
https://bugs.webkit.org/show_bug.cgi?id=280446
rdar://136791222

Reviewed by Antti Koivisto.

Previously, CSSParserImpl was doing the implicit selector prepend.
However when using the CSSOM setSelectorText(), we don't use CSSParserImpl at 
all.

This patch:
  * adds more information in the NestedContext structure (kind of the closest 
ancestor rule)
  * moves the implicit selector preprend from CSSParserImpl to CSSSelectorParser
  * passes the NestedContext to the selector parser on setSelectorText()
  * cleanups some unused parameter or redundant members

* LayoutTests/fast/css/cssom-insertrule-crash-expected.html:

Fix wrong expectations (the & selector should always be serialized)

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/nested-declarations-matching-expected.txt:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-nesting/nested-declarations-matching.html:
* Source/WebCore/css/CSSGroupingRule.cpp:
(WebCore::CSSGroupingRule::insertRule):
* Source/WebCore/css/CSSRule.cpp:
(WebCore::CSSRule::parserContext const):
(WebCore::CSSRule::nestedContext const):
* Source/WebCore/css/CSSRule.h:
* Source/WebCore/css/CSSStyleRule.cpp:
(WebCore::CSSStyleRule::setSelectorText):
(WebCore::CSSStyleRule::insertRule):
* Source/WebCore/css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseSupportsCondition):
* Source/WebCore/css/parser/CSSParser.h:
(WebCore::CSSParser::parseRule):
(WebCore::CSSParser::parseSelectorList):
* Source/WebCore/css/parser/CSSParserEnum.h:
* Source/WebCore/css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::CSSParserImpl):
(WebCore::CSSParserImpl::consumeQualifiedRule):
(WebCore::CSSParserImpl::consumeImportRule):
(WebCore::CSSParserImpl::consumeSupportsRule):
(WebCore::CSSParserImpl::consumeScopeRule):
(WebCore::CSSParserImpl::consumeStyleRule):
(WebCore::CSSParserImpl::consumeBlockContent):
(WebCore::appendImplicitSelectorPseudoClassScopeIfNeeded): Deleted.
(WebCore::appendImplicitSelectorNestingParentIfNeeded): Deleted.
(WebCore::CSSParserImpl::appendImplicitSelectorIfNeeded): Deleted.
* Source/WebCore/css/parser/CSSParserImpl.h:
(WebCore::CSSParserImpl::CSSParserImpl):
(WebCore::CSSParserImpl::parseRule):
(WebCore::CSSParserImpl::isStyleNestedContext):
(WebCore::CSSParserImpl::lastAncestorRuleType const):
(WebCore::CSSParserImpl::isNestedContext): Deleted.

Remove unused m_scopeRuleNestingLevel (we only need m_styleRuleNestingLevel)

* Source/WebCore/css/parser/CSSSelectorParser.cpp:
(WebCore::appendImplicitSelectorPseudoClassScopeIfNeeded):
(WebCore::appendImplicitSelectorNestingParentIfNeeded):
(WebCore::appendImplicitSelectorIfNeeded):
(WebCore::parseMutableCSSSelectorList):
* Source/WebCore/css/parser/CSSSelectorParser.h:
(WebCore::CSSSelectorParser::CSSSelectorParser):
(WebCore::parseCSSSelectorList):
* Source/WebCore/css/parser/CSSSupportsParser.cpp:
(WebCore::CSSSupportsParser::supportsCondition):
* Source/WebCore/css/parser/CSSSupportsParser.h:
(WebCore::CSSSupportsParser::CSSSupportsParser):

Remove unused isNestedContext parameter

* Source/WebCore/inspector/InspectorStyleSheet.cpp:
(WebCore::isValidRuleHeaderText):
(WebCore::InspectorStyleSheet::setRuleHeaderText):
(WebCore::isNestedContext): Deleted.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to