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

Issue 1153873004: Handle ::content and :host-context correctly in SelectorQuery. (Closed)

Created:
5 years, 7 months ago by esprehn
Modified:
5 years, 7 months ago
Reviewers:
hayato, kochi, rune
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-dom_chromium.org, dglazkov+blink, eae+blinkwatch, rwlbuis, sof
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Handle ::content and :host-context correctly in SelectorQuery. SelectorQuery was checking for selectors that cross tree scopes (::shadow and /deep/) to decide if it should update distribution, but it should have been checking for selectors that need distribution (::content and :host-context). SelectorQuery's ::matches and ::closest modes were also missing the step to update the distribution. BUG=491641 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=195882

Patch Set 1 #

Patch Set 2 : Don't mess with scope. #

Patch Set 3 : Remove wrong test. #

Total comments: 7

Patch Set 4 : Add the test back. #

Patch Set 5 : Fix test path. #

Patch Set 6 : No really, the right patch. #

Total comments: 5

Patch Set 7 : Expanded test #

Total comments: 1

Patch Set 8 : fix test naming. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+123 lines, -27 lines) Patch
D LayoutTests/fast/dom/shadow/update-distribution-for-matches.html View 1 chunk +0 lines, -20 lines 0 comments Download
D LayoutTests/fast/dom/shadow/update-distribution-for-matches-expected.txt View 1 chunk +0 lines, -3 lines 0 comments Download
A LayoutTests/fast/selectors/query-update-distribution.html View 1 2 3 4 5 6 7 1 chunk +67 lines, -0 lines 2 comments Download
A LayoutTests/fast/selectors/query-update-distribution-expected.txt View 1 2 3 4 5 6 1 chunk +18 lines, -0 lines 0 comments Download
M Source/core/css/CSSSelectorList.h View 1 chunk +3 lines, -0 lines 0 comments Download
M Source/core/css/CSSSelectorList.cpp View 1 chunk +14 lines, -0 lines 0 comments Download
M Source/core/dom/Element.cpp View 1 chunk +0 lines, -1 line 0 comments Download
M Source/core/dom/SelectorQuery.h View 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/dom/SelectorQuery.cpp View 1 4 5 5 chunks +19 lines, -2 lines 0 comments Download

Messages

Total messages: 60 (14 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/1153873004/1
5 years, 7 months ago (2015-05-24 03:41:46 UTC) #2
esprehn
Hmm this changes the behavior of fast/selectors/element-closest-scope.html, it seems like it changed how :scope matches. ...
5 years, 7 months ago (2015-05-24 04:27:37 UTC) #3
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1153873004/20001
5 years, 7 months ago (2015-05-24 04:57:20 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/1153873004/40001
5 years, 7 months ago (2015-05-24 06:29:43 UTC) #7
esprehn
5 years, 7 months ago (2015-05-24 06:30:45 UTC) #9
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 7 months ago (2015-05-24 08:10:43 UTC) #11
hayato
https://codereview.chromium.org/1153873004/diff/40001/Source/core/dom/Element.cpp File Source/core/dom/Element.cpp (left): https://codereview.chromium.org/1153873004/diff/40001/Source/core/dom/Element.cpp#oldcode2785 Source/core/dom/Element.cpp:2785: updateDistribution(); Could you explain why calling updateDistribution blindly is ...
5 years, 7 months ago (2015-05-25 05:15:00 UTC) #12
esprehn
It's unnecessary churn wasting time and battery, we shouldn't force updates unless we need to. ...
5 years, 7 months ago (2015-05-25 05:38:17 UTC) #13
kochi
Could you add regression tests for catching if ::matches() and ::closest() misses updating distribution? https://codereview.chromium.org/1153873004/diff/40001/Source/core/dom/SelectorQuery.cpp ...
5 years, 7 months ago (2015-05-25 05:40:57 UTC) #14
hayato
Yeah, but this wouldn't change the number of calculation of the distribution significantly? I expect ...
5 years, 7 months ago (2015-05-25 06:02:20 UTC) #15
kochi
Hayato-san, I think this CL's point is that set the needsUpdateDistribution flag only when Element.match()'s ...
5 years, 7 months ago (2015-05-25 06:15:26 UTC) #16
esprehn
https://codereview.chromium.org/1153873004/diff/40001/Source/core/dom/SelectorQuery.cpp File Source/core/dom/SelectorQuery.cpp (right): https://codereview.chromium.org/1153873004/diff/40001/Source/core/dom/SelectorQuery.cpp#newcode226 Source/core/dom/SelectorQuery.cpp:226: return m_selectors.size() == 1; On 2015/05/25 at 05:40:57, Takayoshi ...
5 years, 7 months ago (2015-05-25 06:21:11 UTC) #17
esprehn
On 2015/05/25 at 05:40:57, kochi wrote: > Could you add regression tests for catching if ...
5 years, 7 months ago (2015-05-25 06:21:42 UTC) #18
hayato
updateDistribution() would be almost no-op, only checking the flag of document in most cases, once ...
5 years, 7 months ago (2015-05-25 06:23:16 UTC) #19
kochi
On 2015/05/25 06:21:42, esprehn wrote: > On 2015/05/25 at 05:40:57, kochi wrote: > > Could ...
5 years, 7 months ago (2015-05-25 06:26:23 UTC) #20
esprehn
On 2015/05/25 at 06:02:20, hayato wrote: > Yeah, but this wouldn't change the number of ...
5 years, 7 months ago (2015-05-25 06:30:42 UTC) #21
esprehn
On 2015/05/25 at 06:26:23, kochi wrote: > On 2015/05/25 06:21:42, esprehn wrote: > > On ...
5 years, 7 months ago (2015-05-25 06:31:21 UTC) #22
hayato
Yeah, we can create such a case intentionally. I'm aware of it. That's the reason ...
5 years, 7 months ago (2015-05-25 06:33:55 UTC) #23
esprehn
On 2015/05/25 at 06:33:55, hayato wrote: > Yeah, we can create such a case intentionally. ...
5 years, 7 months ago (2015-05-25 06:38:45 UTC) #24
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1153873004/60001
5 years, 7 months ago (2015-05-25 06:38:56 UTC) #26
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1153873004/80001
5 years, 7 months ago (2015-05-25 06:49:01 UTC) #28
esprehn
Okay test is added back, ready for another look.
5 years, 7 months ago (2015-05-25 06:50:40 UTC) #29
kochi
On 2015/05/25 06:50:40, esprehn wrote: > Okay test is added back, ready for another look. ...
5 years, 7 months ago (2015-05-25 07:38:19 UTC) #30
esprehn
On 2015/05/25 at 07:38:19, kochi wrote: > On 2015/05/25 06:50:40, esprehn wrote: > > Okay ...
5 years, 7 months ago (2015-05-25 07:58:55 UTC) #31
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1153873004/100001
5 years, 7 months ago (2015-05-25 08:01:58 UTC) #33
esprehn
Okay! Now this is the right patch.
5 years, 7 months ago (2015-05-25 08:02:04 UTC) #34
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 7 months ago (2015-05-25 10:07:26 UTC) #36
kochi
https://codereview.chromium.org/1153873004/diff/40001/Source/core/dom/SelectorQuery.cpp File Source/core/dom/SelectorQuery.cpp (right): https://codereview.chromium.org/1153873004/diff/40001/Source/core/dom/SelectorQuery.cpp#newcode226 Source/core/dom/SelectorQuery.cpp:226: return m_selectors.size() == 1; On 2015/05/25 06:21:11, esprehn wrote: ...
5 years, 7 months ago (2015-05-25 11:07:04 UTC) #37
esprehn
Okay look again. https://codereview.chromium.org/1153873004/diff/100001/LayoutTests/fast/selectors/query-update-distribution.html File LayoutTests/fast/selectors/query-update-distribution.html (right): https://codereview.chromium.org/1153873004/diff/100001/LayoutTests/fast/selectors/query-update-distribution.html#newcode30 LayoutTests/fast/selectors/query-update-distribution.html:30: shouldBeNull("b.closest('::content #a')"); Updated the test to ...
5 years, 7 months ago (2015-05-25 20:52:26 UTC) #38
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1153873004/120001
5 years, 7 months ago (2015-05-25 21:07:01 UTC) #40
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 7 months ago (2015-05-25 22:10:40 UTC) #42
kochi
lgtm with one nit fixed. https://codereview.chromium.org/1153873004/diff/100001/Source/core/dom/SelectorQuery.cpp File Source/core/dom/SelectorQuery.cpp (right): https://codereview.chromium.org/1153873004/diff/100001/Source/core/dom/SelectorQuery.cpp#newcode134 Source/core/dom/SelectorQuery.cpp:134: targetElement.updateDistribution(); On 2015/05/25 20:52:26, ...
5 years, 7 months ago (2015-05-26 00:59:05 UTC) #43
esprehn
On 2015/05/26 at 00:59:05, kochi wrote: > ... > > https://codereview.chromium.org/1153873004/diff/120001/LayoutTests/fast/selectors/query-update-distribution.html > File LayoutTests/fast/selectors/query-update-distribution.html (right): ...
5 years, 7 months ago (2015-05-26 01:38:32 UTC) #44
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1153873004/140001
5 years, 7 months ago (2015-05-26 01:40:00 UTC) #47
hayato
https://codereview.chromium.org/1153873004/diff/140001/LayoutTests/fast/selectors/query-update-distribution.html File LayoutTests/fast/selectors/query-update-distribution.html (right): https://codereview.chromium.org/1153873004/diff/140001/LayoutTests/fast/selectors/query-update-distribution.html#newcode47 LayoutTests/fast/selectors/query-update-distribution.html:47: shouldBeNull("hostRoot.querySelector('::content #a')"); This should match, shouldn't this?
5 years, 7 months ago (2015-05-26 02:29:18 UTC) #48
commit-bot: I haz the power
Committed patchset #8 (id:140001) as https://src.chromium.org/viewvc/blink?view=rev&revision=195882
5 years, 7 months ago (2015-05-26 02:53:25 UTC) #49
rune
https://codereview.chromium.org/1153873004/diff/140001/LayoutTests/fast/selectors/query-update-distribution.html File LayoutTests/fast/selectors/query-update-distribution.html (right): https://codereview.chromium.org/1153873004/diff/140001/LayoutTests/fast/selectors/query-update-distribution.html#newcode47 LayoutTests/fast/selectors/query-update-distribution.html:47: shouldBeNull("hostRoot.querySelector('::content #a')"); On 2015/05/26 02:29:18, hayato wrote: > This ...
5 years, 7 months ago (2015-05-26 05:26:04 UTC) #51
hayato
On 2015/05/26 05:26:04, rune wrote: > https://codereview.chromium.org/1153873004/diff/140001/LayoutTests/fast/selectors/query-update-distribution.html > File LayoutTests/fast/selectors/query-update-distribution.html (right): > > https://codereview.chromium.org/1153873004/diff/140001/LayoutTests/fast/selectors/query-update-distribution.html#newcode47 > ...
5 years, 7 months ago (2015-05-26 06:11:59 UTC) #52
rune
On 2015/05/26 06:11:59, hayato wrote: > On 2015/05/26 05:26:04, rune wrote: > > > https://codereview.chromium.org/1153873004/diff/140001/LayoutTests/fast/selectors/query-update-distribution.html ...
5 years, 7 months ago (2015-05-26 07:22:22 UTC) #53
hayato
On 2015/05/26 07:22:22, rune wrote: > On 2015/05/26 06:11:59, hayato wrote: > > On 2015/05/26 ...
5 years, 7 months ago (2015-05-26 07:36:13 UTC) #54
hayato
On 2015/05/26 07:22:22, rune wrote: > On 2015/05/26 06:11:59, hayato wrote: > > On 2015/05/26 ...
5 years, 7 months ago (2015-05-26 07:45:53 UTC) #55
hayato
The context here doesn't mean the context object. I meant to say a static profile, ...
5 years, 7 months ago (2015-05-26 07:56:50 UTC) #56
rune
On 2015/05/26 07:45:53, hayato wrote: > On 2015/05/26 07:22:22, rune wrote: > > On 2015/05/26 ...
5 years, 7 months ago (2015-05-26 08:12:23 UTC) #57
hayato
I think it's okay to return a node which is in other node trees if ...
5 years, 7 months ago (2015-05-26 08:23:51 UTC) #58
rune
On 2015/05/26 08:23:51, hayato wrote: > I think it's okay to return a node which ...
5 years, 7 months ago (2015-05-26 08:31:23 UTC) #59
hayato
5 years, 7 months ago (2015-05-26 08:35:09 UTC) #60
Message was sent while issue was closed.
On 2015/05/26 08:31:23, rune wrote:
> On 2015/05/26 08:23:51, hayato wrote:
> > I think it's okay to return a node which is in other node trees if a shadow
> > boundary crossing selector is used as a parameter of querySelector().
> > In fact, what this bug [1] is trying to resolve depends on this kind of
> > behavior.
> > 
> > [1] https://www.w3.org/Bugs/Public/show_bug.cgi?id=28591
> > 
> > Let me file a bug to discuss further.
> 
> Feel free to CC me on that.

Sure, filed as https://code.google.com/p/chromium/issues/detail?id=492080.

Powered by Google App Engine
This is Rietveld 408576698