RESOLVED FIXED 170899
[selectors4] :focus-within should use the flat tree
https://bugs.webkit.org/show_bug.cgi?id=170899
Summary [selectors4] :focus-within should use the flat tree
Manuel Rego Casasnovas
Reported 2017-04-17 01:26:51 PDT
As discussed in this issue of the CSS WG, ":focus-within" should use the flat tree: https://github.com/w3c/csswg-drafts/issues/1135 The spec has been updated and now the prose is very clear about this (https://drafts.csswg.org/selectors-4/#the-focus-within-pseudo): "An element also matches :focus-within if one of its descendants in the flat tree (including non-element nodes, such as text nodes) matches the conditions for matching :focus." Current implementation doesn't follow that, so the following test case fails: https://github.com/w3c/web-platform-tests/blob/master/css/selectors4/focus-within-shadow-006.html
Attachments
Patch (3.35 KB, patch)
2017-04-17 01:52 PDT, Manuel Rego Casasnovas
no flags
Patch (3.34 KB, patch)
2017-04-18 02:51 PDT, Manuel Rego Casasnovas
no flags
Archive of layout-test-results from ews114 for mac-elcapitan (446.99 KB, application/zip)
2017-04-18 03:47 PDT, Build Bot
no flags
Use parentElementInComposedTree() (3.33 KB, patch)
2017-04-24 07:12 PDT, Manuel Rego Casasnovas
no flags
Manuel Rego Casasnovas
Comment 1 2017-04-17 01:52:44 PDT
Manuel Rego Casasnovas
Comment 2 2017-04-18 02:51:06 PDT
Created attachment 307364 [details] Patch Now that the tests have been imported (bug #170898) this should be ready for review.
Build Bot
Comment 3 2017-04-18 03:47:28 PDT
Comment on attachment 307364 [details] Patch Attachment 307364 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/3556452 Number of test failures exceeded the failure limit.
Build Bot
Comment 4 2017-04-18 03:47:29 PDT
Created attachment 307368 [details] Archive of layout-test-results from ews114 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Javier Fernandez
Comment 5 2017-04-24 04:34:14 PDT
Comment on attachment 307364 [details] Patch The change still makes the bot to fail.
Javier Fernandez
Comment 6 2017-04-24 04:36:44 PDT
Comment on attachment 307364 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=307364&action=review > Source/WebCore/dom/Element.cpp:614 > + for (Element* element = this; element; element = downcast<Element>(element->parentInComposedTree())) Isn't parentElementInComposedTree what we should use here ?
Antti Koivisto
Comment 7 2017-04-24 04:40:47 PDT
Comment on attachment 307364 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=307364&action=review >> Source/WebCore/dom/Element.cpp:614 >> + for (Element* element = this; element; element = downcast<Element>(element->parentInComposedTree())) > > Isn't parentElementInComposedTree what we should use here ? Yeah, the cast is not safe. parentInComposedTree can return ShadowRoot which is not Element.
Antti Koivisto
Comment 8 2017-04-24 04:43:01 PDT
Sorry, it can't return ShadowRoot but it can return Document (and maybe DocumentFragment).
Manuel Rego Casasnovas
Comment 9 2017-04-24 07:12:14 PDT
Created attachment 307971 [details] Use parentElementInComposedTree()
Manuel Rego Casasnovas
Comment 10 2017-04-24 08:21:17 PDT
Thanks for the reviews! Sorry for the Debug EWS error in the previous version, I thought it was unrelated but probably I got confused with a different patch and not this one. It seems using parentElementInComposedTree() as suggested has solved the problem.
WebKit Commit Bot
Comment 11 2017-04-24 21:58:59 PDT
Comment on attachment 307971 [details] Use parentElementInComposedTree() Clearing flags on attachment: 307971 Committed r215719: <http://trac.webkit.org/changeset/215719>
WebKit Commit Bot
Comment 12 2017-04-24 21:59:01 PDT
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.