| Index: content/renderer/text_input_client_observer.cc
|
| diff --git a/content/renderer/text_input_client_observer.cc b/content/renderer/text_input_client_observer.cc
|
| index 5ce95ff6093742ac828679019e22a9cbee097912..238fc4f158a7eb581ef52c25335db1ddd601bafe 100644
|
| --- a/content/renderer/text_input_client_observer.cc
|
| +++ b/content/renderer/text_input_client_observer.cc
|
| @@ -8,9 +8,11 @@
|
| #include "content/common/text_input_client_messages.h"
|
| #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
|
| #include "content/renderer/render_view_impl.h"
|
| +#include "third_party/WebKit/public/platform/WebFloatQuad.h"
|
| #include "third_party/WebKit/public/platform/WebPoint.h"
|
| #include "third_party/WebKit/public/platform/WebRect.h"
|
| #include "third_party/WebKit/public/platform/WebString.h"
|
| +#include "third_party/WebKit/public/platform/WebVector.h"
|
| #include "third_party/WebKit/public/web/mac/WebSubstringUtil.h"
|
| #include "third_party/WebKit/public/web/WebFrame.h"
|
| #include "third_party/WebKit/public/web/WebView.h"
|
| @@ -29,6 +31,8 @@ TextInputClientObserver::~TextInputClientObserver() {
|
| bool TextInputClientObserver::OnMessageReceived(const IPC::Message& message) {
|
| bool handled = true;
|
| IPC_BEGIN_MESSAGE_MAP(TextInputClientObserver, message)
|
| + IPC_MESSAGE_HANDLER(TextInputClientMsg_StringAtPoint,
|
| + OnStringAtPoint)
|
| IPC_MESSAGE_HANDLER(TextInputClientMsg_CharacterIndexForPoint,
|
| OnCharacterIndexForPoint)
|
| IPC_MESSAGE_HANDLER(TextInputClientMsg_FirstRectForCharacterRange,
|
| @@ -43,6 +47,21 @@ blink::WebView* TextInputClientObserver::webview() {
|
| return render_view()->GetWebView();
|
| }
|
|
|
| +void TextInputClientObserver::OnStringAtPoint(gfx::Point point) {
|
| +#if defined(OS_MACOSX)
|
| + blink::WebPoint baselinePoint;
|
| + NSAttributedString* string = blink::WebSubstringUtil::attributedWordAtPoint(
|
| + webview(), point, baselinePoint);
|
| +
|
| + scoped_ptr<const mac::AttributedStringCoder::EncodedString> encoded(
|
| + mac::AttributedStringCoder::Encode(string));
|
| + Send(new TextInputClientReplyMsg_GotStringAtPoint(
|
| + routing_id(), *encoded.get(), baselinePoint));
|
| +#else
|
| + NOTIMPLEMENTED();
|
| +#endif
|
| +}
|
| +
|
| void TextInputClientObserver::OnCharacterIndexForPoint(gfx::Point point) {
|
| blink::WebPoint web_point(point);
|
| size_t index = webview()->focusedFrame()->characterIndexForPoint(web_point);
|
|
|