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

Side by Side Diff: third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp

Issue 2568093003: Support parsing BackgroundSpans and UnderlineSpans in Android IME's commitText() (Closed)
Patch Set: Use addCompositionUnderlines() where I said I couldn't 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 // 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets 108 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
109 // needs to be audited. See http://crbug.com/590369 for more details. 109 // needs to be audited. See http://crbug.com/590369 for more details.
110 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); 110 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
111 111
112 return inputMethodController().finishComposingText( 112 return inputMethodController().finishComposingText(
113 selectionBehavior == WebInputMethodController::KeepSelection 113 selectionBehavior == WebInputMethodController::KeepSelection
114 ? InputMethodController::KeepSelection 114 ? InputMethodController::KeepSelection
115 : InputMethodController::DoNotKeepSelection); 115 : InputMethodController::DoNotKeepSelection);
116 } 116 }
117 117
118 bool WebInputMethodControllerImpl::commitText(const WebString& text, 118 bool WebInputMethodControllerImpl::commitText(
119 int relativeCaretPosition) { 119 const WebString& text,
120 const WebVector<WebCompositionUnderline>& underlines,
121 int relativeCaretPosition) {
120 UserGestureIndicator gestureIndicator(DocumentUserGestureToken::create( 122 UserGestureIndicator gestureIndicator(DocumentUserGestureToken::create(
121 frame()->document(), UserGestureToken::NewGesture)); 123 frame()->document(), UserGestureToken::NewGesture));
122 124
123 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported()) 125 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported())
124 return plugin->commitText(text, relativeCaretPosition); 126 return plugin->commitText(text, underlines, relativeCaretPosition);
125 127
126 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets 128 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
127 // needs to be audited. See http://crbug.com/590369 for more details. 129 // needs to be audited. See http://crbug.com/590369 for more details.
128 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); 130 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
129 131
130 return inputMethodController().commitText(text, relativeCaretPosition); 132 return inputMethodController().commitText(
133 text, CompositionUnderlineVectorBuilder(underlines),
134 relativeCaretPosition);
131 } 135 }
132 136
133 WebTextInputInfo WebInputMethodControllerImpl::textInputInfo() { 137 WebTextInputInfo WebInputMethodControllerImpl::textInputInfo() {
134 return frame()->inputMethodController().textInputInfo(); 138 return frame()->inputMethodController().textInputInfo();
135 } 139 }
136 140
137 WebTextInputType WebInputMethodControllerImpl::textInputType() { 141 WebTextInputType WebInputMethodControllerImpl::textInputType() {
138 return frame()->inputMethodController().textInputType(); 142 return frame()->inputMethodController().textInputType();
139 } 143 }
140 144
141 LocalFrame* WebInputMethodControllerImpl::frame() const { 145 LocalFrame* WebInputMethodControllerImpl::frame() const {
142 return m_webLocalFrame->frame(); 146 return m_webLocalFrame->frame();
143 } 147 }
144 148
145 InputMethodController& WebInputMethodControllerImpl::inputMethodController() 149 InputMethodController& WebInputMethodControllerImpl::inputMethodController()
146 const { 150 const {
147 return frame()->inputMethodController(); 151 return frame()->inputMethodController();
148 } 152 }
149 153
150 WebPlugin* WebInputMethodControllerImpl::focusedPluginIfInputMethodSupported() 154 WebPlugin* WebInputMethodControllerImpl::focusedPluginIfInputMethodSupported()
151 const { 155 const {
152 WebPluginContainerImpl* container = 156 WebPluginContainerImpl* container =
153 WebLocalFrameImpl::currentPluginContainer(frame()); 157 WebLocalFrameImpl::currentPluginContainer(frame());
154 if (container && container->supportsInputMethod()) 158 if (container && container->supportsInputMethod())
155 return container->plugin(); 159 return container->plugin();
156 return nullptr; 160 return nullptr;
157 } 161 }
158 162
159 } // namespace blink 163 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebInputMethodControllerImpl.h ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698