| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1372 // If we failed to set the composition text, then we need to let the browser | 1372 // If we failed to set the composition text, then we need to let the browser |
| 1373 // process to cancel the input method's ongoing composition session, to make | 1373 // process to cancel the input method's ongoing composition session, to make |
| 1374 // sure we are in a consistent state. | 1374 // sure we are in a consistent state. |
| 1375 Send(new InputHostMsg_ImeCancelComposition(routing_id())); | 1375 Send(new InputHostMsg_ImeCancelComposition(routing_id())); |
| 1376 } | 1376 } |
| 1377 UpdateCompositionInfo(false /* not an immediate request */); | 1377 UpdateCompositionInfo(false /* not an immediate request */); |
| 1378 } | 1378 } |
| 1379 | 1379 |
| 1380 void RenderWidget::OnImeConfirmComposition(const base::string16& text, | 1380 void RenderWidget::OnImeConfirmComposition(const base::string16& text, |
| 1381 const gfx::Range& replacement_range, | 1381 const gfx::Range& replacement_range, |
| 1382 bool keep_selection) { | 1382 bool keep_selection, |
| 1383 int relative_cursor_pos) { |
| 1383 #if defined(ENABLE_PLUGINS) | 1384 #if defined(ENABLE_PLUGINS) |
| 1384 if (focused_pepper_plugin_) { | 1385 if (focused_pepper_plugin_) { |
| 1385 focused_pepper_plugin_->render_frame()->OnImeConfirmComposition( | 1386 focused_pepper_plugin_->render_frame()->OnImeConfirmComposition( |
| 1386 text, replacement_range, keep_selection); | 1387 text, replacement_range, keep_selection, relative_cursor_pos); |
| 1387 return; | 1388 return; |
| 1388 } | 1389 } |
| 1389 #endif | 1390 #endif |
| 1390 if (replacement_range.IsValid()) { | 1391 if (replacement_range.IsValid()) { |
| 1391 webwidget_->applyReplacementRange(replacement_range.start(), | 1392 webwidget_->applyReplacementRange(replacement_range.start(), |
| 1392 replacement_range.length()); | 1393 replacement_range.length()); |
| 1393 } | 1394 } |
| 1394 | 1395 |
| 1395 if (!ShouldHandleImeEvent()) | 1396 if (!ShouldHandleImeEvent()) |
| 1396 return; | 1397 return; |
| 1397 ImeEventGuard guard(this); | 1398 ImeEventGuard guard(this); |
| 1398 input_handler_->set_handling_input_event(true); | 1399 input_handler_->set_handling_input_event(true); |
| 1399 if (text.length()) | 1400 if (text.length()) |
| 1400 webwidget_->confirmComposition(text); | 1401 webwidget_->confirmComposition(text, relative_cursor_pos); |
| 1401 else if (keep_selection) | 1402 else if (keep_selection) |
| 1402 webwidget_->confirmComposition(WebWidget::KeepSelection); | 1403 webwidget_->confirmComposition(WebWidget::KeepSelection); |
| 1403 else | 1404 else |
| 1404 webwidget_->confirmComposition(WebWidget::DoNotKeepSelection); | 1405 webwidget_->confirmComposition(WebWidget::DoNotKeepSelection); |
| 1405 input_handler_->set_handling_input_event(false); | 1406 input_handler_->set_handling_input_event(false); |
| 1406 UpdateCompositionInfo(false /* not an immediate request */); | 1407 UpdateCompositionInfo(false /* not an immediate request */); |
| 1407 } | 1408 } |
| 1408 | 1409 |
| 1409 void RenderWidget::OnDeviceScaleFactorChanged() { | 1410 void RenderWidget::OnDeviceScaleFactorChanged() { |
| 1410 if (!compositor_) | 1411 if (!compositor_) |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2066 void RenderWidget::requestPointerUnlock() { | 2067 void RenderWidget::requestPointerUnlock() { |
| 2067 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); | 2068 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); |
| 2068 } | 2069 } |
| 2069 | 2070 |
| 2070 bool RenderWidget::isPointerLocked() { | 2071 bool RenderWidget::isPointerLocked() { |
| 2071 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2072 return mouse_lock_dispatcher_->IsMouseLockedTo( |
| 2072 webwidget_mouse_lock_target_.get()); | 2073 webwidget_mouse_lock_target_.get()); |
| 2073 } | 2074 } |
| 2074 | 2075 |
| 2075 } // namespace content | 2076 } // namespace content |
| OLD | NEW |