Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(726)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 1308553007: Convert MouseEvents from DIPS to Pixels before passing it to surfaces for hittesting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleaning up Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <OpenGL/gl.h> 8 #include <OpenGL/gl.h>
9 #include <QuartzCore/QuartzCore.h> 9 #include <QuartzCore/QuartzCore.h>
10 10
(...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 } 1643 }
1644 1644
1645 uint32_t RenderWidgetHostViewMac::GetSurfaceIdNamespace() { 1645 uint32_t RenderWidgetHostViewMac::GetSurfaceIdNamespace() {
1646 DCHECK(delegated_frame_host_); 1646 DCHECK(delegated_frame_host_);
1647 return delegated_frame_host_->GetSurfaceIdNamespace(); 1647 return delegated_frame_host_->GetSurfaceIdNamespace();
1648 } 1648 }
1649 1649
1650 uint32_t RenderWidgetHostViewMac::SurfaceIdNamespaceAtPoint( 1650 uint32_t RenderWidgetHostViewMac::SurfaceIdNamespaceAtPoint(
1651 const gfx::Point& point, 1651 const gfx::Point& point,
1652 gfx::Point* transformed_point) { 1652 gfx::Point* transformed_point) {
1653 cc::SurfaceId id = 1653 float scale_factor = ViewScaleFactor();
1654 delegated_frame_host_->SurfaceIdAtPoint(point, transformed_point); 1654 gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point);
1655 cc::SurfaceId id = delegated_frame_host_->SurfaceIdAtPoint(point_in_pixels,
1656 transformed_point);
1657 *transformed_point = gfx::ConvertPointToDIP(scale_factor, *transformed_point);
1658
1655 // It is possible that the renderer has not yet produced a surface, in which 1659 // It is possible that the renderer has not yet produced a surface, in which
1656 // case we return our current namespace. 1660 // case we return our current namespace.
1657 if (id.is_null()) 1661 if (id.is_null())
1658 return GetSurfaceIdNamespace(); 1662 return GetSurfaceIdNamespace();
1659 return cc::SurfaceIdAllocator::NamespaceForId(id); 1663 return cc::SurfaceIdAllocator::NamespaceForId(id);
1660 } 1664 }
1661 1665
1662 void RenderWidgetHostViewMac::ProcessMouseEvent( 1666 void RenderWidgetHostViewMac::ProcessMouseEvent(
1663 const blink::WebMouseEvent& event) { 1667 const blink::WebMouseEvent& event) {
1664 render_widget_host_->ForwardMouseEvent(event); 1668 render_widget_host_->ForwardMouseEvent(event);
(...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after
3485 3489
3486 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3490 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3487 // regions that are not draggable. (See ControlRegionView in 3491 // regions that are not draggable. (See ControlRegionView in
3488 // native_app_window_cocoa.mm). This requires the render host view to be 3492 // native_app_window_cocoa.mm). This requires the render host view to be
3489 // draggable by default. 3493 // draggable by default.
3490 - (BOOL)mouseDownCanMoveWindow { 3494 - (BOOL)mouseDownCanMoveWindow {
3491 return YES; 3495 return YES;
3492 } 3496 }
3493 3497
3494 @end 3498 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698