OLD | NEW |
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 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 return scoped_ptr<SyntheticGestureTarget>( | 1565 return scoped_ptr<SyntheticGestureTarget>( |
1566 new SyntheticGestureTargetMac(host, cocoa_view_)); | 1566 new SyntheticGestureTargetMac(host, cocoa_view_)); |
1567 } | 1567 } |
1568 | 1568 |
1569 uint32_t RenderWidgetHostViewMac::GetSurfaceIdNamespace() { | 1569 uint32_t RenderWidgetHostViewMac::GetSurfaceIdNamespace() { |
1570 DCHECK(delegated_frame_host_); | 1570 DCHECK(delegated_frame_host_); |
1571 return delegated_frame_host_->GetSurfaceIdNamespace(); | 1571 return delegated_frame_host_->GetSurfaceIdNamespace(); |
1572 } | 1572 } |
1573 | 1573 |
1574 uint32_t RenderWidgetHostViewMac::SurfaceIdNamespaceAtPoint( | 1574 uint32_t RenderWidgetHostViewMac::SurfaceIdNamespaceAtPoint( |
| 1575 cc::SurfaceHittestDelegate* delegate, |
1575 const gfx::Point& point, | 1576 const gfx::Point& point, |
1576 gfx::Point* transformed_point) { | 1577 gfx::Point* transformed_point) { |
1577 // The surface hittest happens in device pixels, so we need to convert the | 1578 // The surface hittest happens in device pixels, so we need to convert the |
1578 // |point| from DIPs to pixels before hittesting. | 1579 // |point| from DIPs to pixels before hittesting. |
1579 float scale_factor = gfx::Screen::GetScreenFor(cocoa_view_) | 1580 float scale_factor = gfx::Screen::GetScreenFor(cocoa_view_) |
1580 ->GetDisplayNearestWindow(cocoa_view_) | 1581 ->GetDisplayNearestWindow(cocoa_view_) |
1581 .device_scale_factor(); | 1582 .device_scale_factor(); |
1582 gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point); | 1583 gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point); |
1583 cc::SurfaceId id = delegated_frame_host_->SurfaceIdAtPoint(point_in_pixels, | 1584 cc::SurfaceId id = delegated_frame_host_->SurfaceIdAtPoint( |
1584 transformed_point); | 1585 delegate, point_in_pixels, transformed_point); |
1585 *transformed_point = gfx::ConvertPointToDIP(scale_factor, *transformed_point); | 1586 *transformed_point = gfx::ConvertPointToDIP(scale_factor, *transformed_point); |
1586 | 1587 |
1587 // It is possible that the renderer has not yet produced a surface, in which | 1588 // It is possible that the renderer has not yet produced a surface, in which |
1588 // case we return our current namespace. | 1589 // case we return our current namespace. |
1589 if (id.is_null()) | 1590 if (id.is_null()) |
1590 return GetSurfaceIdNamespace(); | 1591 return GetSurfaceIdNamespace(); |
1591 return cc::SurfaceIdAllocator::NamespaceForId(id); | 1592 return cc::SurfaceIdAllocator::NamespaceForId(id); |
1592 } | 1593 } |
1593 | 1594 |
1594 bool RenderWidgetHostViewMac::ShouldRouteEvent( | 1595 bool RenderWidgetHostViewMac::ShouldRouteEvent( |
(...skipping 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3438 | 3439 |
3439 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3440 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3440 // regions that are not draggable. (See ControlRegionView in | 3441 // regions that are not draggable. (See ControlRegionView in |
3441 // native_app_window_cocoa.mm). This requires the render host view to be | 3442 // native_app_window_cocoa.mm). This requires the render host view to be |
3442 // draggable by default. | 3443 // draggable by default. |
3443 - (BOOL)mouseDownCanMoveWindow { | 3444 - (BOOL)mouseDownCanMoveWindow { |
3444 return YES; | 3445 return YES; |
3445 } | 3446 } |
3446 | 3447 |
3447 @end | 3448 @end |
OLD | NEW |