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

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: sync Created 4 years, 6 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();
dcheng 2016/06/13 17:29:45 Same questions in this file about null |frame|.
91 if (frame) { 91 if (frame) {
92 blink::WebRect web_rect; 92 blink::WebRect web_rect;
93 frame->firstRectForCharacterRange(range.start(), range.length(), 93 frame->firstRectForCharacterRange(range.start(), range.length(),
94 web_rect); 94 web_rect);
95 rect = web_rect; 95 rect = web_rect;
96 } 96 }
97 } 97 }
98 Send(new TextInputClientReplyMsg_GotFirstRectForRange(routing_id(), rect)); 98 Send(new TextInputClientReplyMsg_GotFirstRectForRange(routing_id(), rect));
99 } 99 }
100 100
101 void TextInputClientObserver::OnStringForRange(gfx::Range range) { 101 void TextInputClientObserver::OnStringForRange(gfx::Range range) {
102 #if defined(OS_MACOSX) 102 #if defined(OS_MACOSX)
103 blink::WebPoint baselinePoint; 103 blink::WebPoint baselinePoint;
104 NSAttributedString* string = nil; 104 NSAttributedString* string = nil;
105 blink::WebLocalFrame* frame = webview()->focusedFrame()->toWebLocalFrame(); 105 blink::WebLocalFrame* frame = webview()->focusedFrame();
106 if (frame) { 106 if (frame) {
107 string = blink::WebSubstringUtil::attributedSubstringInRange( 107 string = blink::WebSubstringUtil::attributedSubstringInRange(
108 frame, range.start(), range.length(), &baselinePoint); 108 frame, range.start(), range.length(), &baselinePoint);
109 } 109 }
110 std::unique_ptr<const mac::AttributedStringCoder::EncodedString> encoded( 110 std::unique_ptr<const mac::AttributedStringCoder::EncodedString> encoded(
111 mac::AttributedStringCoder::Encode(string)); 111 mac::AttributedStringCoder::Encode(string));
112 Send(new TextInputClientReplyMsg_GotStringForRange(routing_id(), 112 Send(new TextInputClientReplyMsg_GotStringForRange(routing_id(),
113 *encoded.get(), baselinePoint)); 113 *encoded.get(), baselinePoint));
114 #else 114 #else
115 NOTIMPLEMENTED(); 115 NOTIMPLEMENTED();
116 #endif 116 #endif
117 } 117 }
118 118
119 } // namespace content 119 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698