Index: third_party/WebKit/Source/core/page/FocusController.cpp |
diff --git a/third_party/WebKit/Source/core/page/FocusController.cpp b/third_party/WebKit/Source/core/page/FocusController.cpp |
index 6becd697d6e65608d336173a0e3d35f78b13d759..383f1623b0b046285b32c9e0537673b3ddb79e4d 100644 |
--- a/third_party/WebKit/Source/core/page/FocusController.cpp |
+++ b/third_party/WebKit/Source/core/page/FocusController.cpp |
@@ -933,11 +933,7 @@ |
start = toHTMLFrameOwnerElement(from->owner()); |
} |
- // If we're coming from a parent frame, we need to restart from the first or |
- // last focusable element. |
- bool initialFocus = to->tree().parent() == from; |
- |
- return advanceFocusInDocumentOrder(to, start, type, initialFocus, |
+ return advanceFocusInDocumentOrder(to, start, type, false, |
sourceCapabilities); |
} |
@@ -1002,11 +998,7 @@ |
} |
if (element == document->focusedElement()) { |
- // Focus is either coming from a remote frame or has wrapped around. |
- if (focusedFrame() != document->frame()) { |
- setFocusedFrame(document->frame()); |
- dispatchFocusEvent(*document, *element); |
- } |
+ // Focus wrapped around to the same element. |
return true; |
} |
@@ -1020,17 +1012,14 @@ |
return false; |
document->clearFocusedElement(); |
- |
- // If contentFrame is remote, continue the search for focusable elements in |
- // that frame's process. The target contentFrame's process will grab focus |
- // from inside advanceFocusInDocumentOrder(). |
- // |
- // clearFocusedElement() fires events that might detach the contentFrame, |
- // hence the need to null-check it again. |
+ setFocusedFrame(owner->contentFrame()); |
+ |
+ // If contentFrame is remote, continue the search for focusable |
+ // elements in that frame's process. |
+ // clearFocusedElement() fires events that might detach the |
+ // contentFrame, hence the need to null-check it again. |
if (owner->contentFrame() && owner->contentFrame()->isRemoteFrame()) |
toRemoteFrame(owner->contentFrame())->advanceFocus(type, frame); |
- else |
- setFocusedFrame(owner->contentFrame()); |
return true; |
} |