Commit 2154953d authored by chaopeng's avatar chaopeng Committed by Commit Bot

Use GetDeviceScaleFactor to get scale factor for coord space transform

The device scale factor is not properly applied in
CrossProcessFrameConnector::TransformPointToLocalCoordSpaceLegacy
We're using current_surface_scale_factor() which does not seem to
provide the correct value. We want GetDeviceScaleFactor().

Test: SitePerProcessInternalsHitTestBrowserTest.ScrollNestedLocalNonFastScrollableDiv
after crrev.com/c/1427607 landed

Bug: 923069
Change-Id: Iae748780d0657d7674cf4ba76a276ad03cc28a74
Reviewed-on: https://chromium-review.googlesource.com/c/1435834Reviewed-by: default avatarKevin McNee <mcnee@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Jianpeng Chao <chaopeng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626115}
parent 397009ea
......@@ -225,15 +225,15 @@ bool CrossProcessFrameConnector::TransformPointToLocalCoordSpaceLegacy(
// Transformations use physical pixels rather than DIP, so conversion
// is necessary.
*transformed_point =
gfx::ConvertPointToPixel(view_->current_surface_scale_factor(), point);
gfx::ConvertPointToPixel(view_->GetDeviceScaleFactor(), point);
viz::SurfaceHittest hittest(nullptr,
GetFrameSinkManager()->surface_manager());
if (!hittest.TransformPointToTargetSurface(original_surface, local_surface_id,
transformed_point))
return false;
*transformed_point = gfx::ConvertPointToDIP(
view_->current_surface_scale_factor(), *transformed_point);
*transformed_point =
gfx::ConvertPointToDIP(view_->GetDeviceScaleFactor(), *transformed_point);
return true;
}
......
......@@ -272,8 +272,7 @@ bool RenderWidgetHostViewGuest::TransformPointToLocalCoordSpaceLegacy(
if (original_surface == surface_id)
return true;
*transformed_point =
gfx::ConvertPointToPixel(current_surface_scale_factor(), point);
*transformed_point = gfx::ConvertPointToPixel(GetDeviceScaleFactor(), point);
viz::SurfaceHittest hittest(nullptr,
GetFrameSinkManager()->surface_manager());
if (!hittest.TransformPointToTargetSurface(original_surface, surface_id,
......@@ -281,8 +280,8 @@ bool RenderWidgetHostViewGuest::TransformPointToLocalCoordSpaceLegacy(
return false;
}
*transformed_point = gfx::ConvertPointToDIP(current_surface_scale_factor(),
*transformed_point);
*transformed_point =
gfx::ConvertPointToDIP(GetDeviceScaleFactor(), *transformed_point);
return true;
}
......
......@@ -212,11 +212,6 @@ class CONTENT_EXPORT RenderWidgetHostViewChildFrame
return frame_connector_;
}
// Returns the current surface scale factor.
float current_surface_scale_factor() {
return last_activated_surface_info_.device_scale_factor();
}
// Returns the view into which this view is directly embedded. This can
// return nullptr when this view's associated child frame is not connected
// to the frame tree.
......
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