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

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: Fix header include 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 // 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 LocalFrame* WebInputMethodControllerImpl::frame() const { 137 LocalFrame* WebInputMethodControllerImpl::frame() const {
134 return m_webLocalFrame->frame(); 138 return m_webLocalFrame->frame();
135 } 139 }
136 140
137 InputMethodController& WebInputMethodControllerImpl::inputMethodController() 141 InputMethodController& WebInputMethodControllerImpl::inputMethodController()
138 const { 142 const {
139 return frame()->inputMethodController(); 143 return frame()->inputMethodController();
140 } 144 }
141 145
142 WebPlugin* WebInputMethodControllerImpl::focusedPluginIfInputMethodSupported() 146 WebPlugin* WebInputMethodControllerImpl::focusedPluginIfInputMethodSupported()
143 const { 147 const {
144 WebPluginContainerImpl* container = 148 WebPluginContainerImpl* container =
145 WebLocalFrameImpl::currentPluginContainer(frame()); 149 WebLocalFrameImpl::currentPluginContainer(frame());
146 if (container && container->supportsInputMethod()) 150 if (container && container->supportsInputMethod())
147 return container->plugin(); 151 return container->plugin();
148 return nullptr; 152 return nullptr;
149 } 153 }
150 154
151 } // namespace blink 155 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698