| 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 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1440 const ui::LatencyInfo& latency) { | 1440 const ui::LatencyInfo& latency) { |
| 1441 render_widget_host_->ForwardTouchEventWithLatencyInfo(event, latency); | 1441 render_widget_host_->ForwardTouchEventWithLatencyInfo(event, latency); |
| 1442 } | 1442 } |
| 1443 | 1443 |
| 1444 void RenderWidgetHostViewMac::ProcessGestureEvent( | 1444 void RenderWidgetHostViewMac::ProcessGestureEvent( |
| 1445 const blink::WebGestureEvent& event, | 1445 const blink::WebGestureEvent& event, |
| 1446 const ui::LatencyInfo& latency) { | 1446 const ui::LatencyInfo& latency) { |
| 1447 render_widget_host_->ForwardGestureEventWithLatencyInfo(event, latency); | 1447 render_widget_host_->ForwardGestureEventWithLatencyInfo(event, latency); |
| 1448 } | 1448 } |
| 1449 | 1449 |
| 1450 void RenderWidgetHostViewMac::TransformPointToLocalCoordSpace( | 1450 gfx::Point RenderWidgetHostViewMac::TransformPointToLocalCoordSpace( |
| 1451 const gfx::Point& point, | 1451 const gfx::Point& point, |
| 1452 const cc::SurfaceId& original_surface, | 1452 const cc::SurfaceId& original_surface) { |
| 1453 gfx::Point* transformed_point) { | 1453 gfx::Point transformed_point; |
| 1454 // Transformations use physical pixels rather than DIP, so conversion | 1454 // Transformations use physical pixels rather than DIP, so conversion |
| 1455 // is necessary. | 1455 // is necessary. |
| 1456 float scale_factor = display::Screen::GetScreen() | 1456 float scale_factor = display::Screen::GetScreen() |
| 1457 ->GetDisplayNearestWindow(cocoa_view_) | 1457 ->GetDisplayNearestWindow(cocoa_view_) |
| 1458 .device_scale_factor(); | 1458 .device_scale_factor(); |
| 1459 gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point); | 1459 gfx::Point point_in_pixels = gfx::ConvertPointToPixel(scale_factor, point); |
| 1460 browser_compositor_->GetDelegatedFrameHost()->TransformPointToLocalCoordSpace( | 1460 transformed_point = |
| 1461 point_in_pixels, original_surface, transformed_point); | 1461 browser_compositor_->GetDelegatedFrameHost() |
| 1462 *transformed_point = gfx::ConvertPointToDIP(scale_factor, *transformed_point); | 1462 ->TransformPointToLocalCoordSpace(point_in_pixels, original_surface); |
| 1463 return gfx::ConvertPointToDIP(scale_factor, transformed_point); |
| 1464 } |
| 1465 |
| 1466 gfx::Point RenderWidgetHostViewMac::TransformPointToCoordSpaceForView( |
| 1467 const gfx::Point& point, |
| 1468 RenderWidgetHostViewBase* target_view) { |
| 1469 return browser_compositor_->GetDelegatedFrameHost() |
| 1470 ->TransformPointToCoordSpaceForView(point, target_view); |
| 1463 } | 1471 } |
| 1464 | 1472 |
| 1465 bool RenderWidgetHostViewMac::Send(IPC::Message* message) { | 1473 bool RenderWidgetHostViewMac::Send(IPC::Message* message) { |
| 1466 if (render_widget_host_) | 1474 if (render_widget_host_) |
| 1467 return render_widget_host_->Send(message); | 1475 return render_widget_host_->Send(message); |
| 1468 delete message; | 1476 delete message; |
| 1469 return false; | 1477 return false; |
| 1470 } | 1478 } |
| 1471 | 1479 |
| 1472 void RenderWidgetHostViewMac::ShutdownHost() { | 1480 void RenderWidgetHostViewMac::ShutdownHost() { |
| (...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3227 | 3235 |
| 3228 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3236 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3229 // regions that are not draggable. (See ControlRegionView in | 3237 // regions that are not draggable. (See ControlRegionView in |
| 3230 // native_app_window_cocoa.mm). This requires the render host view to be | 3238 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3231 // draggable by default. | 3239 // draggable by default. |
| 3232 - (BOOL)mouseDownCanMoveWindow { | 3240 - (BOOL)mouseDownCanMoveWindow { |
| 3233 return YES; | 3241 return YES; |
| 3234 } | 3242 } |
| 3235 | 3243 |
| 3236 @end | 3244 @end |
| OLD | NEW |