| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1571 OnShowImeIfNeeded(); | 1571 OnShowImeIfNeeded(); |
| 1572 } | 1572 } |
| 1573 | 1573 |
| 1574 ui::TextInputType RenderWidget::GetTextInputType() { | 1574 ui::TextInputType RenderWidget::GetTextInputType() { |
| 1575 if (webwidget_) | 1575 if (webwidget_) |
| 1576 return WebKitToUiTextInputType(webwidget_->textInputType()); | 1576 return WebKitToUiTextInputType(webwidget_->textInputType()); |
| 1577 return ui::TEXT_INPUT_TYPE_NONE; | 1577 return ui::TEXT_INPUT_TYPE_NONE; |
| 1578 } | 1578 } |
| 1579 | 1579 |
| 1580 void RenderWidget::UpdateCompositionInfo(bool should_update_range) { | 1580 void RenderWidget::UpdateCompositionInfo(bool should_update_range) { |
| 1581 #if defined(OS_ANDROID) | |
| 1582 // TODO(yukawa): Start sending character bounds when the browser side | |
| 1583 // implementation becomes ready (crbug.com/424866). | |
| 1584 #else | |
| 1585 TRACE_EVENT0("renderer", "RenderWidget::UpdateCompositionInfo"); | 1581 TRACE_EVENT0("renderer", "RenderWidget::UpdateCompositionInfo"); |
| 1586 gfx::Range range = gfx::Range(); | 1582 gfx::Range range = gfx::Range(); |
| 1587 if (should_update_range) { | 1583 if (should_update_range) { |
| 1588 GetCompositionRange(&range); | 1584 GetCompositionRange(&range); |
| 1589 } else { | 1585 } else { |
| 1590 range = composition_range_; | 1586 range = composition_range_; |
| 1591 } | 1587 } |
| 1592 std::vector<gfx::Rect> character_bounds; | 1588 std::vector<gfx::Rect> character_bounds; |
| 1593 GetCompositionCharacterBounds(&character_bounds); | 1589 GetCompositionCharacterBounds(&character_bounds); |
| 1594 | 1590 |
| 1595 if (!ShouldUpdateCompositionInfo(range, character_bounds)) | 1591 if (!ShouldUpdateCompositionInfo(range, character_bounds)) |
| 1596 return; | 1592 return; |
| 1597 composition_character_bounds_ = character_bounds; | 1593 composition_character_bounds_ = character_bounds; |
| 1598 composition_range_ = range; | 1594 composition_range_ = range; |
| 1599 Send(new InputHostMsg_ImeCompositionRangeChanged( | 1595 Send(new InputHostMsg_ImeCompositionRangeChanged( |
| 1600 routing_id(), composition_range_, composition_character_bounds_)); | 1596 routing_id(), composition_range_, composition_character_bounds_)); |
| 1601 #endif | |
| 1602 } | 1597 } |
| 1603 | 1598 |
| 1604 void RenderWidget::convertViewportToWindow(blink::WebRect* rect) { | 1599 void RenderWidget::convertViewportToWindow(blink::WebRect* rect) { |
| 1605 if (IsUseZoomForDSFEnabled()) { | 1600 if (IsUseZoomForDSFEnabled()) { |
| 1606 float reverse = 1 / GetOriginalDeviceScaleFactor(); | 1601 float reverse = 1 / GetOriginalDeviceScaleFactor(); |
| 1607 // TODO(oshima): We may need to allow pixel precision here as the the | 1602 // TODO(oshima): We may need to allow pixel precision here as the the |
| 1608 // anchor element can be placed at half pixel. | 1603 // anchor element can be placed at half pixel. |
| 1609 gfx::Rect window_rect = | 1604 gfx::Rect window_rect = |
| 1610 gfx::ScaleToEnclosedRect(gfx::Rect(*rect), reverse); | 1605 gfx::ScaleToEnclosedRect(gfx::Rect(*rect), reverse); |
| 1611 rect->x = window_rect.x(); | 1606 rect->x = window_rect.x(); |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2168 } | 2163 } |
| 2169 | 2164 |
| 2170 float RenderWidget::GetOriginalDeviceScaleFactor() const { | 2165 float RenderWidget::GetOriginalDeviceScaleFactor() const { |
| 2171 return | 2166 return |
| 2172 screen_metrics_emulator_ ? | 2167 screen_metrics_emulator_ ? |
| 2173 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : | 2168 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : |
| 2174 device_scale_factor_; | 2169 device_scale_factor_; |
| 2175 } | 2170 } |
| 2176 | 2171 |
| 2177 } // namespace content | 2172 } // namespace content |
| OLD | NEW |