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

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

Issue 8073021: Implement Pepper IME API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge trunk. Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_widget.h ('k') | ppapi/examples/ime/ime.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 void RenderWidget::set_next_paint_is_repaint_ack() { 1287 void RenderWidget::set_next_paint_is_repaint_ack() {
1288 next_paint_flags_ |= ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK; 1288 next_paint_flags_ |= ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK;
1289 } 1289 }
1290 1290
1291 void RenderWidget::UpdateInputMethod() { 1291 void RenderWidget::UpdateInputMethod() {
1292 if (!input_method_is_active_) 1292 if (!input_method_is_active_)
1293 return; 1293 return;
1294 1294
1295 ui::TextInputType new_type = GetTextInputType(); 1295 ui::TextInputType new_type = GetTextInputType();
1296 bool new_can_compose_inline = CanComposeInline(); 1296 bool new_can_compose_inline = CanComposeInline();
1297 WebRect new_caret_bounds; 1297 WebRect new_caret_bounds = GetCaretBounds();
1298
1299 if (webwidget_)
1300 new_caret_bounds = webwidget_->caretOrSelectionBounds();
1301 1298
1302 // Only sends text input type and caret bounds to the browser process if they 1299 // Only sends text input type and caret bounds to the browser process if they
1303 // are changed. 1300 // are changed.
1304 if (text_input_type_ != new_type || caret_bounds_ != new_caret_bounds || 1301 if (text_input_type_ != new_type || caret_bounds_ != new_caret_bounds ||
1305 can_compose_inline_ != new_can_compose_inline) { 1302 can_compose_inline_ != new_can_compose_inline) {
1306 text_input_type_ = new_type; 1303 text_input_type_ = new_type;
1307 can_compose_inline_ = new_can_compose_inline; 1304 can_compose_inline_ = new_can_compose_inline;
1308 caret_bounds_ = new_caret_bounds; 1305 caret_bounds_ = new_caret_bounds;
1309 Send(new ViewHostMsg_ImeUpdateTextInputState( 1306 Send(new ViewHostMsg_ImeUpdateTextInputState(
1310 routing_id(), new_type, new_can_compose_inline, new_caret_bounds)); 1307 routing_id(), new_type, new_can_compose_inline, new_caret_bounds));
1311 } 1308 }
1312 } 1309 }
1313 1310
1311 gfx::Rect RenderWidget::GetCaretBounds() {
1312 if (!webwidget_)
1313 return gfx::Rect();
1314 return webwidget_->caretOrSelectionBounds();
1315 }
1316
1317 // Check WebKit::WebTextInputType and ui::TextInputType is kept in sync.
1314 COMPILE_ASSERT(int(WebKit::WebTextInputTypeNone) == \ 1318 COMPILE_ASSERT(int(WebKit::WebTextInputTypeNone) == \
1315 int(ui::TEXT_INPUT_TYPE_NONE), mismatching_enums); 1319 int(ui::TEXT_INPUT_TYPE_NONE), mismatching_enums);
1316 COMPILE_ASSERT(int(WebKit::WebTextInputTypeText) == \ 1320 COMPILE_ASSERT(int(WebKit::WebTextInputTypeText) == \
1317 int(ui::TEXT_INPUT_TYPE_TEXT), mismatching_enums); 1321 int(ui::TEXT_INPUT_TYPE_TEXT), mismatching_enums);
1318 COMPILE_ASSERT(int(WebKit::WebTextInputTypePassword) == \ 1322 COMPILE_ASSERT(int(WebKit::WebTextInputTypePassword) == \
1319 int(ui::TEXT_INPUT_TYPE_PASSWORD), mismatching_enums); 1323 int(ui::TEXT_INPUT_TYPE_PASSWORD), mismatching_enums);
1320 COMPILE_ASSERT(int(WebKit::WebTextInputTypeSearch) == \ 1324 COMPILE_ASSERT(int(WebKit::WebTextInputTypeSearch) == \
1321 int(ui::TEXT_INPUT_TYPE_SEARCH), mismatching_enums); 1325 int(ui::TEXT_INPUT_TYPE_SEARCH), mismatching_enums);
1322 COMPILE_ASSERT(int(WebKit::WebTextInputTypeEmail) == \ 1326 COMPILE_ASSERT(int(WebKit::WebTextInputTypeEmail) == \
1323 int(ui::TEXT_INPUT_TYPE_EMAIL), mismatching_enums); 1327 int(ui::TEXT_INPUT_TYPE_EMAIL), mismatching_enums);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 } 1404 }
1401 } 1405 }
1402 1406
1403 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { 1407 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) {
1404 return false; 1408 return false;
1405 } 1409 }
1406 1410
1407 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { 1411 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const {
1408 return false; 1412 return false;
1409 } 1413 }
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | ppapi/examples/ime/ime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698