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

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

Issue 238023004: Focusing iframe window should trigger blur event for oldframe's focused element (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated review comments Created 6 years, 8 months 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
« no previous file with comments | « Source/core/page/FocusController.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/FocusController.cpp
diff --git a/Source/core/page/FocusController.cpp b/Source/core/page/FocusController.cpp
index f84cd1284f9efe47ae081cc163a6e2057be7b46d..1f106df8c5cf8875ce5ec14aa07ee3cfd29a03cc 100644
--- a/Source/core/page/FocusController.cpp
+++ b/Source/core/page/FocusController.cpp
@@ -261,6 +261,43 @@ void FocusController::setFocusedFrame(PassRefPtr<Frame> frame)
m_page->chrome().client().focusedFrameChanged(newFrame.get());
}
+void FocusController::focusDocumentView(PassRefPtr<Frame> frame)
+{
+ ASSERT(!frame || frame->page() == m_page);
+ if (m_focusedFrame == frame)
+ return;
+
+ RefPtr<LocalFrame> focusedFrame = (m_focusedFrame && m_focusedFrame->isLocalFrame()) ? toLocalFrame(m_focusedFrame.get()) : 0;
+ if (focusedFrame && focusedFrame->view()) {
+ RefPtr<Document> document = focusedFrame->document();
+ Element* focusedElement = document ? document->focusedElement() : 0;
+ if (focusedElement) {
+ focusedElement->dispatchBlurEvent(0);
+ if (focusedElement == document->focusedElement()) {
+ focusedElement->dispatchFocusOutEvent(EventTypeNames::focusout, 0);
+ if (focusedElement == document->focusedElement())
+ focusedElement->dispatchFocusOutEvent(EventTypeNames::DOMFocusOut, 0);
+ }
+ }
+ }
+
+ RefPtr<LocalFrame> newFocusedFrame = (frame && frame->isLocalFrame()) ? toLocalFrame(frame.get()) : 0;
+ if (newFocusedFrame && newFocusedFrame->view()) {
+ RefPtr<Document> document = newFocusedFrame->document();
+ Element* focusedElement = document ? document->focusedElement() : 0;
+ if (focusedElement) {
+ focusedElement->dispatchFocusEvent(0, FocusTypePage);
+ if (focusedElement == document->focusedElement()) {
+ document->focusedElement()->dispatchFocusInEvent(EventTypeNames::focusin, 0);
+ if (focusedElement == document->focusedElement())
+ document->focusedElement()->dispatchFocusInEvent(EventTypeNames::DOMFocusIn, 0);
+ }
+ }
+ }
+
+ setFocusedFrame(frame);
+}
+
Frame* FocusController::focusedOrMainFrame() const
{
if (Frame* frame = focusedFrame())
« no previous file with comments | « Source/core/page/FocusController.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698