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

Issue 2306903002: Fix the wrong usages of CSSSelectorList::selectorUsesXXX() functions (Closed)

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

Description

Fix the wrong usages of CSSSelectorList::selectorUsesXXX() functions It looks that a wrong `selectorIndex` argument is passed to CSSSelectorList::selectorUsesDeepCombinatorOrShadowPseudo(), and similar functions. - The clients are passing the index of a *selector* in *selectors*, in the meaning used in the spec. - The member functions are using this parameter as the index of CSSSelecorList::m_selectorArray. They are totally different if a selector list has more than one selectors. This CL moved all functions to CSSSelector to prevent the wrong usage from happening in the future. It is error-prone that CSSSelectorList has these functions. This CL also fixes bug 643316. BUG=643316 Committed: https://crrev.com/78be6354d3b13dff165e2715957bab3a6d158098 Cr-Commit-Position: refs/heads/master@{#416214}

Patch Set 1 #

Patch Set 2 : Add a test #

Total comments: 7

Patch Set 3 : Fix #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+69 lines, -69 lines) Patch
A third_party/WebKit/LayoutTests/shadow-dom/v0/deep-in-selectors.html View 1 2 1 chunk +13 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSSelector.h View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSSelector.cpp View 1 2 1 chunk +45 lines, -0 lines 2 comments Download
M third_party/WebKit/Source/core/css/CSSSelectorList.h View 1 chunk +0 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSSelectorList.cpp View 1 chunk +0 lines, -56 lines 0 comments Download
M third_party/WebKit/Source/core/css/RuleSet.cpp View 1 chunk +3 lines, -3 lines 3 comments Download
M third_party/WebKit/Source/core/dom/SelectorQuery.cpp View 1 2 1 chunk +3 lines, -4 lines 0 comments Download

Messages

Total messages: 34 (20 generated)
hayato
PTAL
4 years, 3 months ago (2016-09-02 06:27:42 UTC) #7
hayato
Add a test
4 years, 3 months ago (2016-09-02 06:30:47 UTC) #8
hayato
https://codereview.chromium.org/2306903002/diff/20001/third_party/WebKit/Source/core/css/CSSSelectorList.cpp File third_party/WebKit/Source/core/css/CSSSelectorList.cpp (left): https://codereview.chromium.org/2306903002/diff/20001/third_party/WebKit/Source/core/css/CSSSelectorList.cpp#oldcode145 third_party/WebKit/Source/core/css/CSSSelectorList.cpp:145: static bool forEachSelector(const Functor& functor, const CSSSelectorList* selectorList) This ...
4 years, 3 months ago (2016-09-02 06:31:43 UTC) #11
kochi
nice find and nice refactoring. lgtm % nits Does this fix the case that the ...
4 years, 3 months ago (2016-09-02 06:52:52 UTC) #17
hayato
Fix
4 years, 3 months ago (2016-09-02 07:10:12 UTC) #19
hayato
> Does this fix the case that the linked bug reports? Yes. > If so, ...
4 years, 3 months ago (2016-09-02 07:11:29 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2306903002/40001
4 years, 3 months ago (2016-09-02 07:12:12 UTC) #26
hayato
Note: It looks I forgot to upload a layout test in the previous patch set. ...
4 years, 3 months ago (2016-09-02 07:16:33 UTC) #27
kochi
Adding a test case makes sense very much, now it is clear that this CL ...
4 years, 3 months ago (2016-09-02 07:20:19 UTC) #28
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 3 months ago (2016-09-02 08:43:43 UTC) #29
commit-bot: I haz the power
Patchset 3 (id:??) landed as https://crrev.com/78be6354d3b13dff165e2715957bab3a6d158098 Cr-Commit-Position: refs/heads/master@{#416214}
4 years, 3 months ago (2016-09-02 08:45:36 UTC) #31
rune
https://codereview.chromium.org/2306903002/diff/40001/third_party/WebKit/Source/core/css/CSSSelector.cpp File third_party/WebKit/Source/core/css/CSSSelector.cpp (right): https://codereview.chromium.org/2306903002/diff/40001/third_party/WebKit/Source/core/css/CSSSelector.cpp#newcode916 third_party/WebKit/Source/core/css/CSSSelector.cpp:916: static bool forEachTagSelector(const Functor& functor, const CSSSelector& selector) This ...
4 years, 3 months ago (2016-09-02 09:14:32 UTC) #32
hayato
https://codereview.chromium.org/2306903002/diff/40001/third_party/WebKit/Source/core/css/CSSSelector.cpp File third_party/WebKit/Source/core/css/CSSSelector.cpp (right): https://codereview.chromium.org/2306903002/diff/40001/third_party/WebKit/Source/core/css/CSSSelector.cpp#newcode916 third_party/WebKit/Source/core/css/CSSSelector.cpp:916: static bool forEachTagSelector(const Functor& functor, const CSSSelector& selector) On ...
4 years, 3 months ago (2016-09-05 02:36:11 UTC) #33
rune
4 years, 3 months ago (2016-09-05 07:46:39 UTC) #34
Message was sent while issue was closed.
https://codereview.chromium.org/2306903002/diff/40001/third_party/WebKit/Sour...
File third_party/WebKit/Source/core/css/RuleSet.cpp (left):

https://codereview.chromium.org/2306903002/diff/40001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/css/RuleSet.cpp:260: for (size_t selectorIndex =
0; selectorIndex != kNotFound; selectorIndex =
selectorList.indexOfNextSelectorAfter(selectorIndex)) {
On 2016/09/05 02:36:11, hayato wrote:
> On 2016/09/02 at 09:14:31, rune wrote:
> > SelectorList::next() would be a better choice, I think.
> indexOfNextSelectorAfter() calls next(), and is a convenience method for the
> RuleData code which stores the selectorIndex.
> 
> Yeah, but we still need a selectorIndex here because we call addRule here. Let
> me try to use next() here anyway in another CL.

Ah. I didn't notice. Just leave it like this then.

Powered by Google App Engine
This is Rietveld 408576698