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

Unified Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2339793002: Handle newCursorPosition correctly for Android's commitText() (Closed)
Patch Set: Fix compile error (rebased on r418371) Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebViewImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index e2c21cc952e1a42bf5d9c046f4bdd8f383304559..5b4dacfcff21629db0a501546f56b480da727161 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -2300,7 +2300,7 @@ void WebViewImpl::setFocus(bool enable)
// needs to be audited. See http://crbug.com/590369 for more details.
focusedFrame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
- focusedFrame->inputMethodController().confirmComposition();
+ focusedFrame->inputMethodController().finishComposingText(InputMethodController::KeepSelection);
if (autofillClient)
autofillClient->setIgnoreTextChanges(false);
@@ -2368,36 +2368,34 @@ bool WebViewImpl::setComposition(
// TODO(ekaramad):These methods are almost duplicated in WebFrameWidgetImpl as
// well. This code needs to be refactored (http://crbug.com/629721).
-bool WebViewImpl::confirmComposition()
+bool WebViewImpl::finishComposingText(ConfirmCompositionBehavior selectionBehavior)
{
- return confirmComposition(DoNotKeepSelection);
-}
+ LocalFrame* focused = focusedLocalFrameAvailableForIme();
+ if (!focused)
+ return false;
-bool WebViewImpl::confirmComposition(ConfirmCompositionBehavior selectionBehavior)
-{
- return confirmComposition(WebString(), selectionBehavior);
+ if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused))
+ return plugin->finishComposingText(selectionBehavior);
+
+ return focused->inputMethodController().finishComposingText(selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : InputMethodController::DoNotKeepSelection);
}
-bool WebViewImpl::confirmComposition(const WebString& text)
+bool WebViewImpl::commitText(const WebString& text, int relativeCaretPosition)
{
UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture);
- return confirmComposition(text, DoNotKeepSelection);
-}
-bool WebViewImpl::confirmComposition(const WebString& text, ConfirmCompositionBehavior selectionBehavior)
-{
LocalFrame* focused = focusedLocalFrameAvailableForIme();
if (!focused)
return false;
if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused))
- return plugin->confirmComposition(text, selectionBehavior);
+ return plugin->commitText(text, relativeCaretPosition);
// TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
// needs to be audited. See http://crbug.com/590369 for more details.
focused->document()->updateStyleAndLayoutIgnorePendingStylesheets();
- return focused->inputMethodController().confirmCompositionOrInsertText(text, selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : InputMethodController::DoNotKeepSelection);
+ return focused->inputMethodController().commitText(text, relativeCaretPosition);
}
// TODO(ekaramad):This method is almost duplicated in WebFrameWidgetImpl as
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.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