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 8065b70f63dbbbd9537c1f1609e78ddce3ec31af..3626abf1850e3f89d776a9750d590b556e377455 100644 |
--- a/third_party/WebKit/Source/core/page/FocusController.cpp |
+++ b/third_party/WebKit/Source/core/page/FocusController.cpp |
@@ -783,8 +783,12 @@ void FocusController::focusDocumentView(Frame* frame, bool notifyEmbedder) { |
if (focusedFrame && focusedFrame->view()) { |
Document* document = focusedFrame->document(); |
Element* focusedElement = document ? document->focusedElement() : nullptr; |
- if (focusedElement) |
- dispatchBlurEvent(*document, *focusedElement); |
+ if (focusedElement) { |
alexmos
2017/03/30 17:16:11
I think this needs a comment to explain what's goi
avallee
2017/04/02 02:27:30
I don't believe that focusing a frame requires a f
|
+ if (frame && frame->isRemoteFrame()) |
alexmos
2017/03/30 17:16:11
Were you referring to this in the description, say
avallee
2017/04/02 02:27:30
I am not sure. They are secondary assertions that
|
+ document->clearFocusedElement(); |
+ else |
+ dispatchBlurEvent(*document, *focusedElement); |
+ } |
} |
LocalFrame* newFocusedFrame = |
@@ -934,7 +938,12 @@ bool FocusController::advanceFocusAcrossFrames( |
start = toHTMLFrameOwnerElement(from->owner()); |
} |
- return advanceFocusInDocumentOrder(to, start, type, false, |
+ // If we're coming from a parent or sibling frame, we need to restart from the |
+ // first or last focusable element. |
alexmos
2017/03/30 17:16:11
Why did the old code fail to do this? It seems in
avallee
2017/04/02 02:27:30
|start| is null but sequentialFocusNavigationStart
|
+ bool initialFocus = to->tree().parent() == from || |
+ to->tree().parent() == from->tree().parent(); |
alexmos
2017/03/30 17:16:11
Hmm, can we actually get here for a sibling frame?
|
+ |
+ return advanceFocusInDocumentOrder(to, start, type, initialFocus, |
sourceCapabilities); |
} |