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

Unified Diff: Source/web/WebFrameImpl.cpp

Issue 201773005: Copy a few selection related methods to WebFrame from WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update test Created 6 years, 9 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 | « Source/web/WebFrameImpl.h ('k') | Source/web/WebViewImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebFrameImpl.cpp
diff --git a/Source/web/WebFrameImpl.cpp b/Source/web/WebFrameImpl.cpp
index 4fc38f19600ea2535cdb3a57cc34c404476d5486..7453ee2531db3a628d8efabbed6b8deafc433d5b 100644
--- a/Source/web/WebFrameImpl.cpp
+++ b/Source/web/WebFrameImpl.cpp
@@ -74,6 +74,7 @@
#include <algorithm>
#include "AssociatedURLLoader.h"
+#include "CompositionUnderlineVectorBuilder.h"
#include "EventListenerWrapper.h"
#include "FindInPageCoordinates.h"
#include "HTMLNames.h"
@@ -1359,6 +1360,36 @@ void WebFrameImpl::moveCaretSelection(const WebPoint& point)
frame()->selection().moveTo(position, UserTriggered);
}
+bool WebFrameImpl::setEditableSelectionOffsets(int start, int end)
+{
+ return frame()->inputMethodController().setEditableSelectionOffsets(PlainTextRange(start, end));
+}
+
+bool WebFrameImpl::setCompositionFromExistingText(int compositionStart, int compositionEnd, const WebVector<WebCompositionUnderline>& underlines)
+{
+ if (!frame()->editor().canEdit())
+ return false;
+
+ InputMethodController& inputMethodController = frame()->inputMethodController();
+ inputMethodController.cancelComposition();
+
+ if (compositionStart == compositionEnd)
+ return true;
+
+ inputMethodController.setCompositionFromExistingText(CompositionUnderlineVectorBuilder(underlines), compositionStart, compositionEnd);
+
+ return true;
+}
+
+void WebFrameImpl::extendSelectionAndDelete(int before, int after)
+{
+ if (WebPlugin* plugin = focusedPluginIfInputMethodSupported()) {
+ plugin->extendSelectionAndDelete(before, after);
+ return;
+ }
+ frame()->inputMethodController().extendSelectionAndDelete(before, after);
+}
+
void WebFrameImpl::setCaretVisible(bool visible)
{
frame()->selection().setCaretVisible(visible);
@@ -1378,6 +1409,14 @@ VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& poin
return VisiblePosition();
}
+WebPlugin* WebFrameImpl::focusedPluginIfInputMethodSupported()
+{
+ WebPluginContainerImpl* container = WebFrameImpl::pluginContainerFromNode(frame(), WebNode(frame()->document()->focusedElement()));
+ if (container && container->supportsInputMethod())
+ return container->plugin();
+ return 0;
+}
+
int WebFrameImpl::printBegin(const WebPrintParams& printParams, const WebNode& constrainToNode)
{
ASSERT(!frame()->document()->isFrameSet());
« no previous file with comments | « Source/web/WebFrameImpl.h ('k') | Source/web/WebViewImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698