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