Commit d3fa3357 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

MacViews: Fix GetOffsetFromRootSurface

This should be based off of the ui::Layer heirarchy, not the NSView
heirarchy.

Bug: 860344
Change-Id: I307a1d681a21846886bb6118a3e3acf97c2b268e
Reviewed-on: https://chromium-review.googlesource.com/1144215
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: default avatarFady Samuel <fsamuel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577073}
parent 41d33fc1
......@@ -121,6 +121,7 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient,
const viz::LocalSurfaceId& AllocateNewRendererLocalSurfaceId();
bool UpdateRendererLocalSurfaceIdFromChild(
const viz::LocalSurfaceId& child_allocated_local_surface_id);
void TransformPointToRootSurface(gfx::PointF* point);
// Indicate that the recyclable compositor should be destroyed, and no future
// compositors should be recycled.
......
......@@ -472,6 +472,14 @@ bool BrowserCompositorMac::UpdateRendererLocalSurfaceIdFromChild(
child_allocated_local_surface_id);
}
void BrowserCompositorMac::TransformPointToRootSurface(gfx::PointF* point) {
gfx::Transform transform_to_root;
if (parent_ui_layer_)
parent_ui_layer_->GetTargetTransformRelativeTo(nullptr, &transform_to_root);
gfx::Point origin_in_root;
transform_to_root.TransformPoint(&origin_in_root);
}
void BrowserCompositorMac::LayerDestroyed(ui::Layer* layer) {
DCHECK_EQ(layer, parent_ui_layer_);
SetParentUiLayer(nullptr);
......
......@@ -1043,8 +1043,7 @@ bool RenderWidgetHostViewMac::RequestRepaintForTesting() {
}
void RenderWidgetHostViewMac::TransformPointToRootSurface(gfx::PointF* point) {
if (display_only_using_parent_ui_layer_)
*point += view_bounds_in_window_dip_.OffsetFromOrigin();
browser_compositor_->TransformPointToRootSurface(point);
}
gfx::Rect RenderWidgetHostViewMac::GetBoundsInRootWindow() {
......
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