| 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 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1277 } | 1277 } |
| 1278 | 1278 |
| 1279 void RenderWidget::set_next_paint_is_repaint_ack() { | 1279 void RenderWidget::set_next_paint_is_repaint_ack() { |
| 1280 next_paint_flags_ |= ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK; | 1280 next_paint_flags_ |= ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK; |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 void RenderWidget::UpdateInputMethod() { | 1283 void RenderWidget::UpdateInputMethod() { |
| 1284 if (!input_method_is_active_) | 1284 if (!input_method_is_active_) |
| 1285 return; | 1285 return; |
| 1286 | 1286 |
| 1287 ui::TextInputType new_type = GetTextInputType(); | 1287 int type = GetTextInputType(); |
| 1288 // Check the type is in the range representable by ui::TextInputType. |
| 1289 DCHECK(type <= ui::TEXT_INPUT_TYPE_URL) << |
| 1290 "WebKit::WebTextInputType and ui::TextInputType not synchronized"; |
| 1291 ui::TextInputType new_type = static_cast<ui::TextInputType>(type); |
| 1288 bool new_can_compose_inline = CanComposeInline(); | 1292 bool new_can_compose_inline = CanComposeInline(); |
| 1289 WebRect new_caret_bounds; | 1293 WebRect new_caret_bounds = GetCaretBounds(); |
| 1290 | |
| 1291 if (webwidget_) | |
| 1292 new_caret_bounds = webwidget_->caretOrSelectionBounds(); | |
| 1293 | 1294 |
| 1294 // Only sends text input type and caret bounds to the browser process if they | 1295 // Only sends text input type and caret bounds to the browser process if they |
| 1295 // are changed. | 1296 // are changed. |
| 1296 if (text_input_type_ != new_type || caret_bounds_ != new_caret_bounds || | 1297 if (text_input_type_ != new_type || caret_bounds_ != new_caret_bounds || |
| 1297 can_compose_inline_ != new_can_compose_inline) { | 1298 can_compose_inline_ != new_can_compose_inline) { |
| 1298 text_input_type_ = new_type; | 1299 text_input_type_ = new_type; |
| 1299 can_compose_inline_ = new_can_compose_inline; | 1300 can_compose_inline_ = new_can_compose_inline; |
| 1300 caret_bounds_ = new_caret_bounds; | 1301 caret_bounds_ = new_caret_bounds; |
| 1301 Send(new ViewHostMsg_ImeUpdateTextInputState( | 1302 Send(new ViewHostMsg_ImeUpdateTextInputState( |
| 1302 routing_id(), new_type, new_can_compose_inline, new_caret_bounds)); | 1303 routing_id(), new_type, new_can_compose_inline, new_caret_bounds)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1313 int(ui::TEXT_INPUT_TYPE_SEARCH), mismatching_enums); | 1314 int(ui::TEXT_INPUT_TYPE_SEARCH), mismatching_enums); |
| 1314 COMPILE_ASSERT(int(WebKit::WebTextInputTypeEmail) == \ | 1315 COMPILE_ASSERT(int(WebKit::WebTextInputTypeEmail) == \ |
| 1315 int(ui::TEXT_INPUT_TYPE_EMAIL), mismatching_enums); | 1316 int(ui::TEXT_INPUT_TYPE_EMAIL), mismatching_enums); |
| 1316 COMPILE_ASSERT(int(WebKit::WebTextInputTypeNumber) == \ | 1317 COMPILE_ASSERT(int(WebKit::WebTextInputTypeNumber) == \ |
| 1317 int(ui::TEXT_INPUT_TYPE_NUMBER), mismatching_enums); | 1318 int(ui::TEXT_INPUT_TYPE_NUMBER), mismatching_enums); |
| 1318 COMPILE_ASSERT(int(WebKit::WebTextInputTypeTelephone) == \ | 1319 COMPILE_ASSERT(int(WebKit::WebTextInputTypeTelephone) == \ |
| 1319 int(ui::TEXT_INPUT_TYPE_TELEPHONE), mismatching_enums); | 1320 int(ui::TEXT_INPUT_TYPE_TELEPHONE), mismatching_enums); |
| 1320 COMPILE_ASSERT(int(WebKit::WebTextInputTypeURL) == \ | 1321 COMPILE_ASSERT(int(WebKit::WebTextInputTypeURL) == \ |
| 1321 int(ui::TEXT_INPUT_TYPE_URL), mismatching_enums); | 1322 int(ui::TEXT_INPUT_TYPE_URL), mismatching_enums); |
| 1322 | 1323 |
| 1323 ui::TextInputType RenderWidget::GetTextInputType() { | 1324 WebRect RenderWidget::GetCaretBounds() { |
| 1324 if (webwidget_) { | 1325 if (!webwidget_) |
| 1325 int type = webwidget_->textInputType(); | 1326 return WebRect(); |
| 1326 // Check the type is in the range representable by ui::TextInputType. | 1327 return webwidget_->caretOrSelectionBounds(); |
| 1327 DCHECK(type <= ui::TEXT_INPUT_TYPE_URL) << | 1328 } |
| 1328 "WebKit::WebTextInputType and ui::TextInputType not synchronized"; | 1329 |
| 1329 return static_cast<ui::TextInputType>(type); | 1330 WebKit::WebTextInputType RenderWidget::GetTextInputType() { |
| 1330 } | 1331 if (!webwidget_) |
| 1331 return ui::TEXT_INPUT_TYPE_NONE; | 1332 return WebKit::WebTextInputTypeNone; |
| 1333 return webwidget_->textInputType(); |
| 1332 } | 1334 } |
| 1333 | 1335 |
| 1334 bool RenderWidget::CanComposeInline() { | 1336 bool RenderWidget::CanComposeInline() { |
| 1335 return true; | 1337 return true; |
| 1336 } | 1338 } |
| 1337 | 1339 |
| 1338 WebScreenInfo RenderWidget::screenInfo() { | 1340 WebScreenInfo RenderWidget::screenInfo() { |
| 1339 WebScreenInfo results; | 1341 WebScreenInfo results; |
| 1340 Send(new ViewHostMsg_GetScreenInfo(routing_id_, host_window_, &results)); | 1342 Send(new ViewHostMsg_GetScreenInfo(routing_id_, host_window_, &results)); |
| 1341 return results; | 1343 return results; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 | 1386 |
| 1385 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { | 1387 void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) { |
| 1386 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); | 1388 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); |
| 1387 i != plugin_window_moves_.end(); ++i) { | 1389 i != plugin_window_moves_.end(); ++i) { |
| 1388 if (i->window == window) { | 1390 if (i->window == window) { |
| 1389 plugin_window_moves_.erase(i); | 1391 plugin_window_moves_.erase(i); |
| 1390 break; | 1392 break; |
| 1391 } | 1393 } |
| 1392 } | 1394 } |
| 1393 } | 1395 } |
| OLD | NEW |