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

Side by Side Diff: third_party/WebKit/Source/core/page/FocusController.cpp

Issue 2474323002: Implement WebContentsViewChildFrame::TakeFocus. (Closed)
Patch Set: Remove logging code. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nuanti Ltd. 3 * Copyright (C) 2008 Nuanti Ltd.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 848
849 void FocusController::setFocused(bool focused) { 849 void FocusController::setFocused(bool focused) {
850 if (isFocused() == focused) 850 if (isFocused() == focused)
851 return; 851 return;
852 852
853 m_isFocused = focused; 853 m_isFocused = focused;
854 854
855 if (!m_isFocused && focusedOrMainFrame()->isLocalFrame()) 855 if (!m_isFocused && focusedOrMainFrame()->isLocalFrame())
856 toLocalFrame(focusedOrMainFrame())->eventHandler().stopAutoscroll(); 856 toLocalFrame(focusedOrMainFrame())->eventHandler().stopAutoscroll();
857 857
858 if (!m_focusedFrame) 858 // Do not set a focused frame when being unfocused. This might reset
859 // m_isFocused to true.
860 if (!m_focusedFrame && m_isFocused)
dcheng 2017/01/12 10:19:21 This seems like a reasonable change to me, but I'm
avallee 2017/01/12 20:00:23 See the conversation here: https://codereview.chro
dcheng 2017/01/20 07:02:38 Would it be better to just pass false for notifyEm
avallee 2017/01/20 14:19:11 Oh, i thought I had previously linked to the spot
859 setFocusedFrame(m_page->mainFrame()); 861 setFocusedFrame(m_page->mainFrame());
860 862
861 // setFocusedFrame above might reject to update m_focusedFrame, or 863 // setFocusedFrame above might reject to update m_focusedFrame, or
862 // m_focusedFrame might be changed by blur/focus event handlers. 864 // m_focusedFrame might be changed by blur/focus event handlers.
863 if (m_focusedFrame && m_focusedFrame->isLocalFrame() && 865 if (m_focusedFrame && m_focusedFrame->isLocalFrame() &&
864 toLocalFrame(m_focusedFrame.get())->view()) { 866 toLocalFrame(m_focusedFrame.get())->view()) {
865 toLocalFrame(m_focusedFrame.get())->selection().setFocused(focused); 867 toLocalFrame(m_focusedFrame.get())->selection().setFocused(focused);
866 dispatchEventsOnWindowAndFocusedElement( 868 dispatchEventsOnWindowAndFocusedElement(
867 toLocalFrame(m_focusedFrame.get())->document(), focused); 869 toLocalFrame(m_focusedFrame.get())->document(), focused);
868 } 870 }
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 1395
1394 return consumed; 1396 return consumed;
1395 } 1397 }
1396 1398
1397 DEFINE_TRACE(FocusController) { 1399 DEFINE_TRACE(FocusController) {
1398 visitor->trace(m_page); 1400 visitor->trace(m_page);
1399 visitor->trace(m_focusedFrame); 1401 visitor->trace(m_focusedFrame);
1400 } 1402 }
1401 1403
1402 } // namespace blink 1404 } // namespace blink
OLDNEW
« content/common/view_messages.h ('K') | « content/common/view_messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698