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

Unified Diff: third_party/WebKit/Source/web/WebFrameWidgetImpl.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
Index: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
index 7347ae0956fcf288e981f84ddc4aedebcbe732ad..bd1c408ef78183ba0e384f12d304a277ce1b9e0a 100644
--- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
+++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
@@ -482,7 +482,7 @@ void WebFrameWidgetImpl::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);
@@ -549,36 +549,33 @@ bool WebFrameWidgetImpl::setComposition(
// TODO(ekaramad):These methods are almost duplicated in WebViewImpl as well.
// This code needs to be refactored (http://crbug.com/629721).
-bool WebFrameWidgetImpl::confirmComposition()
+bool WebFrameWidgetImpl::commitText(const WebString& text, int relativeCaretPosition)
{
- return confirmComposition(DoNotKeepSelection);
-}
+ UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture);
+ LocalFrame* focused = focusedLocalFrameAvailableForIme();
+ if (!focused)
+ return false;
-bool WebFrameWidgetImpl::confirmComposition(ConfirmCompositionBehavior selectionBehavior)
-{
- return confirmComposition(WebString(), selectionBehavior);
-}
+ if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused))
+ return plugin->commitText(text, relativeCaretPosition);
-bool WebFrameWidgetImpl::confirmComposition(const WebString& text)
-{
- UserGestureIndicator gestureIndicator(DefinitelyProcessingNewUserGesture);
- return confirmComposition(text, DoNotKeepSelection);
+ return focused->inputMethodController().commitText(text, relativeCaretPosition);
}
-bool WebFrameWidgetImpl::confirmComposition(const WebString& text, ConfirmCompositionBehavior selectionBehavior) const
+bool WebFrameWidgetImpl::finishComposingText(ConfirmCompositionBehavior selectionBehavior)
{
LocalFrame* focused = focusedLocalFrameAvailableForIme();
if (!focused)
return false;
if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused))
- return plugin->confirmComposition(text, selectionBehavior);
+ return plugin->finishComposingText(selectionBehavior);
// 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().finishComposingText(selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : InputMethodController::DoNotKeepSelection);
}
// TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This
« no previous file with comments | « third_party/WebKit/Source/web/WebFrameWidgetImpl.h ('k') | third_party/WebKit/Source/web/WebLocalFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698