Chromium Code Reviews| 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 6a5ae67d63ad9cf36e1ec62914937b6fcaa3acf6..a7df922c3e92c4a387717d1ea0d7aa0bf8a8d1cc 100644 |
| --- a/third_party/WebKit/Source/web/WebViewImpl.cpp |
| +++ b/third_party/WebKit/Source/web/WebViewImpl.cpp |
| @@ -2387,24 +2387,19 @@ bool WebViewImpl::confirmComposition(const WebString& text, ConfirmCompositionBe |
| return focused->inputMethodController().confirmCompositionOrInsertText(text, selectionBehavior == KeepSelection ? InputMethodController::KeepSelection : InputMethodController::DoNotKeepSelection); |
| } |
| -bool WebViewImpl::compositionRange(size_t* location, size_t* length) |
| +WebRange WebViewImpl::compositionRange() |
| { |
| LocalFrame* focused = focusedLocalFrameAvailableForIme(); |
| if (!focused) |
| - return false; |
| + return WebRange(); |
| const EphemeralRange range = focused->inputMethodController().compositionEphemeralRange(); |
| if (range.isNull()) |
| - return false; |
| + return WebRange(); |
| Element* editable = focused->selection().rootEditableElementOrDocumentElement(); |
| DCHECK(editable); |
| - PlainTextRange plainTextRange(PlainTextRange::create(*editable, range)); |
| - if (plainTextRange.isNull()) |
| - return false; |
| - *location = plainTextRange.start(); |
| - *length = plainTextRange.length(); |
| - return true; |
| + return PlainTextRange::create(*editable, range); |
| } |
| WebTextInputInfo WebViewImpl::textInputInfo() |
| @@ -2812,12 +2807,11 @@ void WebViewImpl::didChangeWindowResizerRect() |
| bool WebViewImpl::getCompositionCharacterBounds(WebVector<WebRect>& bounds) |
| { |
| - size_t offset = 0; |
| - size_t characterCount = 0; |
| - if (!compositionRange(&offset, &characterCount)) |
| + WebRange range = compositionRange(); |
| + if (range.isNull()) |
| return false; |
| - if (characterCount == 0) |
| + if (range.length() == 0) |
|
esprehn
2016/09/02 21:24:34
isEmpty() would be idiomatic.
|
| return false; |
| WebLocalFrame* frame = focusedFrame(); |
| @@ -2828,6 +2822,8 @@ bool WebViewImpl::getCompositionCharacterBounds(WebVector<WebRect>& bounds) |
| if (frame->localRoot() != mainFrameImpl()) |
| return false; |
| + size_t characterCount = range.length(); |
| + size_t offset = range.startOffset(); |
| WebVector<WebRect> result(characterCount); |
| WebRect webrect; |
| for (size_t i = 0; i < characterCount; ++i) { |