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