Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(566)

Unified Diff: third_party/WebKit/Source/core/page/FocusController.cpp

Issue 1423053002: Make document.activeElement work with OOPIF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@focus-preserve-page-focus-on-subframe-navigations
Patch Set: Remove some plumbing that should instead be introduced in the window.focus() CL. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 f068696572f020fc0f025ca104c2c817b472dd91..4c0a57a3b63b0e56b4bb03fd089e4309c13444b1 100644
--- a/third_party/WebKit/Source/core/page/FocusController.cpp
+++ b/third_party/WebKit/Source/core/page/FocusController.cpp
@@ -629,6 +629,18 @@ Frame* FocusController::focusedOrMainFrame() const
return m_page->mainFrame();
}
+HTMLFrameOwnerElement* FocusController::focusedFrameOwnerElement(LocalFrame& currentFrame) const
+{
+ Frame* focusedFrame = m_focusedFrame.get();
+ for (; focusedFrame; focusedFrame = focusedFrame->tree().parent()) {
+ if (focusedFrame->tree().parent() == &currentFrame) {
+ ASSERT(focusedFrame->owner()->isLocal());
+ return focusedFrame->deprecatedLocalOwner();
+ }
+ }
+ return nullptr;
+}
+
void FocusController::setFocused(bool focused)
{
if (isFocused() == focused)
@@ -832,7 +844,8 @@ bool FocusController::setFocusedElement(Element* element, PassRefPtrWillBeRawPtr
if (newDocument && oldDocument == newDocument && newDocument->focusedElement() == element)
return true;
- clearSelectionIfNeeded(oldFocusedFrame.get(), toLocalFrame(newFocusedFrame.get()), element);
+ if (newFocusedFrame && newFocusedFrame->isLocalFrame())
+ clearSelectionIfNeeded(oldFocusedFrame.get(), toLocalFrame(newFocusedFrame.get()), element);
if (oldDocument && oldDocument != newDocument)
oldDocument->setFocusedElement(nullptr);

Powered by Google App Engine
This is Rietveld 408576698