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(); |