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

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

Issue 2474323002: Implement WebContentsViewChildFrame::TakeFocus. (Closed)
Patch Set: Conflicted with my own cl https://codereview.chromium.org/2455133005/ Created 4 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 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 if (!m_focusedFrame && m_isFocused)
alexmos 2016/11/22 02:45:27 Why is this needed? How is it related to the rest
avallee 2016/11/25 19:39:54 When you call Blur on a page with no focused frame
alexmos 2016/11/28 23:52:24 In what scenario would that happen during tab trav
avallee 2016/12/09 21:16:51 When we reach the end of the guest focusable eleme
alexmos 2016/12/12 22:41:15 Acknowledged. I didn't realize that the TakeFocus
878 setFocusedFrame(m_page->mainFrame()); 878 setFocusedFrame(m_page->mainFrame());
879 879
880 // setFocusedFrame above might reject to update m_focusedFrame, or 880 // setFocusedFrame above might reject to update m_focusedFrame, or
881 // m_focusedFrame might be changed by blur/focus event handlers. 881 // m_focusedFrame might be changed by blur/focus event handlers.
882 if (m_focusedFrame && m_focusedFrame->isLocalFrame() && 882 if (m_focusedFrame && m_focusedFrame->isLocalFrame() &&
883 toLocalFrame(m_focusedFrame.get())->view()) { 883 toLocalFrame(m_focusedFrame.get())->view()) {
884 toLocalFrame(m_focusedFrame.get())->selection().setFocused(focused); 884 toLocalFrame(m_focusedFrame.get())->selection().setFocused(focused);
885 dispatchEventsOnWindowAndFocusedElement( 885 dispatchEventsOnWindowAndFocusedElement(
886 toLocalFrame(m_focusedFrame.get())->document(), focused); 886 toLocalFrame(m_focusedFrame.get())->document(), focused);
887 } 887 }
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 1411
1412 return consumed; 1412 return consumed;
1413 } 1413 }
1414 1414
1415 DEFINE_TRACE(FocusController) { 1415 DEFINE_TRACE(FocusController) {
1416 visitor->trace(m_page); 1416 visitor->trace(m_page);
1417 visitor->trace(m_focusedFrame); 1417 visitor->trace(m_focusedFrame);
1418 } 1418 }
1419 1419
1420 } // namespace blink 1420 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698