| Index: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
|
| diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
|
| index 2baa0920fbaf765e7f5b7b761280d412f670c0fd..3a0093e533d96f9ae2fb83c3bbc9f072a9bf96aa 100644
|
| --- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
|
| +++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
|
| @@ -1651,15 +1651,15 @@ void WebLocalFrameImpl::setFindEndstateFocusAndSelection()
|
| node = host;
|
| }
|
| }
|
| - for (; node; node = node->parentNode()) {
|
| - if (!node->isElementNode())
|
| + for (Node& runner : NodeTraversal::ancestorsOrSelfOf(node)) {
|
| + if (!runner.isElementNode())
|
| continue;
|
| - Element* element = toElement(node);
|
| - if (element->isFocusable()) {
|
| + Element& element = toElement(runner);
|
| + if (element.isFocusable()) {
|
| // Found a focusable parent node. Set the active match as the
|
| // selection and focus to the focusable node.
|
| frame()->selection().setSelection(VisibleSelection(EphemeralRange(activeMatch)));
|
| - frame()->document()->setFocusedElement(element, FocusParams(SelectionBehaviorOnFocus::None, WebFocusTypeNone, nullptr));
|
| + frame()->document()->setFocusedElement(&element, FocusParams(SelectionBehaviorOnFocus::None, WebFocusTypeNone, nullptr));
|
| return;
|
| }
|
| }
|
|
|