RESOLVED WONTFIX 154660
Simplify and modernize member functions of FocusNavigationScope
https://bugs.webkit.org/show_bug.cgi?id=154660
Summary Simplify and modernize member functions of FocusNavigationScope
Ryosuke Niwa
Reported 2016-02-24 15:54:15 PST
Use NodeTraversal for example
Attachments
Cleanup (9.77 KB, patch)
2016-02-24 17:10 PST, Ryosuke Niwa
no flags
Removed a tab in change log (9.78 KB, patch)
2016-02-24 17:11 PST, Ryosuke Niwa
darin: review-
Ryosuke Niwa
Comment 1 2016-02-24 17:10:36 PST
Ryosuke Niwa
Comment 2 2016-02-24 17:11:21 PST
Created attachment 272163 [details] Removed a tab in change log
Antti Koivisto
Comment 3 2016-02-24 17:29:54 PST
Comment on attachment 272163 [details] Removed a tab in change log View in context: https://bugs.webkit.org/attachment.cgi?id=272163&action=review > Source/WebCore/page/FocusController.cpp:118 > -static Node* parentInScope(const Node* node) > -{ > - if (node->isShadowRoot()) > - return nullptr; > - > - ContainerNode* parent = node->parentNode(); > - if (parent && parent->shadowRoot()) > - return nullptr; > - > - return parent; > -} > - > -Node* FocusNavigationScope::nextInScope(const Node* node) const > +Node* FocusNavigationScope::nextInScope(const Node& node) const > { > if (Node* next = firstChildInScope(node)) > return next; > - if (Node* next = node->nextSibling()) > - return next; > - const Node* current = node; > - while (current && !current->nextSibling()) > - current = parentInScope(current); > - return current ? current->nextSibling() : nullptr; > + return NodeTraversal::nextSkippingChildren(node); > } This changes behavior of these functions for children of shadow hosts. Why is that ok?
Ryosuke Niwa
Comment 4 2016-02-24 20:08:53 PST
Comment on attachment 272163 [details] Removed a tab in change log View in context: https://bugs.webkit.org/attachment.cgi?id=272163&action=review >> Source/WebCore/page/FocusController.cpp:118 >> } > > This changes behavior of these functions for children of shadow hosts. Why is that ok? That's a good point :(
Darin Adler
Comment 5 2016-02-26 08:22:21 PST
Comment on attachment 272163 [details] Removed a tab in change log View in context: https://bugs.webkit.org/attachment.cgi?id=272163&action=review > Source/WebCore/page/FocusController.cpp:85 > + Node* lastLeafNode() const > + { > + if (!m_lastLeafCache) > + findLastLeafNode(); > + return m_lastLeafCache; > + } Does this function body really need to be in the class definition? Makes it harder to read it over. Lets just define this inline function right afterward. >>> Source/WebCore/page/FocusController.cpp:118 >>> } >> >> This changes behavior of these functions for children of shadow hosts. Why is that ok? > > That's a good point :( So marking review- because of this.
Note You need to log in before you can comment on or make changes to this bug.