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

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: mac version Created 5 years, 3 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 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 uint32_t RenderWidgetHostViewMac::GetSurfaceIdNamespace() { 1635 uint32_t RenderWidgetHostViewMac::GetSurfaceIdNamespace() {
1636 if (delegated_frame_host_) 1636 if (delegated_frame_host_)
1637 return delegated_frame_host_->GetSurfaceIdNamespace(); 1637 return delegated_frame_host_->GetSurfaceIdNamespace();
1638 1638
1639 return 0; 1639 return 0;
1640 } 1640 }
1641 1641
1642 uint32_t RenderWidgetHostViewMac::SurfaceIdNamespaceAtPoint( 1642 uint32_t RenderWidgetHostViewMac::SurfaceIdNamespaceAtPoint(
1643 const gfx::Point& point, 1643 const gfx::Point& point,
1644 gfx::Point* transformed_point) { 1644 gfx::Point* transformed_point) {
1645 cc::SurfaceId id = 1645 float scale_factor = ViewScaleFactor();
1646 delegated_frame_host_->SurfaceIdAtPoint(point, transformed_point); 1646 gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point);
1647 cc::SurfaceId id = delegated_frame_host_->SurfaceIdAtPoint(point_in_pixels,
1648 transformed_point);
1649 *transformed_point = gfx::ConvertPointToDIP(scale_factor, *transformed_point);
1650
1647 // It is possible that the renderer has not yet produced a surface, in which 1651 // It is possible that the renderer has not yet produced a surface, in which
1648 // case we return our current namespace. 1652 // case we return our current namespace.
1649 if (id.is_null()) 1653 if (id.is_null())
1650 return GetSurfaceIdNamespace(); 1654 return GetSurfaceIdNamespace();
1651 return cc::SurfaceIdAllocator::NamespaceForId(id); 1655 return cc::SurfaceIdAllocator::NamespaceForId(id);
1652 } 1656 }
1653 1657
1654 void RenderWidgetHostViewMac::ProcessMouseEvent( 1658 void RenderWidgetHostViewMac::ProcessMouseEvent(
1655 const blink::WebMouseEvent& event) { 1659 const blink::WebMouseEvent& event) {
1656 render_widget_host_->ForwardMouseEvent(event); 1660 render_widget_host_->ForwardMouseEvent(event);
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after
3405 3409
3406 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3410 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3407 // regions that are not draggable. (See ControlRegionView in 3411 // regions that are not draggable. (See ControlRegionView in
3408 // native_app_window_cocoa.mm). This requires the render host view to be 3412 // native_app_window_cocoa.mm). This requires the render host view to be
3409 // draggable by default. 3413 // draggable by default.
3410 - (BOOL)mouseDownCanMoveWindow { 3414 - (BOOL)mouseDownCanMoveWindow {
3411 return YES; 3415 return YES;
3412 } 3416 }
3413 3417
3414 @end 3418 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698