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

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

Issue 2323983003: DO NOT SUBMIT: Bundle IME-related messages into one for batch edit (Closed)
Patch Set: fixed nits and fixed blimp test 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 f2768e08c7501b77daf6b08f034399e2faa6d09e..bff4278c127c03c77fc580e04d62feb0ba702b89 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -2395,6 +2395,62 @@ bool WebViewImpl::confirmComposition(const WebString& text, ConfirmCompositionBe
return focused->inputMethodController().confirmCompositionOrInsertText(text, selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : InputMethodController::DoNotKeepSelection);
}
+bool WebViewImpl::setEditableSelectionOffsets(int start, int end)
+{
+ TRACE_EVENT0("blink", "WebViewImpl::setEditableSelectionOffsets");
+ LocalFrame* focused = focusedLocalFrameAvailableForIme();
+ if (!focused)
+ return false;
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ focused->document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
+ return focused->inputMethodController().setEditableSelectionOffsets(PlainTextRange(start, end));
+}
+
+bool WebViewImpl::setCompositionFromExistingText(int compositionStart, int compositionEnd, const WebVector<WebCompositionUnderline>& underlines)
+{
+ TRACE_EVENT0("blink", "WebViewImpl::setCompositionFromExistingText");
+
+ LocalFrame* focused = focusedLocalFrameAvailableForIme();
+ if (!focused)
+ return false;
+ if (!focused->editor().canEdit())
+ return false;
+ InputMethodController& inputMethodController = focused->inputMethodController();
+ inputMethodController.cancelComposition();
+
+ if (compositionStart == compositionEnd)
+ return true;
+
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ focused->document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
+ inputMethodController.setCompositionFromExistingText(CompositionUnderlineVectorBuilder(underlines), compositionStart, compositionEnd);
+
+ return true;
+}
+
+void WebViewImpl::extendSelectionAndDelete(int before, int after)
+{
+ TRACE_EVENT0("blink", "WebViewImpl::extendSelectionAndDelete");
+ LocalFrame* focused = focusedLocalFrameAvailableForIme();
+ if (!focused)
+ return;
+
+ if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused)) {
+ plugin->extendSelectionAndDelete(before, after);
+ return;
+ }
+
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ focused->document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
+ focused->inputMethodController().extendSelectionAndDelete(before, after);
+}
+
WebRange WebViewImpl::compositionRange()
{
LocalFrame* focused = focusedLocalFrameAvailableForIme();
« 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