| 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 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 void RenderWidget::set_next_paint_is_repaint_ack() { | 1285 void RenderWidget::set_next_paint_is_repaint_ack() { |
| 1286 next_paint_flags_ |= ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK; | 1286 next_paint_flags_ |= ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK; |
| 1287 } | 1287 } |
| 1288 | 1288 |
| 1289 void RenderWidget::UpdateInputMethod() { | 1289 void RenderWidget::UpdateInputMethod() { |
| 1290 if (!input_method_is_active_) | 1290 if (!input_method_is_active_) |
| 1291 return; | 1291 return; |
| 1292 | 1292 |
| 1293 ui::TextInputType new_type = GetTextInputType(); | 1293 ui::TextInputType new_type = GetTextInputType(); |
| 1294 bool new_can_compose_inline = CanComposeInline(); | 1294 bool new_can_compose_inline = CanComposeInline(); |
| 1295 WebRect new_caret_bounds; | 1295 WebRect new_caret_bounds = GetCaretBounds(); |
| 1296 | |
| 1297 if (webwidget_) | |
| 1298 new_caret_bounds = webwidget_->caretOrSelectionBounds(); | |
| 1299 | 1296 |
| 1300 // Only sends text input type and caret bounds to the browser process if they | 1297 // Only sends text input type and caret bounds to the browser process if they |
| 1301 // are changed. | 1298 // are changed. |
| 1302 if (text_input_type_ != new_type || caret_bounds_ != new_caret_bounds || | 1299 if (text_input_type_ != new_type || caret_bounds_ != new_caret_bounds || |
| 1303 can_compose_inline_ != new_can_compose_inline) { | 1300 can_compose_inline_ != new_can_compose_inline) { |
| 1304 text_input_type_ = new_type; | 1301 text_input_type_ = new_type; |
| 1305 can_compose_inline_ = new_can_compose_inline; | 1302 can_compose_inline_ = new_can_compose_inline; |
| 1306 caret_bounds_ = new_caret_bounds; | 1303 caret_bounds_ = new_caret_bounds; |
| 1307 Send(new ViewHostMsg_ImeUpdateTextInputState( | 1304 Send(new ViewHostMsg_ImeUpdateTextInputState( |
| 1308 routing_id(), new_type, new_can_compose_inline, new_caret_bounds)); | 1305 routing_id(), new_type, new_can_compose_inline, new_caret_bounds)); |
| 1309 } | 1306 } |
| 1310 } | 1307 } |
| 1311 | 1308 |
| 1309 gfx::Rect RenderWidget::GetCaretBounds() { |
| 1310 if (!webwidget_) |
| 1311 return gfx::Rect(); |
| 1312 return webwidget_->caretOrSelectionBounds(); |
| 1313 } |
| 1314 |
| 1315 // Check WebKit::WebTextInputType and ui::TextInputType is kept in sync. |
| 1312 COMPILE_ASSERT(int(WebKit::WebTextInputTypeNone) == \ | 1316 COMPILE_ASSERT(int(WebKit::WebTextInputTypeNone) == \ |
| 1313 int(ui::TEXT_INPUT_TYPE_NONE), mismatching_enums); | 1317 int(ui::TEXT_INPUT_TYPE_NONE), mismatching_enums); |
| 1314 COMPILE_ASSERT(int(WebKit::WebTextInputTypeText) == \ | 1318 COMPILE_ASSERT(int(WebKit::WebTextInputTypeText) == \ |
| 1315 int(ui::TEXT_INPUT_TYPE_TEXT), mismatching_enums); | 1319 int(ui::TEXT_INPUT_TYPE_TEXT), mismatching_enums); |
| 1316 COMPILE_ASSERT(int(WebKit::WebTextInputTypePassword) == \ | 1320 COMPILE_ASSERT(int(WebKit::WebTextInputTypePassword) == \ |
| 1317 int(ui::TEXT_INPUT_TYPE_PASSWORD), mismatching_enums); | 1321 int(ui::TEXT_INPUT_TYPE_PASSWORD), mismatching_enums); |
| 1318 COMPILE_ASSERT(int(WebKit::WebTextInputTypeSearch) == \ | 1322 COMPILE_ASSERT(int(WebKit::WebTextInputTypeSearch) == \ |
| 1319 int(ui::TEXT_INPUT_TYPE_SEARCH), mismatching_enums); | 1323 int(ui::TEXT_INPUT_TYPE_SEARCH), mismatching_enums); |
| 1320 COMPILE_ASSERT(int(WebKit::WebTextInputTypeEmail) == \ | 1324 COMPILE_ASSERT(int(WebKit::WebTextInputTypeEmail) == \ |
| 1321 int(ui::TEXT_INPUT_TYPE_EMAIL), mismatching_enums); | 1325 int(ui::TEXT_INPUT_TYPE_EMAIL), mismatching_enums); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1394 if (i->window == window) { | 1398 if (i->window == window) { |
| 1395 plugin_window_moves_.erase(i); | 1399 plugin_window_moves_.erase(i); |
| 1396 break; | 1400 break; |
| 1397 } | 1401 } |
| 1398 } | 1402 } |
| 1399 } | 1403 } |
| 1400 | 1404 |
| 1401 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1405 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
| 1402 return false; | 1406 return false; |
| 1403 } | 1407 } |
| OLD | NEW |