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 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 return; | 1508 return; |
1509 } | 1509 } |
1510 composition_character_bounds_ = character_bounds; | 1510 composition_character_bounds_ = character_bounds; |
1511 composition_range_ = range; | 1511 composition_range_ = range; |
1512 Send(new InputHostMsg_ImeCompositionRangeChanged( | 1512 Send(new InputHostMsg_ImeCompositionRangeChanged( |
1513 routing_id(), composition_range_, composition_character_bounds_)); | 1513 routing_id(), composition_range_, composition_character_bounds_)); |
1514 } | 1514 } |
1515 | 1515 |
1516 void RenderWidget::convertViewportToWindow(blink::WebRect* rect) { | 1516 void RenderWidget::convertViewportToWindow(blink::WebRect* rect) { |
1517 if (IsUseZoomForDSFEnabled()) { | 1517 if (IsUseZoomForDSFEnabled()) { |
1518 float reverse = 1 / GetOriginalDeviceScaleFactor(); | |
1519 // TODO(oshima): We may need to allow pixel precision here as the the | 1518 // TODO(oshima): We may need to allow pixel precision here as the the |
1520 // anchor element can be placed at half pixel. | 1519 // anchor element can be placed at half pixel. |
1521 gfx::Rect window_rect = | 1520 *rect = |
1522 gfx::ScaleToEnclosedRect(gfx::Rect(*rect), reverse); | 1521 gfx::ScaleToEnclosingRect(*rect, 1.f / GetOriginalDeviceScaleFactor()); |
1523 rect->x = window_rect.x(); | |
1524 rect->y = window_rect.y(); | |
1525 rect->width = window_rect.width(); | |
1526 rect->height = window_rect.height(); | |
1527 } | 1522 } |
1528 } | 1523 } |
1529 | 1524 |
1530 void RenderWidget::convertWindowToViewport(blink::WebFloatRect* rect) { | 1525 void RenderWidget::convertWindowToViewport(blink::WebFloatRect* rect) { |
1531 if (IsUseZoomForDSFEnabled()) { | 1526 if (IsUseZoomForDSFEnabled()) { |
1532 rect->x *= GetOriginalDeviceScaleFactor(); | 1527 rect->x *= GetOriginalDeviceScaleFactor(); |
1533 rect->y *= GetOriginalDeviceScaleFactor(); | 1528 rect->y *= GetOriginalDeviceScaleFactor(); |
1534 rect->width *= GetOriginalDeviceScaleFactor(); | 1529 rect->width *= GetOriginalDeviceScaleFactor(); |
1535 rect->height *= GetOriginalDeviceScaleFactor(); | 1530 rect->height *= GetOriginalDeviceScaleFactor(); |
1536 } | 1531 } |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 void RenderWidget::requestPointerUnlock() { | 2060 void RenderWidget::requestPointerUnlock() { |
2066 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); | 2061 mouse_lock_dispatcher_->UnlockMouse(webwidget_mouse_lock_target_.get()); |
2067 } | 2062 } |
2068 | 2063 |
2069 bool RenderWidget::isPointerLocked() { | 2064 bool RenderWidget::isPointerLocked() { |
2070 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2065 return mouse_lock_dispatcher_->IsMouseLockedTo( |
2071 webwidget_mouse_lock_target_.get()); | 2066 webwidget_mouse_lock_target_.get()); |
2072 } | 2067 } |
2073 | 2068 |
2074 } // namespace content | 2069 } // namespace content |
OLD | NEW |