Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bfa1b0b5543cf56d2db6e950c3f3aea114da8353
      
https://github.com/WebKit/WebKit/commit/bfa1b0b5543cf56d2db6e950c3f3aea114da8353
  Author: Kiet Ho <kiet...@apple.com>
  Date:   2024-09-12 (Thu, 12 Sep 2024)

  Changed paths:
    M Source/WebCore/css/CSSSelector.cpp
    M Source/WebCore/css/CSSSelector.h
    M Source/WebCore/css/SelectorChecker.cpp
    M Source/WebCore/css/SelectorCheckerTestFunctions.h
    M Source/WebCore/css/parser/CSSSelectorParser.cpp
    M Source/WebCore/css/parser/MutableCSSSelector.cpp
    M Source/WebCore/css/parser/MutableCSSSelector.h
    M Source/WebCore/cssjit/SelectorCompiler.cpp
    M Source/WebCore/style/RuleSet.cpp

  Log Message:
  -----------
  CSSSelector: distinguish between list of possibly-quoted-IDs and list of 
not-quoted-IDs
rdar://135608738
https://bugs.webkit.org/show_bug.cgi?id=279394

Reviewed by Antti Koivisto.

Some CSS pseudo-classes and pseudo-elements take a list of identifiers as 
arguments
(e.g: :active-view-transition-type(foo, bar, baz)). :lang() also takes a list of
identifiers, but they can optionally be quoted (e.g: :lang("en-US")), and we 
need to
remember if an argument is quoted or not for serialization purpose.

Currently, we store those identifiers in CSSSelector::argumentList, which is a 
vector of
PossiblyQuotedIdentifier (struct that stores the identifier string and whether 
it's quoted
or not). However, for pseudo-classes/elements that don't accept quoted 
identifiers,
at parsing time, we still have to convert bare identifiers into 
PossiblyQuotedIdentifier
for storage in CSSSeletor, and perform the reverse conversion at matching time.
Considering only :lang accepts quoted identifiers, we're doing this round-trip 
conversion
at a lot of places.

This commit changes argumentList to be a vector of bare identifiers only, and 
adds a new
vector of PossiblyQuotedIdentifier for :lang arguments. Only :lang code will 
use the
new vector, while other pseudo-classes/elements code will use the existing 
vector,
while not having to convert to and from PossiblyQuotedIdentifier.

This commit also adds a bunch of ASSERTs to ensure CSSSelector::argumentList is 
not null
before using it.

* Source/WebCore/css/CSSSelector.cpp:
(WebCore::simpleSelectorSpecificity):
(WebCore::appendCommaSeparatedIdentifierList):
(WebCore::CSSSelector::selectorText const):
(WebCore::CSSSelector::setArgumentList):
(WebCore::CSSSelector::setLangList):
(WebCore::CSSSelector::RareData::RareData):
* Source/WebCore/css/CSSSelector.h:
(WebCore::CSSSelector::argumentList const):
(WebCore::CSSSelector::langList const):
* Source/WebCore/css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne const):
* Source/WebCore/css/SelectorCheckerTestFunctions.h:
(WebCore::matchesLangPseudoClass):
(WebCore::matchesActiveViewTransitionTypePseudoClass):
* Source/WebCore/css/parser/CSSSelectorParser.cpp:
(WebCore::consumeCommaSeparatedCustomIdentList):
(WebCore::CSSSelectorParser::consumePseudo):
* Source/WebCore/css/parser/MutableCSSSelector.cpp:
(WebCore::MutableCSSSelector::setArgumentList):
(WebCore::MutableCSSSelector::setLangList):
* Source/WebCore/css/parser/MutableCSSSelector.h:
* Source/WebCore/cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::JSC_DEFINE_NOEXCEPT_JIT_OPERATION):
(WebCore::SelectorCompiler::addPseudoClassType):
* Source/WebCore/style/RuleSet.cpp:
(WebCore::Style::RuleSet::addRule):

Canonical link: https://commits.webkit.org/283545@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