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

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

Issue 2561543003: Move call path for resetInputMethod (Closed)
Patch Set: 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 21 matching lines...) Expand all
32 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
33 #include "core/dom/Element.h" 33 #include "core/dom/Element.h"
34 #include "core/dom/ElementTraversal.h" 34 #include "core/dom/ElementTraversal.h"
35 #include "core/dom/Range.h" 35 #include "core/dom/Range.h"
36 #include "core/dom/shadow/ElementShadow.h" 36 #include "core/dom/shadow/ElementShadow.h"
37 #include "core/dom/shadow/ShadowRoot.h" 37 #include "core/dom/shadow/ShadowRoot.h"
38 #include "core/dom/shadow/SlotScopedTraversal.h" 38 #include "core/dom/shadow/SlotScopedTraversal.h"
39 #include "core/editing/EditingUtilities.h" // For firstPositionInOrBeforeNode 39 #include "core/editing/EditingUtilities.h" // For firstPositionInOrBeforeNode
40 #include "core/editing/Editor.h" 40 #include "core/editing/Editor.h"
41 #include "core/editing/FrameSelection.h" 41 #include "core/editing/FrameSelection.h"
42 #include "core/editing/InputMethodController.h"
42 #include "core/events/Event.h" 43 #include "core/events/Event.h"
43 #include "core/frame/FrameClient.h" 44 #include "core/frame/FrameClient.h"
44 #include "core/frame/FrameView.h" 45 #include "core/frame/FrameView.h"
45 #include "core/frame/LocalDOMWindow.h" 46 #include "core/frame/LocalDOMWindow.h"
46 #include "core/frame/LocalFrame.h" 47 #include "core/frame/LocalFrame.h"
47 #include "core/frame/RemoteFrame.h" 48 #include "core/frame/RemoteFrame.h"
48 #include "core/frame/Settings.h" 49 #include "core/frame/Settings.h"
49 #include "core/html/HTMLAreaElement.h" 50 #include "core/html/HTMLAreaElement.h"
50 #include "core/html/HTMLImageElement.h" 51 #include "core/html/HTMLImageElement.h"
51 #include "core/html/HTMLPlugInElement.h" 52 #include "core/html/HTMLPlugInElement.h"
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 1122
1122 Element* oldFocusedElement = 1123 Element* oldFocusedElement =
1123 oldDocument ? oldDocument->focusedElement() : nullptr; 1124 oldDocument ? oldDocument->focusedElement() : nullptr;
1124 if (element && oldFocusedElement == element) 1125 if (element && oldFocusedElement == element)
1125 return true; 1126 return true;
1126 1127
1127 if (oldFocusedElement && isRootEditableElement(*oldFocusedElement) && 1128 if (oldFocusedElement && isRootEditableElement(*oldFocusedElement) &&
1128 !relinquishesEditingFocus(*oldFocusedElement)) 1129 !relinquishesEditingFocus(*oldFocusedElement))
1129 return false; 1130 return false;
1130 1131
1131 m_page->chromeClient().willSetInputMethodState(); 1132 if (oldFocusedFrame)
1133 oldFocusedFrame->inputMethodController().willChangeFocusTo(element);
yosin_UTC9 2016/12/07 09:38:19 yosin@'s self note: Introducing |willChangeFocusT
Changwan Ryu 2016/12/08 01:16:30 This sounds like a great idea. I was thinking of a
1132 1134
1133 Document* newDocument = nullptr; 1135 Document* newDocument = nullptr;
1134 if (element) 1136 if (element)
1135 newDocument = &element->document(); 1137 newDocument = &element->document();
1136 else if (newFocusedFrame && newFocusedFrame->isLocalFrame()) 1138 else if (newFocusedFrame && newFocusedFrame->isLocalFrame())
1137 newDocument = toLocalFrame(newFocusedFrame)->document(); 1139 newDocument = toLocalFrame(newFocusedFrame)->document();
1138 1140
1139 if (newDocument && oldDocument == newDocument && 1141 if (newDocument && oldDocument == newDocument &&
1140 newDocument->focusedElement() == element) 1142 newDocument->focusedElement() == element)
1141 return true; 1143 return true;
(...skipping 269 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

Powered by Google App Engine
This is Rietveld 408576698