[webkit-changes] [WebKit/WebKit] 7e31f2: :lang() selectors should serialize without quotati...
Darin Adler
noreply at github.com
Sat Nov 12 07:54:12 PST 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7e31f273a4e1bc368bb568101db621e4c9a084e2
https://github.com/WebKit/WebKit/commit/7e31f273a4e1bc368bb568101db621e4c9a084e2
Author: Darin Adler <darin at apple.com>
Date: 2022-11-12 (Sat, 12 Nov 2022)
Changed paths:
M LayoutTests/fast/css/css-lang-selector-with-string-arguments-text-expected.txt
M LayoutTests/fast/css/css-lang-selector-with-string-arguments-text.html
M LayoutTests/fast/css/css-selector-text-expected.txt
M LayoutTests/fast/css/css-selector-text.html
M LayoutTests/fast/css/css-set-selector-text-expected.txt
M LayoutTests/fast/css/css-set-selector-text.html
M LayoutTests/fast/css/parsing-css-lang-expected.txt
M LayoutTests/fast/css/parsing-css-lang.html
M LayoutTests/fast/dom/css-selectorText-expected.txt
R LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSS-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleRule-set-selectorText-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/css/cssom/selectorSerialize-expected.txt
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/CSSParserSelector.cpp
M Source/WebCore/css/parser/CSSParserSelector.h
M Source/WebCore/css/parser/CSSSelectorParser.cpp
M Source/WebCore/cssjit/SelectorCompiler.cpp
Log Message:
-----------
:lang() selectors should serialize without quotation marks if they were parsed without them
https://bugs.webkit.org/show_bug.cgi?id=247747
rdar://problem/102198822
Reviewed by Ryosuke Niwa.
Changed so we keep a record of whether a language was specified as an identifier or a string
when parsing the lang selector. This affects serialization, otherwise ignored.
* LayoutTests/fast/css/css-lang-selector-with-string-arguments-text-expected.txt: Updated.
* LayoutTests/fast/css/css-lang-selector-with-string-arguments-text.html: Updated test to not
expect quotation marks around lang values that are unquoted identifiers.
* LayoutTests/fast/css/css-selector-text-expected.txt: Ditto.
* LayoutTests/fast/css/css-selector-text.html: Ditto.
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSS-expected.txt: Removed.
There is no corresponding test for this expected result, presumably left behind by accident.
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleRule-set-selectorText-expected.txt:
Expect more PASS.
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/selectorSerialize-expected.txt: Ditto.
* Source/WebCore/css/CSSSelector.cpp:
(WebCore::appendLangArgumentList): Use serializeIdentifier and serializeString for correct quoting
and select which one based on the wasQuoted flag in PossiblyQuotedIdentifier.
(WebCore::CSSSelector::selectorText const): Take an additional separator argument,
and rearranged code a bit. Also updated for PossiblyQuotedIdentifier.
(WebCore::CSSSelector::setArgumentList): New argument type.
* Source/WebCore/css/CSSSelector.h: Added PossiblyQuotedIdentifier. Initialize data members in the
class definition so we don't have to do it in all the constructors. Tweaked comment format a bit.
Changed type of argumentList. Moved inline function bodies out of the class. Deleted the assignment
operator instead of declaring it private an just not defining it. Use a FixedVector for
argumentList instead of a unique_ptr<Vector>.
* Source/WebCore/css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne const): Removed unneeded braces.
* Source/WebCore/css/SelectorCheckerTestFunctions.h:
(WebCore::matchesLangPseudoClass): Updated for change in type.
* Source/WebCore/css/parser/CSSParserSelector.cpp:
(WebCore::CSSParserSelector::setArgumentList): Ditto.
* Source/WebCore/css/parser/CSSParserSelector.h: Ditto.
* Source/WebCore/css/parser/CSSSelectorParser.cpp:
(WebCore::consumePossiblyQuotedIdentifer): Added.
(WebCore::consumeLangArgumentList): Updated to return the new type, also cut down on repeated code
by using the consumePossiblyQuotedIdentifer function.
(WebCore::CSSSelectorParser::consumePseudo): Updated for the above.
* Source/WebCore/cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType): Update for the new type.
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsInLanguage): Ditto.
Canonical link: https://commits.webkit.org/256603@main
More information about the webkit-changes
mailing list