Changeset 270955 in webkit
- Timestamp:
- Dec 17, 2020 3:21:58 PM (19 months ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/parser/CSSSelectorParser.cpp (modified) (7 diffs)
-
Source/WebCore/css/parser/CSSSelectorParser.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r270950 r270955 1 2020-12-17 Manuel Rego Casasnovas <rego@igalia.com> 2 3 [selectors] Default namespace gets ignored inside non-type selectors for :is() and :not() 4 https://bugs.webkit.org/show_bug.cgi?id=219950 5 6 Reviewed by Antti Koivisto. 7 8 * TestExpectations: Two WPT tests pass now. 9 1 10 2020-12-17 Truitt Savell <tsavell@apple.com> 2 11 -
trunk/LayoutTests/TestExpectations
r270933 r270955 1234 1234 webkit.org/b/185859 imported/w3c/web-platform-tests/css/selectors/focus-visible-002.html [ Skip ] 1235 1235 webkit.org/b/185859 imported/w3c/web-platform-tests/css/selectors/focus-visible-012.html [ Skip ] 1236 webkit.org/b/219950 imported/w3c/web-platform-tests/css/selectors/is-default-ns-002.html [ ImageOnlyFailure ]1237 1236 webkit.org/b/217904 imported/w3c/web-platform-tests/css/selectors/is-where-visited.html [ ImageOnlyFailure ] 1238 webkit.org/b/219950 imported/w3c/web-platform-tests/css/selectors/not-default-ns-002.html [ ImageOnlyFailure ]1239 1237 webkit.org/b/64861 imported/w3c/web-platform-tests/css/selectors/selectors-dir-selector-change-001.html [ ImageOnlyFailure ] 1240 1238 webkit.org/b/64861 imported/w3c/web-platform-tests/css/selectors/selectors-dir-selector-change-002.html [ ImageOnlyFailure ] -
trunk/Source/WebCore/ChangeLog
r270952 r270955 1 2020-12-17 Manuel Rego Casasnovas <rego@igalia.com> 2 3 [selectors] Default namespace gets ignored inside non-type selectors for :is() and :not() 4 https://bugs.webkit.org/show_bug.cgi?id=219950 5 6 Reviewed by Antti Koivisto. 7 8 Based on Blink r820500 and r820557 by <andruud@chromium.org>. 9 10 Default namespace declarations do not affect the compound selector 11 representing the subject of any selector within a :is() or :not() pseudo-class, 12 unless that compound selector contains an explicit universal selector or type selector. 13 Spec: https://drafts.csswg.org/selectors-4/#matches 14 15 This patch aligns WebKit implementation with Chromium and Firefox, so two WPT tests pass now. 16 17 * css/parser/CSSSelectorParser.cpp: 18 (WebCore::atEndIgnoringWhitespace): 19 (WebCore::CSSSelectorParser::consumeCompoundSelector): 20 (WebCore::CSSSelectorParser::consumePseudo): 21 (WebCore::CSSSelectorParser::defaultNamespace const): 22 * css/parser/CSSSelectorParser.h: 23 1 24 2020-12-17 Eric Carlson <eric.carlson@apple.com> 2 25 -
trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp
r268741 r270955 33 33 #include <memory> 34 34 #include <wtf/OptionSet.h> 35 #include <wtf/SetForScope.h> 35 36 #include <wtf/text/StringBuilder.h> 36 37 … … 325 326 } 326 327 328 static bool atEndIgnoringWhitespace(CSSParserTokenRange range) 329 { 330 range.consumeWhitespace(); 331 return range.atEnd(); 332 } 333 327 334 std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeCompoundSelector(CSSParserTokenRange& range) 328 335 { … … 332 339 AtomString elementName; 333 340 CSSSelector::PseudoElementType compoundPseudoElement = CSSSelector::PseudoElementUnknown; 334 if (!consumeName(range, elementName, namespacePrefix)) { 341 const bool hasName = consumeName(range, elementName, namespacePrefix); 342 if (!hasName) { 335 343 compoundSelector = consumeSimpleSelector(range); 336 344 if (!compoundSelector) … … 357 365 } 358 366 367 368 // While inside a nested selector like :is(), the default namespace shall be ignored when [1]: 369 // * The compound selector represents the subject [2], and 370 // * The compound selector does not contain a type/universal selector. 371 // 372 // [1] https://drafts.csswg.org/selectors/#matches 373 // [2] https://drafts.csswg.org/selectors/#selector-subject 374 SetForScope<bool> ignoreDefaultNamespace(m_ignoreDefaultNamespace, m_resistDefaultNamespace && !hasName && atEndIgnoringWhitespace(range)); 359 375 if (!compoundSelector) { 360 376 AtomString namespaceURI = determineNamespace(namespacePrefix); … … 599 615 switch (selector->pseudoClassType()) { 600 616 case CSSSelector::PseudoClassNot: { 617 SetForScope<bool> resistDefaultNamespace(m_resistDefaultNamespace, true); 601 618 DisallowPseudoElementsScope scope(*this); 602 619 auto selectorList = makeUnique<CSSSelectorList>(); … … 647 664 case CSSSelector::PseudoClassMatches: 648 665 case CSSSelector::PseudoClassWhere: { 666 SetForScope<bool> resistDefaultNamespace(m_resistDefaultNamespace, true); 649 667 DisallowPseudoElementsScope scope(*this); 650 668 auto selectorList = makeUnique<CSSSelectorList>(); … … 898 916 const AtomString& CSSSelectorParser::defaultNamespace() const 899 917 { 900 if (!m_styleSheet )918 if (!m_styleSheet || m_ignoreDefaultNamespace) 901 919 return starAtom(); 902 920 return m_styleSheet->defaultNamespace(); -
trunk/Source/WebCore/css/parser/CSSSelectorParser.h
r268741 r270955 86 86 bool m_failedParsing { false }; 87 87 bool m_disallowPseudoElements { false }; 88 bool m_resistDefaultNamespace { false }; 89 bool m_ignoreDefaultNamespace { false }; 88 90 }; 89 91
Note: See TracChangeset
for help on using the changeset viewer.