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 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 // If we failed to set the composition text, then we need to let the browser | 1495 // If we failed to set the composition text, then we need to let the browser |
1496 // process to cancel the input method's ongoing composition session, to make | 1496 // process to cancel the input method's ongoing composition session, to make |
1497 // sure we are in a consistent state. | 1497 // sure we are in a consistent state. |
1498 Send(new InputHostMsg_ImeCancelComposition(routing_id())); | 1498 Send(new InputHostMsg_ImeCancelComposition(routing_id())); |
1499 } | 1499 } |
1500 UpdateCompositionInfo(true); | 1500 UpdateCompositionInfo(true); |
1501 } | 1501 } |
1502 | 1502 |
1503 void RenderWidget::OnImeConfirmComposition(const base::string16& text, | 1503 void RenderWidget::OnImeConfirmComposition(const base::string16& text, |
1504 const gfx::Range& replacement_range, | 1504 const gfx::Range& replacement_range, |
1505 bool keep_selection) { | 1505 bool keep_selection, |
| 1506 int new_cursor_pos) { |
1506 if (!ShouldHandleImeEvent()) | 1507 if (!ShouldHandleImeEvent()) |
1507 return; | 1508 return; |
1508 ImeEventGuard guard(this); | 1509 ImeEventGuard guard(this); |
1509 input_handler_->set_handling_input_event(true); | 1510 input_handler_->set_handling_input_event(true); |
1510 if (text.length()) | 1511 if (text.length()) |
1511 webwidget_->confirmComposition(text); | 1512 webwidget_->confirmComposition(text, new_cursor_pos); |
1512 else if (keep_selection) | 1513 else if (keep_selection) |
1513 webwidget_->confirmComposition(WebWidget::KeepSelection); | 1514 webwidget_->confirmComposition(WebWidget::KeepSelection, new_cursor_pos); |
1514 else | 1515 else |
1515 webwidget_->confirmComposition(WebWidget::DoNotKeepSelection); | 1516 webwidget_->confirmComposition(WebWidget::DoNotKeepSelection, |
| 1517 new_cursor_pos); |
1516 input_handler_->set_handling_input_event(false); | 1518 input_handler_->set_handling_input_event(false); |
1517 UpdateCompositionInfo(true); | 1519 UpdateCompositionInfo(true); |
1518 } | 1520 } |
1519 | 1521 |
1520 void RenderWidget::OnDeviceScaleFactorChanged() { | 1522 void RenderWidget::OnDeviceScaleFactorChanged() { |
1521 if (!compositor_) | 1523 if (!compositor_) |
1522 return; | 1524 return; |
1523 if (IsUseZoomForDSFEnabled()) | 1525 if (IsUseZoomForDSFEnabled()) |
1524 compositor_->SetPaintedDeviceScaleFactor(GetOriginalDeviceScaleFactor()); | 1526 compositor_->SetPaintedDeviceScaleFactor(GetOriginalDeviceScaleFactor()); |
1525 else | 1527 else |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2092 } | 2094 } |
2093 | 2095 |
2094 float RenderWidget::GetOriginalDeviceScaleFactor() const { | 2096 float RenderWidget::GetOriginalDeviceScaleFactor() const { |
2095 return | 2097 return |
2096 screen_metrics_emulator_ ? | 2098 screen_metrics_emulator_ ? |
2097 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : | 2099 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : |
2098 device_scale_factor_; | 2100 device_scale_factor_; |
2099 } | 2101 } |
2100 | 2102 |
2101 } // namespace content | 2103 } // namespace content |
OLD | NEW |