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

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: 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
« Source/core/page/EventHandler.cpp ('K') | « 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 aa083b5815785588fb729980527d7ca5f403bc01..abdc0f5977a751ed421ec345e32e84cc95f098f3 100644
--- a/Source/core/page/FocusController.cpp
+++ b/Source/core/page/FocusController.cpp
@@ -262,6 +262,31 @@ 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);
tkent 2014/04/23 02:23:31 We need to dispatch 'focusout' and 'DOMFocusOut' e
gnana 2014/04/23 12:21:51 Done.
+ }
+
+ 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);
tkent 2014/04/23 02:23:31 We need to dispatch 'focusin' and 'DOMFocusIn' eve
gnana 2014/04/23 12:21:51 Done.
+ }
+
+ setFocusedFrame(frame);
+}
+
Frame* FocusController::focusedOrMainFrame() const
{
if (Frame* frame = focusedFrame())
« Source/core/page/EventHandler.cpp ('K') | « Source/core/page/FocusController.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698