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

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: fixing InitAsChild Created 5 years, 1 month 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 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 } 1586 }
1587 1587
1588 uint32_t RenderWidgetHostViewMac::GetSurfaceIdNamespace() { 1588 uint32_t RenderWidgetHostViewMac::GetSurfaceIdNamespace() {
1589 DCHECK(delegated_frame_host_); 1589 DCHECK(delegated_frame_host_);
1590 return delegated_frame_host_->GetSurfaceIdNamespace(); 1590 return delegated_frame_host_->GetSurfaceIdNamespace();
1591 } 1591 }
1592 1592
1593 uint32_t RenderWidgetHostViewMac::SurfaceIdNamespaceAtPoint( 1593 uint32_t RenderWidgetHostViewMac::SurfaceIdNamespaceAtPoint(
1594 const gfx::Point& point, 1594 const gfx::Point& point,
1595 gfx::Point* transformed_point) { 1595 gfx::Point* transformed_point) {
1596 cc::SurfaceId id = 1596 // The surface hittest happens in device pixels, so we need to convert the
1597 delegated_frame_host_->SurfaceIdAtPoint(point, transformed_point); 1597 // |point| from DIPs to pixels before hittesting.
1598 float scale_factor = gfx::Screen::GetScreenFor(cocoa_view_)
1599 ->GetDisplayNearestWindow(cocoa_view_)
1600 .device_scale_factor();
Avi (use Gerrit) 2015/11/04 20:16:47 I'm thinking in Cocoa, and would instinctively do
1601 gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point);
1602 cc::SurfaceId id = delegated_frame_host_->SurfaceIdAtPoint(point_in_pixels,
1603 transformed_point);
1604 *transformed_point = gfx::ConvertPointToDIP(scale_factor, *transformed_point);
1605
1598 // It is possible that the renderer has not yet produced a surface, in which 1606 // It is possible that the renderer has not yet produced a surface, in which
1599 // case we return our current namespace. 1607 // case we return our current namespace.
1600 if (id.is_null()) 1608 if (id.is_null())
1601 return GetSurfaceIdNamespace(); 1609 return GetSurfaceIdNamespace();
1602 return cc::SurfaceIdAllocator::NamespaceForId(id); 1610 return cc::SurfaceIdAllocator::NamespaceForId(id);
1603 } 1611 }
1604 1612
1605 void RenderWidgetHostViewMac::ProcessMouseEvent( 1613 void RenderWidgetHostViewMac::ProcessMouseEvent(
1606 const blink::WebMouseEvent& event) { 1614 const blink::WebMouseEvent& event) {
1607 render_widget_host_->ForwardMouseEvent(event); 1615 render_widget_host_->ForwardMouseEvent(event);
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after
3424 3432
3425 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3433 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3426 // regions that are not draggable. (See ControlRegionView in 3434 // regions that are not draggable. (See ControlRegionView in
3427 // native_app_window_cocoa.mm). This requires the render host view to be 3435 // native_app_window_cocoa.mm). This requires the render host view to be
3428 // draggable by default. 3436 // draggable by default.
3429 - (BOOL)mouseDownCanMoveWindow { 3437 - (BOOL)mouseDownCanMoveWindow {
3430 return YES; 3438 return YES;
3431 } 3439 }
3432 3440
3433 @end 3441 @end
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | content/browser/site_per_process_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698