Chromium Code Reviews| Index: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp |
| diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp |
| index 4998d018a4b0aa5acf4cb15650c0c993af9e3956..f6da2f23289ccd7b001f1db160a8ac907d762896 100644 |
| --- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp |
| +++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp |
| @@ -50,6 +50,7 @@ |
| #include "platform/KeyboardCodes.h" |
| #include "platform/graphics/CompositorMutatorClient.h" |
| #include "public/platform/WebFrameScheduler.h" |
| +#include "public/web/WebRange.h" |
| #include "public/web/WebWidgetClient.h" |
| #include "web/CompositorMutatorImpl.h" |
| #include "web/CompositorProxyClientImpl.h" |
| @@ -466,32 +467,28 @@ bool WebFrameWidgetImpl::setComposition( |
| int selectionStart, |
| int selectionEnd) |
| { |
| - // FIXME: To be implemented. |
| - return false; |
| + return view()->setComposition(text, underlines, selectionStart, selectionEnd); |
| } |
| bool WebFrameWidgetImpl::confirmComposition() |
| { |
| // FIXME: To be implemented. |
| - return false; |
| + return view()->confirmComposition(); |
| } |
| bool WebFrameWidgetImpl::confirmComposition(ConfirmCompositionBehavior selectionBehavior) |
| { |
| - // FIXME: To be implemented. |
| - return false; |
| + return view()->confirmComposition(selectionBehavior); |
| } |
| bool WebFrameWidgetImpl::confirmComposition(const WebString& text) |
| { |
| - // FIXME: To be implemented. |
| - return false; |
| + return view()->confirmComposition(text); |
| } |
| bool WebFrameWidgetImpl::compositionRange(size_t* location, size_t* length) |
| { |
| - // FIXME: To be implemented. |
| - return false; |
| + return view()->compositionRange(location, length); |
| } |
| WebTextInputInfo WebFrameWidgetImpl::textInputInfo() |
| @@ -645,6 +642,42 @@ void WebFrameWidgetImpl::didChangeWindowResizerRect() |
| m_localRoot->frameView()->windowResizerRectChanged(); |
| } |
| +bool WebFrameWidgetImpl::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 = view()->focusedFrame()->toWebLocalFrame(); |
|
kenrb
2016/06/10 20:52:03
Should this call focusedWebLocalFrameInWidget()?
EhsanK
2016/06/27 21:14:50
Yes, I think it has to. Thanks for pointing this o
|
| + if (!frame) |
| + 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 WebFrameWidgetImpl::adjustReplacementRangeForAccentedCharacters(int start, int length) |
| +{ |
| + if (WebLocalFrame* frame = focusedWebLocalFrameInWidget()) { |
| + WebRange webrange = WebRange::fromDocumentRange(frame, start, length); |
| + if (!webrange.isNull()) |
| + frame->selectRange(webrange); |
| + } |
| +} |
| + |
| void WebFrameWidgetImpl::handleMouseLeave(LocalFrame& mainFrame, const WebMouseEvent& event) |
| { |
| // FIXME: WebWidget doesn't have the method below. |
| @@ -1116,4 +1149,10 @@ HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p |
| return result; |
| } |
| +WebLocalFrame* WebFrameWidgetImpl::focusedWebLocalFrameInWidget() const |
| +{ |
| + LocalFrame* frame = page()->focusController().focusedFrame(); |
| + return m_localRoot->frame() == frame ? WebLocalFrameImpl::fromFrame(frame) : nullptr; |
|
kenrb
2016/06/10 20:52:03
This is wrong for a couple of reasons, I think you
EhsanK
2016/06/27 21:14:50
Yes I think I missed the frame->localFrameRoot() p
|
| +} |
| + |
| } // namespace blink |