| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "web/WebInputMethodControllerImpl.h" | 5 #include "web/WebInputMethodControllerImpl.h" |
| 6 | 6 |
| 7 #include "core/InputTypeNames.h" | 7 #include "core/InputTypeNames.h" |
| 8 #include "core/dom/DocumentUserGestureToken.h" | 8 #include "core/dom/DocumentUserGestureToken.h" |
| 9 #include "core/editing/EditingUtilities.h" | 9 #include "core/editing/EditingUtilities.h" |
| 10 #include "core/editing/Editor.h" | 10 #include "core/editing/Editor.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 ConfirmCompositionBehavior selectionBehavior) { | 97 ConfirmCompositionBehavior selectionBehavior) { |
| 98 // TODO(ekaramad): Here and in other IME calls we should expect the | 98 // TODO(ekaramad): Here and in other IME calls we should expect the |
| 99 // call to be made when our frame is focused. This, however, is not the case | 99 // call to be made when our frame is focused. This, however, is not the case |
| 100 // all the time. For instance, resetInputMethod call on RenderViewImpl could | 100 // all the time. For instance, resetInputMethod call on RenderViewImpl could |
| 101 // be after losing the focus on frame. But since we return the core frame | 101 // be after losing the focus on frame. But since we return the core frame |
| 102 // in WebViewImpl::focusedLocalFrameInWidget(), we will reach here with | 102 // in WebViewImpl::focusedLocalFrameInWidget(), we will reach here with |
| 103 // |m_webLocalFrame| not focused on page. | 103 // |m_webLocalFrame| not focused on page. |
| 104 | 104 |
| 105 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported()) | 105 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported()) |
| 106 return plugin->finishComposingText(selectionBehavior); | 106 return plugin->finishComposingText(selectionBehavior); |
| 107 |
| 108 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| 109 // needs to be audited. See http://crbug.com/590369 for more details. |
| 110 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 111 |
| 107 return inputMethodController().finishComposingText( | 112 return inputMethodController().finishComposingText( |
| 108 selectionBehavior == WebInputMethodController::KeepSelection | 113 selectionBehavior == WebInputMethodController::KeepSelection |
| 109 ? InputMethodController::KeepSelection | 114 ? InputMethodController::KeepSelection |
| 110 : InputMethodController::DoNotKeepSelection); | 115 : InputMethodController::DoNotKeepSelection); |
| 111 } | 116 } |
| 112 | 117 |
| 113 bool WebInputMethodControllerImpl::commitText(const WebString& text, | 118 bool WebInputMethodControllerImpl::commitText(const WebString& text, |
| 114 int relativeCaretPosition) { | 119 int relativeCaretPosition) { |
| 115 UserGestureIndicator gestureIndicator(DocumentUserGestureToken::create( | 120 UserGestureIndicator gestureIndicator(DocumentUserGestureToken::create( |
| 116 frame()->document(), UserGestureToken::NewGesture)); | 121 frame()->document(), UserGestureToken::NewGesture)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 137 WebPlugin* WebInputMethodControllerImpl::focusedPluginIfInputMethodSupported() | 142 WebPlugin* WebInputMethodControllerImpl::focusedPluginIfInputMethodSupported() |
| 138 const { | 143 const { |
| 139 WebPluginContainerImpl* container = | 144 WebPluginContainerImpl* container = |
| 140 WebLocalFrameImpl::currentPluginContainer(frame()); | 145 WebLocalFrameImpl::currentPluginContainer(frame()); |
| 141 if (container && container->supportsInputMethod()) | 146 if (container && container->supportsInputMethod()) |
| 142 return container->plugin(); | 147 return container->plugin(); |
| 143 return nullptr; | 148 return nullptr; |
| 144 } | 149 } |
| 145 | 150 |
| 146 } // namespace blink | 151 } // namespace blink |
| OLD | NEW |