OLD | NEW |
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 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 void RenderWidget::set_next_paint_is_repaint_ack() { | 1298 void RenderWidget::set_next_paint_is_repaint_ack() { |
1299 next_paint_flags_ |= ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK; | 1299 next_paint_flags_ |= ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK; |
1300 } | 1300 } |
1301 | 1301 |
1302 void RenderWidget::UpdateInputMethod() { | 1302 void RenderWidget::UpdateInputMethod() { |
1303 if (!input_method_is_active_) | 1303 if (!input_method_is_active_) |
1304 return; | 1304 return; |
1305 | 1305 |
1306 ui::TextInputType new_type = GetTextInputType(); | 1306 ui::TextInputType new_type = GetTextInputType(); |
1307 bool new_can_compose_inline = CanComposeInline(); | 1307 bool new_can_compose_inline = CanComposeInline(); |
1308 WebRect new_caret_bounds; | 1308 WebRect new_caret_bounds = GetCaretBounds(); |
1309 | |
1310 if (webwidget_) | |
1311 new_caret_bounds = webwidget_->caretOrSelectionBounds(); | |
1312 | 1309 |
1313 // Only sends text input type and caret bounds to the browser process if they | 1310 // Only sends text input type and caret bounds to the browser process if they |
1314 // are changed. | 1311 // are changed. |
1315 if (text_input_type_ != new_type || caret_bounds_ != new_caret_bounds || | 1312 if (text_input_type_ != new_type || caret_bounds_ != new_caret_bounds || |
1316 can_compose_inline_ != new_can_compose_inline) { | 1313 can_compose_inline_ != new_can_compose_inline) { |
1317 text_input_type_ = new_type; | 1314 text_input_type_ = new_type; |
1318 can_compose_inline_ = new_can_compose_inline; | 1315 can_compose_inline_ = new_can_compose_inline; |
1319 caret_bounds_ = new_caret_bounds; | 1316 caret_bounds_ = new_caret_bounds; |
1320 Send(new ViewHostMsg_ImeUpdateTextInputState( | 1317 Send(new ViewHostMsg_ImeUpdateTextInputState( |
1321 routing_id(), new_type, new_can_compose_inline, new_caret_bounds)); | 1318 routing_id(), new_type, new_can_compose_inline, new_caret_bounds)); |
1322 } | 1319 } |
1323 } | 1320 } |
1324 | 1321 |
| 1322 gfx::Rect RenderWidget::GetCaretBounds() { |
| 1323 if (!webwidget_) |
| 1324 return gfx::Rect(); |
| 1325 return webwidget_->caretOrSelectionBounds(); |
| 1326 } |
| 1327 |
| 1328 // Check WebKit::WebTextInputType and ui::TextInputType is kept in sync. |
1325 COMPILE_ASSERT(int(WebKit::WebTextInputTypeNone) == \ | 1329 COMPILE_ASSERT(int(WebKit::WebTextInputTypeNone) == \ |
1326 int(ui::TEXT_INPUT_TYPE_NONE), mismatching_enums); | 1330 int(ui::TEXT_INPUT_TYPE_NONE), mismatching_enums); |
1327 COMPILE_ASSERT(int(WebKit::WebTextInputTypeText) == \ | 1331 COMPILE_ASSERT(int(WebKit::WebTextInputTypeText) == \ |
1328 int(ui::TEXT_INPUT_TYPE_TEXT), mismatching_enums); | 1332 int(ui::TEXT_INPUT_TYPE_TEXT), mismatching_enums); |
1329 COMPILE_ASSERT(int(WebKit::WebTextInputTypePassword) == \ | 1333 COMPILE_ASSERT(int(WebKit::WebTextInputTypePassword) == \ |
1330 int(ui::TEXT_INPUT_TYPE_PASSWORD), mismatching_enums); | 1334 int(ui::TEXT_INPUT_TYPE_PASSWORD), mismatching_enums); |
1331 COMPILE_ASSERT(int(WebKit::WebTextInputTypeSearch) == \ | 1335 COMPILE_ASSERT(int(WebKit::WebTextInputTypeSearch) == \ |
1332 int(ui::TEXT_INPUT_TYPE_SEARCH), mismatching_enums); | 1336 int(ui::TEXT_INPUT_TYPE_SEARCH), mismatching_enums); |
1333 COMPILE_ASSERT(int(WebKit::WebTextInputTypeEmail) == \ | 1337 COMPILE_ASSERT(int(WebKit::WebTextInputTypeEmail) == \ |
1334 int(ui::TEXT_INPUT_TYPE_EMAIL), mismatching_enums); | 1338 int(ui::TEXT_INPUT_TYPE_EMAIL), mismatching_enums); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 if (i->window == window) { | 1411 if (i->window == window) { |
1408 plugin_window_moves_.erase(i); | 1412 plugin_window_moves_.erase(i); |
1409 break; | 1413 break; |
1410 } | 1414 } |
1411 } | 1415 } |
1412 } | 1416 } |
1413 | 1417 |
1414 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1418 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
1415 return false; | 1419 return false; |
1416 } | 1420 } |
OLD | NEW |