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

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

Issue 2029423003: OOPIF IME: Renderer Side Changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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/WebViewImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index 0003e29d42b451d8872648ca81a9b81b86e07a54..0d1ea76d17e231dcb6a466d16b11798d27319955 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -2824,6 +2824,49 @@ void WebViewImpl::didChangeWindowResizerRect()
mainFrameImpl()->frameView()->windowResizerRectChanged();
}
+bool WebViewImpl::getCompositionCharacterBounds(WebVector<WebRect>& bounds)
+{
+ size_t offset = 0;
+ size_t characterCount = 0;
+ if (!compositionRange(&offset, &characterCount))
+ return false;
+
+ if (characterCount == 0)
+ return false;
+
+ WebLocalFrame* frame = focusedFrame()->toWebLocalFrame();
+
+ // Only consider frames whose local root is the main frame. For other
+ // local frames which have different local roots, the corresponding
+ // WebFrameWidget will handle this task.
+ if (frame->localRoot() != mainFrameImpl())
lfg 2016/07/05 18:30:46 Why is this needed?
EhsanK 2016/07/07 14:40:47 I need to make sure that only WebFrameWidgetImpl s
lfg 2016/07/07 15:13:31 See my comment in WebFrameWidgetImpl.cpp.
EhsanK 2016/07/07 20:25:07 Acknowledged.
+ return false;
+
+ if (!frame)
lfg 2016/07/05 18:30:46 This would've crashed in the if statement before.
EhsanK 2016/07/07 14:40:47 Thanks! Acknowledged.
+ return false;
+
+ WebVector<WebRect> result(characterCount);
+ WebRect webrect;
+ for (size_t i = 0; i < characterCount; ++i) {
+ if (!frame->firstRectForCharacterRange(offset + i, 1, webrect)) {
+ DLOG(ERROR) << "Could not retrieve character rectangle at " << i;
+ return false;
+ }
+ result[i] = webrect;
+ }
+ bounds.swap(result);
+ return true;
+}
+
+void WebViewImpl::applyReplacementRange(int start, int length)
+{
+ if (WebLocalFrame* frame = focusedFrame()->toWebLocalFrame()) {
+ WebRange webrange = WebRange::fromDocumentRange(frame, start, length);
+ if (!webrange.isNull())
+ frame->selectRange(webrange);
+ }
+}
+
// WebView --------------------------------------------------------------------
WebSettingsImpl* WebViewImpl::settingsImpl()

Powered by Google App Engine
This is Rietveld 408576698