Index: Source/WebKit/chromium/src/WebViewImpl.cpp |
diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp |
index 102596b73198c8681aa7e1df8daef5e66bafcd01..a49b290e7a1ef9a3fd0821a56abe563023660912 100644 |
--- a/Source/WebKit/chromium/src/WebViewImpl.cpp |
+++ b/Source/WebKit/chromium/src/WebViewImpl.cpp |
@@ -114,6 +114,7 @@ |
#include "WebPluginContainerImpl.h" |
#include "WebPoint.h" |
#include "WebPopupMenuImpl.h" |
+#include "WebRange.h" |
#include "WebRect.h" |
#include "WebRuntimeFeatures.h" |
#include "WebSettingsImpl.h" |
@@ -1384,6 +1385,24 @@ bool WebViewImpl::confirmComposition(const WebString& text) |
return true; |
} |
+bool WebViewImpl::compositionRange(unsigned* location, unsigned* length) |
+{ |
+ Frame* focused = focusedWebCoreFrame(); |
+ if (!focused || !m_imeAcceptEvents) |
+ return false; |
+ Editor* editor = focused->editor(); |
+ if (!editor || !editor->hasComposition()) |
+ return false; |
+ |
+ RefPtr<Range> range = editor->compositionRange(); |
+ if (!range.get()) |
+ return false; |
+ |
+ if (range->getLocationAndLength(*location, *length)) |
+ return true; |
+ return false; |
+} |
+ |
WebTextInputType WebViewImpl::textInputType() |
{ |
WebTextInputType type = WebTextInputTypeNone; |
@@ -1444,6 +1463,25 @@ WebRect WebViewImpl::caretOrSelectionBounds() |
return rect; |
} |
+bool WebViewImpl::caretOrSelectionRange(unsigned* location, unsigned* length) |
+{ |
+ const Frame* focused = focusedWebCoreFrame(); |
+ if (!focused) |
+ return false; |
+ |
+ SelectionController* controller = focused->selection(); |
+ if (!controller) |
+ return false; |
+ |
+ RefPtr<Range> range = controller->selection().firstRange(); |
+ if (!range.get()) |
+ return false; |
+ |
+ if (range->getLocationAndLength(*location, *length)) |
+ return true; |
+ return false; |
+} |
+ |
void WebViewImpl::setTextDirection(WebTextDirection direction) |
{ |
// The Editor::setBaseWritingDirection() function checks if we can change |