Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Issue 1616423003: Fix selector namespace prefix resolution. (Closed)

Created:
4 years, 11 months ago by rune
Modified:
4 years, 11 months ago
Reviewers:
Timothy Loh, dgozman
CC:
chromium-reviews, blink-reviews-html_chromium.org, blink-reviews-style_chromium.org, blink-reviews-css, sof, eae+blinkwatch, blink-reviews-dom_chromium.org, dglazkov+blink, apavlov+blink_chromium.org, darktears, blink-reviews, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix selector namespace prefix resolution. When parsed without a stylesheet context, there are no prefix to namespace URI mapping, so a ns name prefixed selector should be invalid. Instead, we mapped "ns|e" to "*|e". Here, we instead make "ns|e" invalid in contexts where there is no stylesheet. However, "|e" and "*|e" should still be valid, so that part of the prefix resolution is moved from the stylesheet to the selector parser. This meant that prefix resolution was incorrect for the select attribute of the content element. Also, prefixes in Selectors API were handled outside of the selector parsing instead. Now we handle it inside the selector parsing instead which means that we throw a SyntaxError instead of a NamespaceError for unresolved namespace prefixes in the Selectors API. This is in line with the specifications[1][2] and Gecko. Another issue, was that setting selectorText of StyleRule did not pass a stylesheet to the selector parser, so namespace resolution did not work for setting selectorText. [1] https://www.w3.org/TR/selectors-api2/#resolving-namespaces [2] https://dom.spec.whatwg.org/#scope-match-a-selectors-string R=timloh@chromium.org BUG=580023, 580445 Committed: https://crrev.com/8ccb69f37572249545fc7b1b8bab97fe71910321 Cr-Commit-Position: refs/heads/master@{#371275}

Patch Set 1 #

Total comments: 1

Patch Set 2 : Corrected existing tests #

Patch Set 3 : Corrected correction #

Total comments: 4

Patch Set 4 : Rebased #

Patch Set 5 : Fixed review issues #

Unified diffs Side-by-side diffs Delta from patch set Stats (+95 lines, -63 lines) Patch
M third_party/WebKit/LayoutTests/fast/css/css-set-selector-text.html View 1 2 2 chunks +6 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/css/css-set-selector-text-expected.txt View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/css/stylerule-set-selectortext-ns.html View 1 chunk +20 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/css/stylerule-set-selectortext-ns-expected.txt View 1 chunk +12 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/dom/SelectorAPI/not-supported-namespace-in-selector-expected.txt View 1 chunk +13 lines, -13 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/dom/shadow/content-element-select-namespace.html View 1 chunk +11 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/dom/shadow/content-element-select-namespace-expected.html View 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/dom/shadow/content-selector-query.html View 1 2 chunks +2 lines, -4 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/dom/shadow/content-selector-query-expected.txt View 1 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSPageRule.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/CSSSelectorList.h View 1 chunk +0 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSSelectorList.cpp View 1 chunk +0 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSStyleRule.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/StyleSheetContents.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/StyleSheetContents.cpp View 1 chunk +2 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSParser.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSParser.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp View 1 2 3 1 chunk +8 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/dom/CSSSelectorWatch.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/SelectorQuery.cpp View 1 chunk +1 line, -7 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLContentElement.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/web/WebSelector.cpp View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 27 (12 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1616423003/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1616423003/1
4 years, 11 months ago (2016-01-22 11:47:45 UTC) #2
rune
ptal https://codereview.chromium.org/1616423003/diff/1/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp File third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp (right): https://codereview.chromium.org/1616423003/diff/1/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp#newcode308 third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp:308: m_failedParsing = true; There's a separate CL (https://codereview.chromium.org/1625433002/) ...
4 years, 11 months ago (2016-01-22 11:50:30 UTC) #3
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/168965)
4 years, 11 months ago (2016-01-22 13:15:38 UTC) #5
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1616423003/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1616423003/20001
4 years, 11 months ago (2016-01-22 13:40:45 UTC) #7
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1616423003/20002 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1616423003/20002
4 years, 11 months ago (2016-01-22 13:48:52 UTC) #10
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 11 months ago (2016-01-22 14:59:47 UTC) #12
Timothy Loh
lgtm! https://codereview.chromium.org/1616423003/diff/20002/third_party/WebKit/Source/core/css/CSSPageRule.cpp File third_party/WebKit/Source/core/css/CSSPageRule.cpp (right): https://codereview.chromium.org/1616423003/diff/20002/third_party/WebKit/Source/core/css/CSSPageRule.cpp#newcode73 third_party/WebKit/Source/core/css/CSSPageRule.cpp:73: CSSSelectorList selectorList = CSSParser::parseSelector(context, parentStyleSheet()->contents(), selectorText); OK, but ...
4 years, 11 months ago (2016-01-25 00:30:47 UTC) #13
rune
https://codereview.chromium.org/1616423003/diff/20002/third_party/WebKit/Source/core/css/CSSPageRule.cpp File third_party/WebKit/Source/core/css/CSSPageRule.cpp (right): https://codereview.chromium.org/1616423003/diff/20002/third_party/WebKit/Source/core/css/CSSPageRule.cpp#newcode73 third_party/WebKit/Source/core/css/CSSPageRule.cpp:73: CSSSelectorList selectorList = CSSParser::parseSelector(context, parentStyleSheet()->contents(), selectorText); On 2016/01/25 00:30:47, ...
4 years, 11 months ago (2016-01-25 08:58:48 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1616423003/70001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1616423003/70001
4 years, 11 months ago (2016-01-25 08:59:36 UTC) #17
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/138539)
4 years, 11 months ago (2016-01-25 09:08:05 UTC) #19
rune
@dgozman: need review for Source/web
4 years, 11 months ago (2016-01-25 09:22:53 UTC) #21
dgozman
On 2016/01/25 09:22:53, rune wrote: > @dgozman: need review for Source/web Source/web lgtm
4 years, 11 months ago (2016-01-25 18:05:33 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1616423003/70001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1616423003/70001
4 years, 11 months ago (2016-01-25 18:33:27 UTC) #24
commit-bot: I haz the power
Committed patchset #5 (id:70001)
4 years, 11 months ago (2016-01-25 19:19:35 UTC) #25
commit-bot: I haz the power
4 years, 11 months ago (2016-01-25 19:21:17 UTC) #27
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/8ccb69f37572249545fc7b1b8bab97fe71910321
Cr-Commit-Position: refs/heads/master@{#371275}

Powered by Google App Engine
This is Rietveld 408576698