Bug 75946

Summary: The query selector for HTMLContentElement should follow the shadow dom spec.
Product: WebKit Reporter: Shinya Kawanaka <shinyak>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: dglazkov, dominicc, hayato, morrita, rolandsteiner, shinyak, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 75301    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Shinya Kawanaka
Reported 2012-01-10 01:21:19 PST
The 'select' attribute introduced in the patch for Bug 75302 will accept wider query than shadow dom spec. The query format should obey the spec.
Attachments
Patch (18.53 KB, patch)
2012-01-19 23:23 PST, Shinya Kawanaka
no flags
Patch (18.74 KB, patch)
2012-01-22 21:53 PST, Shinya Kawanaka
no flags
Patch (19.61 KB, patch)
2012-01-22 23:37 PST, Shinya Kawanaka
no flags
Patch (19.49 KB, patch)
2012-01-23 20:44 PST, Shinya Kawanaka
no flags
Shinya Kawanaka
Comment 1 2012-01-18 00:31:58 PST
Shinya Kawanaka
Comment 2 2012-01-19 23:23:46 PST
Hajime Morrita
Comment 3 2012-01-20 08:18:21 PST
Comment on attachment 123257 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=123257&action=review The approach looks OK. Added some comments inline. > Source/WebCore/html/shadow/ContentSelectorQuery.cpp:48 > parser.parseSelector(element->select(), element->document(), m_selectorList); Is there any way to detect syntax error? > Source/WebCore/html/shadow/ContentSelectorQuery.cpp:57 > + if (m_contentElement->select().isNull() || m_contentElement->select().isEmpty()) It looks we don't need this - this check was done in the constructor. > Source/WebCore/html/shadow/ContentSelectorQuery.cpp:118 > + for (size_t i = 0; i < sizeof(allowedPseudoType) / sizeof(allowedPseudoType[0]); ++i) { Why not switch? > Source/WebCore/html/shadow/ContentSelectorQuery.h:60 > + bool m_isValidSelector; Looks something is wrong.... This should be a property of SelectorDataList or CSSSelectorList? or should validateSelectorList() be a method of SelectorDataList? I'm not sure. but ownership around this class looks strange. > Source/WebCore/html/shadow/HTMLContentElement.h:65 > + virtual bool hasValidSelect() const; isSelectValid? > Source/WebCore/testing/Internals.cpp:153 > + if (!contentElement->isContentElement()) { Please check null-ity of contentElement > LayoutTests/fast/dom/shadow/content-selector-query.html:44 > +var dataOfInvalidCases = [ Could you add some syntactically invalid cases? There are, for example, forbidden symbols. We also need partially valid case which has both syntactically valid and invalid selectors.
Shinya Kawanaka
Comment 4 2012-01-22 21:53:59 PST
Shinya Kawanaka
Comment 5 2012-01-22 21:58:35 PST
(In reply to comment #3) > (From update of attachment 123257 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=123257&action=review > > The approach looks OK. Added some comments inline. > > > Source/WebCore/html/shadow/ContentSelectorQuery.cpp:48 > > parser.parseSelector(element->select(), element->document(), m_selectorList); > > Is there any way to detect syntax error? Ah... I have added a code to check m_selectorList->first() is empty or not. Empty means the CSSSelector fails parsing it. > > > Source/WebCore/html/shadow/ContentSelectorQuery.cpp:57 > > + if (m_contentElement->select().isNull() || m_contentElement->select().isEmpty()) > > It looks we don't need this - this check was done in the constructor. Done. > > > Source/WebCore/html/shadow/ContentSelectorQuery.cpp:118 > > + for (size_t i = 0; i < sizeof(allowedPseudoType) / sizeof(allowedPseudoType[0]); ++i) { > > Why not switch? Done. > > > Source/WebCore/html/shadow/ContentSelectorQuery.h:60 > > + bool m_isValidSelector; > > Looks something is wrong.... This should be a property of SelectorDataList or CSSSelectorList? > or should validateSelectorList() be a method of SelectorDataList? > I'm not sure. but ownership around this class looks strange. Hmm... Since SelectorDataList and CSSSelectorList are borrowed from CSSParser. The selector query is specific for HTMLContentElement, I don't think CSSParser related objects have it. So I've added m_isValidSelector there. I leave this code as is in Patch 2. > > > Source/WebCore/html/shadow/HTMLContentElement.h:65 > > + virtual bool hasValidSelect() const; > > isSelectValid? Done. > > > Source/WebCore/testing/Internals.cpp:153 > > + if (!contentElement->isContentElement()) { > > Please check null-ity of contentElement Done. > > > LayoutTests/fast/dom/shadow/content-selector-query.html:44 > > +var dataOfInvalidCases = [ > > Could you add some syntactically invalid cases? > There are, for example, forbidden symbols. > We also need partially valid case which has both syntactically valid and invalid selectors. Yes. I've added several (mainly syntax-check) test cases, which contains failing cases in my previous patch.
Early Warning System Bot
Comment 6 2012-01-22 22:09:01 PST
WebKit Review Bot
Comment 7 2012-01-22 22:52:09 PST
Comment on attachment 123519 [details] Patch Attachment 123519 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/11253828 New failing tests: fast/dom/shadow/shadow-contents-fallback.html fast/html/details-add-child-2.html fast/html/details-replace-text.html fast/dom/shadow/content-selector-query.html fast/html/details-open2.html fast/html/details-remove-child-2.html fast/dom/shadow/shadow-contents-select.html
Shinya Kawanaka
Comment 8 2012-01-22 23:09:33 PST
(In reply to comment #7) > (From update of attachment 123519 [details]) > Attachment 123519 [details] did not pass chromium-ews (chromium-xvfb): > Output: http://queues.webkit.org/results/11253828 > > New failing tests: > fast/dom/shadow/shadow-contents-fallback.html > fast/html/details-add-child-2.html > fast/html/details-replace-text.html > fast/dom/shadow/content-selector-query.html > fast/html/details-open2.html > fast/html/details-remove-child-2.html > fast/dom/shadow/shadow-contents-select.html Hmm... Let me try fix them.
Shinya Kawanaka
Comment 9 2012-01-22 23:37:36 PST
Shinya Kawanaka
Comment 10 2012-01-22 23:38:15 PST
(In reply to comment #8) > (In reply to comment #7) > > (From update of attachment 123519 [details] [details]) > > Attachment 123519 [details] [details] did not pass chromium-ews (chromium-xvfb): > > Output: http://queues.webkit.org/results/11253828 > > > > New failing tests: > > fast/dom/shadow/shadow-contents-fallback.html > > fast/html/details-add-child-2.html > > fast/html/details-replace-text.html > > fast/dom/shadow/content-selector-query.html > > fast/html/details-open2.html > > fast/html/details-remove-child-2.html > > fast/dom/shadow/shadow-contents-select.html > > Hmm... Let me try fix them. Sorry, I did a very stupid mistake. Fixed it in the latest patch.
Hajime Morrita
Comment 11 2012-01-23 13:23:10 PST
Comment on attachment 123524 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=123524&action=review Basically looks OK. Regarding to m_isValidSelector, I feel it as symptom of missing "optional" class like boost::optional. Could you consider to add it to WTF when you have time? Of couse it's a different topic from this bug. > Source/WebCore/html/shadow/ContentSelectorQuery.cpp:99 > + default: Don't use default clause if we have all enums in the case statements. Then compilers can catch possible missing case.
Shinya Kawanaka
Comment 12 2012-01-23 20:44:45 PST
WebKit Review Bot
Comment 13 2012-01-30 02:41:49 PST
Comment on attachment 123694 [details] Patch Clearing flags on attachment: 123694 Committed r106225: <http://trac.webkit.org/changeset/106225>
WebKit Review Bot
Comment 14 2012-01-30 02:41:54 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.