| 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 <Carbon/Carbon.h> | 7 #import <Carbon/Carbon.h> |
| 8 #import <objc/runtime.h> | 8 #import <objc/runtime.h> |
| 9 #include <OpenGL/gl.h> | 9 #include <OpenGL/gl.h> |
| 10 #include <QuartzCore/QuartzCore.h> | 10 #include <QuartzCore/QuartzCore.h> |
| (...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1552 const ui::LatencyInfo& latency) { | 1552 const ui::LatencyInfo& latency) { |
| 1553 render_widget_host_->ForwardTouchEventWithLatencyInfo(event, latency); | 1553 render_widget_host_->ForwardTouchEventWithLatencyInfo(event, latency); |
| 1554 } | 1554 } |
| 1555 | 1555 |
| 1556 void RenderWidgetHostViewMac::ProcessGestureEvent( | 1556 void RenderWidgetHostViewMac::ProcessGestureEvent( |
| 1557 const blink::WebGestureEvent& event, | 1557 const blink::WebGestureEvent& event, |
| 1558 const ui::LatencyInfo& latency) { | 1558 const ui::LatencyInfo& latency) { |
| 1559 render_widget_host_->ForwardGestureEventWithLatencyInfo(event, latency); | 1559 render_widget_host_->ForwardGestureEventWithLatencyInfo(event, latency); |
| 1560 } | 1560 } |
| 1561 | 1561 |
| 1562 gfx::Point RenderWidgetHostViewMac::TransformPointToLocalCoordSpace( | 1562 bool RenderWidgetHostViewMac::TransformPointToLocalCoordSpace( |
| 1563 const gfx::Point& point, | 1563 const gfx::Point& point, |
| 1564 const cc::SurfaceId& original_surface) { | 1564 const cc::SurfaceId& original_surface, |
| 1565 gfx::Point transformed_point; | 1565 gfx::Point* transformed_point) { |
| 1566 // Transformations use physical pixels rather than DIP, so conversion | 1566 // Transformations use physical pixels rather than DIP, so conversion |
| 1567 // is necessary. | 1567 // is necessary. |
| 1568 float scale_factor = display::Screen::GetScreen() | 1568 float scale_factor = display::Screen::GetScreen() |
| 1569 ->GetDisplayNearestWindow(cocoa_view_) | 1569 ->GetDisplayNearestWindow(cocoa_view_) |
| 1570 .device_scale_factor(); | 1570 .device_scale_factor(); |
| 1571 gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point); | 1571 gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point); |
| 1572 transformed_point = | 1572 if (!browser_compositor_->GetDelegatedFrameHost() |
| 1573 browser_compositor_->GetDelegatedFrameHost() | 1573 ->TransformPointToLocalCoordSpace(point_in_pixels, original_surface, |
| 1574 ->TransformPointToLocalCoordSpace(point_in_pixels, original_surface); | 1574 transformed_point)) |
| 1575 return gfx::ConvertPointToDIP(scale_factor, transformed_point); | 1575 return false; |
| 1576 *transformed_point = gfx::ConvertPointToDIP(scale_factor, *transformed_point); |
| 1577 return true; |
| 1576 } | 1578 } |
| 1577 | 1579 |
| 1578 gfx::Point RenderWidgetHostViewMac::TransformPointToCoordSpaceForView( | 1580 bool RenderWidgetHostViewMac::TransformPointToCoordSpaceForView( |
| 1579 const gfx::Point& point, | 1581 const gfx::Point& point, |
| 1580 RenderWidgetHostViewBase* target_view) { | 1582 RenderWidgetHostViewBase* target_view, |
| 1583 gfx::Point* transformed_point) { |
| 1581 return browser_compositor_->GetDelegatedFrameHost() | 1584 return browser_compositor_->GetDelegatedFrameHost() |
| 1582 ->TransformPointToCoordSpaceForView(point, target_view); | 1585 ->TransformPointToCoordSpaceForView(point, target_view, |
| 1586 transformed_point); |
| 1583 } | 1587 } |
| 1584 | 1588 |
| 1585 bool RenderWidgetHostViewMac::Send(IPC::Message* message) { | 1589 bool RenderWidgetHostViewMac::Send(IPC::Message* message) { |
| 1586 if (render_widget_host_) | 1590 if (render_widget_host_) |
| 1587 return render_widget_host_->Send(message); | 1591 return render_widget_host_->Send(message); |
| 1588 delete message; | 1592 delete message; |
| 1589 return false; | 1593 return false; |
| 1590 } | 1594 } |
| 1591 | 1595 |
| 1592 void RenderWidgetHostViewMac::ShutdownHost() { | 1596 void RenderWidgetHostViewMac::ShutdownHost() { |
| (...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3392 | 3396 |
| 3393 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3397 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3394 // regions that are not draggable. (See ControlRegionView in | 3398 // regions that are not draggable. (See ControlRegionView in |
| 3395 // native_app_window_cocoa.mm). This requires the render host view to be | 3399 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3396 // draggable by default. | 3400 // draggable by default. |
| 3397 - (BOOL)mouseDownCanMoveWindow { | 3401 - (BOOL)mouseDownCanMoveWindow { |
| 3398 return YES; | 3402 return YES; |
| 3399 } | 3403 } |
| 3400 | 3404 |
| 3401 @end | 3405 @end |
| OLD | NEW |