| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/text_input_client_observer.h" | 5 #include "content/renderer/text_input_client_observer.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "content/common/text_input_client_messages.h" | 8 #include "content/common/text_input_client_messages.h" |
| 9 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 9 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 10 #include "content/renderer/render_view_impl.h" | 10 #include "content/renderer/render_view_impl.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 frame->firstRectForCharacterRange(range.start(), range.length(), | 81 frame->firstRectForCharacterRange(range.start(), range.length(), |
| 82 web_rect); | 82 web_rect); |
| 83 rect = web_rect; | 83 rect = web_rect; |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 Send(new TextInputClientReplyMsg_GotFirstRectForRange(routing_id(), rect)); | 86 Send(new TextInputClientReplyMsg_GotFirstRectForRange(routing_id(), rect)); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void TextInputClientObserver::OnStringForRange(gfx::Range range) { | 89 void TextInputClientObserver::OnStringForRange(gfx::Range range) { |
| 90 #if defined(OS_MACOSX) | 90 #if defined(OS_MACOSX) |
| 91 blink::WebPoint baselinePoint; |
| 91 NSAttributedString* string = nil; | 92 NSAttributedString* string = nil; |
| 92 blink::WebLocalFrame* frame = webview()->focusedFrame()->toWebLocalFrame(); | 93 blink::WebLocalFrame* frame = webview()->focusedFrame()->toWebLocalFrame(); |
| 93 if (frame) { | 94 if (frame) { |
| 94 string = blink::WebSubstringUtil::attributedSubstringInRange( | 95 string = blink::WebSubstringUtil::attributedSubstringInRange( |
| 95 frame, range.start(), range.length()); | 96 frame, range.start(), range.length(), &baselinePoint); |
| 96 } | 97 } |
| 97 scoped_ptr<const mac::AttributedStringCoder::EncodedString> encoded( | 98 scoped_ptr<const mac::AttributedStringCoder::EncodedString> encoded( |
| 98 mac::AttributedStringCoder::Encode(string)); | 99 mac::AttributedStringCoder::Encode(string)); |
| 99 Send(new TextInputClientReplyMsg_GotStringForRange(routing_id(), | 100 Send(new TextInputClientReplyMsg_GotStringForRange(routing_id(), |
| 100 *encoded.get())); | 101 *encoded.get(), baselinePoint)); |
| 101 #else | 102 #else |
| 102 NOTIMPLEMENTED(); | 103 NOTIMPLEMENTED(); |
| 103 #endif | 104 #endif |
| 104 } | 105 } |
| 105 | 106 |
| 106 } // namespace content | 107 } // namespace content |
| OLD | NEW |