Commit 88fd07f9 authored by lfg's avatar lfg Committed by Commit bot

Use ScaleToEnclosingRect when converting the viewport to window.

This guarantees that the viewport is always contained in the window.

BUG=none

Review-Url: https://codereview.chromium.org/2258493002
Cr-Commit-Position: refs/heads/master@{#414452}
parent e3141176
...@@ -1516,15 +1516,10 @@ void RenderWidget::UpdateCompositionInfo(bool immediate_request) { ...@@ -1516,15 +1516,10 @@ void RenderWidget::UpdateCompositionInfo(bool immediate_request) {
void RenderWidget::convertViewportToWindow(blink::WebRect* rect) { void RenderWidget::convertViewportToWindow(blink::WebRect* rect) {
if (IsUseZoomForDSFEnabled()) { if (IsUseZoomForDSFEnabled()) {
float reverse = 1 / GetOriginalDeviceScaleFactor();
// TODO(oshima): We may need to allow pixel precision here as the the // TODO(oshima): We may need to allow pixel precision here as the the
// anchor element can be placed at half pixel. // anchor element can be placed at half pixel.
gfx::Rect window_rect = *rect =
gfx::ScaleToEnclosedRect(gfx::Rect(*rect), reverse); gfx::ScaleToEnclosingRect(*rect, 1.f / GetOriginalDeviceScaleFactor());
rect->x = window_rect.x();
rect->y = window_rect.y();
rect->width = window_rect.width();
rect->height = window_rect.height();
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment