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

Side by Side Diff: content/renderer/text_input_client_observer.cc

Issue 2012823003: Move IME related functions from WebFrame to WebLocalFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add CHECK in TextInputController::HasMarkedText() Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 void TextInputClientObserver::OnFirstRectForCharacterRange(gfx::Range range) { 82 void TextInputClientObserver::OnFirstRectForCharacterRange(gfx::Range range) {
83 gfx::Rect rect; 83 gfx::Rect rect;
84 #if defined(ENABLE_PLUGINS) 84 #if defined(ENABLE_PLUGINS)
85 if (render_view_impl_->GetFocusedPepperPlugin()) { 85 if (render_view_impl_->GetFocusedPepperPlugin()) {
86 rect = render_view_impl_->GetFocusedPepperPlugin()->GetCaretBounds(); 86 rect = render_view_impl_->GetFocusedPepperPlugin()->GetCaretBounds();
87 } else 87 } else
88 #endif 88 #endif
89 { 89 {
90 blink::WebFrame* frame = webview()->focusedFrame(); 90 blink::WebLocalFrame* frame = webview()->focusedFrame();
91 if (frame) { 91 blink::WebRect web_rect;
92 blink::WebRect web_rect; 92 frame->firstRectForCharacterRange(range.start(), range.length(), web_rect);
93 frame->firstRectForCharacterRange(range.start(), range.length(), 93 rect = web_rect;
94 web_rect);
95 rect = web_rect;
96 }
97 } 94 }
98 Send(new TextInputClientReplyMsg_GotFirstRectForRange(routing_id(), rect)); 95 Send(new TextInputClientReplyMsg_GotFirstRectForRange(routing_id(), rect));
99 } 96 }
100 97
101 void TextInputClientObserver::OnStringForRange(gfx::Range range) { 98 void TextInputClientObserver::OnStringForRange(gfx::Range range) {
102 #if defined(OS_MACOSX) 99 #if defined(OS_MACOSX)
103 blink::WebPoint baselinePoint; 100 blink::WebPoint baselinePoint;
104 NSAttributedString* string = nil; 101 NSAttributedString* string = nil;
105 blink::WebLocalFrame* frame = webview()->focusedFrame()->toWebLocalFrame(); 102 blink::WebLocalFrame* frame = webview()->focusedFrame();
106 if (frame) { 103 string = blink::WebSubstringUtil::attributedSubstringInRange(
107 string = blink::WebSubstringUtil::attributedSubstringInRange( 104 frame, range.start(), range.length(), &baselinePoint);
108 frame, range.start(), range.length(), &baselinePoint);
109 }
110 std::unique_ptr<const mac::AttributedStringCoder::EncodedString> encoded( 105 std::unique_ptr<const mac::AttributedStringCoder::EncodedString> encoded(
111 mac::AttributedStringCoder::Encode(string)); 106 mac::AttributedStringCoder::Encode(string));
112 Send(new TextInputClientReplyMsg_GotStringForRange(routing_id(), 107 Send(new TextInputClientReplyMsg_GotStringForRange(routing_id(),
113 *encoded.get(), baselinePoint)); 108 *encoded.get(), baselinePoint));
114 #else 109 #else
115 NOTIMPLEMENTED(); 110 NOTIMPLEMENTED();
116 #endif 111 #endif
117 } 112 }
118 113
119 } // namespace content 114 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698