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

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

Issue 2474323002: Implement WebContentsViewChildFrame::TakeFocus. (Closed)
Patch Set: Fix cases where focus does not actually advance focus Created 4 years 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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 867
868 void FocusController::setFocused(bool focused) { 868 void FocusController::setFocused(bool focused) {
869 if (isFocused() == focused) 869 if (isFocused() == focused)
870 return; 870 return;
871 871
872 m_isFocused = focused; 872 m_isFocused = focused;
873 873
874 if (!m_isFocused && focusedOrMainFrame()->isLocalFrame()) 874 if (!m_isFocused && focusedOrMainFrame()->isLocalFrame())
875 toLocalFrame(focusedOrMainFrame())->eventHandler().stopAutoscroll(); 875 toLocalFrame(focusedOrMainFrame())->eventHandler().stopAutoscroll();
876 876
877 if (!m_focusedFrame) 877 // Do not set a focused frame when being unfocsed. This might reset focus to
alexmos 2016/11/28 23:52:24 nits: s/unfocsed/unfocused/ s/reset focus/reset m
878 // true.
879 if (!m_focusedFrame && m_isFocused)
878 setFocusedFrame(m_page->mainFrame()); 880 setFocusedFrame(m_page->mainFrame());
879 881
880 // setFocusedFrame above might reject to update m_focusedFrame, or 882 // setFocusedFrame above might reject to update m_focusedFrame, or
881 // m_focusedFrame might be changed by blur/focus event handlers. 883 // m_focusedFrame might be changed by blur/focus event handlers.
882 if (m_focusedFrame && m_focusedFrame->isLocalFrame() && 884 if (m_focusedFrame && m_focusedFrame->isLocalFrame() &&
883 toLocalFrame(m_focusedFrame.get())->view()) { 885 toLocalFrame(m_focusedFrame.get())->view()) {
884 toLocalFrame(m_focusedFrame.get())->selection().setFocused(focused); 886 toLocalFrame(m_focusedFrame.get())->selection().setFocused(focused);
885 dispatchEventsOnWindowAndFocusedElement( 887 dispatchEventsOnWindowAndFocusedElement(
886 toLocalFrame(m_focusedFrame.get())->document(), focused); 888 toLocalFrame(m_focusedFrame.get())->document(), focused);
887 } 889 }
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 1413
1412 return consumed; 1414 return consumed;
1413 } 1415 }
1414 1416
1415 DEFINE_TRACE(FocusController) { 1417 DEFINE_TRACE(FocusController) {
1416 visitor->trace(m_page); 1418 visitor->trace(m_page);
1417 visitor->trace(m_focusedFrame); 1419 visitor->trace(m_focusedFrame);
1418 } 1420 }
1419 1421
1420 } // namespace blink 1422 } // namespace blink
OLDNEW
« content/browser/web_contents/web_contents_impl.cc ('K') | « content/common/view_messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698