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 | 10 |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 [cocoa_view_ setFrame:frame]; | 848 [cocoa_view_ setFrame:frame]; |
849 } else { | 849 } else { |
850 BaseView* superview = static_cast<BaseView*>([cocoa_view_ superview]); | 850 BaseView* superview = static_cast<BaseView*>([cocoa_view_ superview]); |
851 gfx::Rect rect2 = [superview flipNSRectToRect:[cocoa_view_ frame]]; | 851 gfx::Rect rect2 = [superview flipNSRectToRect:[cocoa_view_ frame]]; |
852 rect2.set_width(rect.width()); | 852 rect2.set_width(rect.width()); |
853 rect2.set_height(rect.height()); | 853 rect2.set_height(rect.height()); |
854 [cocoa_view_ setFrame:[superview flipRectToNSRect:rect2]]; | 854 [cocoa_view_ setFrame:[superview flipRectToNSRect:rect2]]; |
855 } | 855 } |
856 } | 856 } |
857 | 857 |
| 858 gfx::Vector2dF RenderWidgetHostViewMac::GetLastScrollOffset() const { |
| 859 return last_scroll_offset_; |
| 860 } |
| 861 |
858 gfx::NativeView RenderWidgetHostViewMac::GetNativeView() const { | 862 gfx::NativeView RenderWidgetHostViewMac::GetNativeView() const { |
859 return cocoa_view_; | 863 return cocoa_view_; |
860 } | 864 } |
861 | 865 |
862 gfx::NativeViewId RenderWidgetHostViewMac::GetNativeViewId() const { | 866 gfx::NativeViewId RenderWidgetHostViewMac::GetNativeViewId() const { |
863 return reinterpret_cast<gfx::NativeViewId>(GetNativeView()); | 867 return reinterpret_cast<gfx::NativeViewId>(GetNativeView()); |
864 } | 868 } |
865 | 869 |
866 gfx::NativeViewAccessible RenderWidgetHostViewMac::GetNativeViewAccessible() { | 870 gfx::NativeViewAccessible RenderWidgetHostViewMac::GetNativeViewAccessible() { |
867 NOTIMPLEMENTED(); | 871 NOTIMPLEMENTED(); |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 const gfx::Size& desired_size) { | 1378 const gfx::Size& desired_size) { |
1375 if (browser_compositor_view_) | 1379 if (browser_compositor_view_) |
1376 return browser_compositor_view_->HasFrameOfSize(desired_size); | 1380 return browser_compositor_view_->HasFrameOfSize(desired_size); |
1377 return false; | 1381 return false; |
1378 } | 1382 } |
1379 | 1383 |
1380 void RenderWidgetHostViewMac::OnSwapCompositorFrame( | 1384 void RenderWidgetHostViewMac::OnSwapCompositorFrame( |
1381 uint32 output_surface_id, scoped_ptr<cc::CompositorFrame> frame) { | 1385 uint32 output_surface_id, scoped_ptr<cc::CompositorFrame> frame) { |
1382 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); | 1386 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); |
1383 | 1387 |
| 1388 last_scroll_offset_ = frame->metadata.root_scroll_offset; |
1384 if (frame->delegated_frame_data) { | 1389 if (frame->delegated_frame_data) { |
1385 float scale_factor = frame->metadata.device_scale_factor; | 1390 float scale_factor = frame->metadata.device_scale_factor; |
1386 | 1391 |
1387 // Compute the frame size based on the root render pass rect size. | 1392 // Compute the frame size based on the root render pass rect size. |
1388 cc::RenderPass* root_pass = | 1393 cc::RenderPass* root_pass = |
1389 frame->delegated_frame_data->render_pass_list.back(); | 1394 frame->delegated_frame_data->render_pass_list.back(); |
1390 gfx::Size pixel_size = root_pass->output_rect.size(); | 1395 gfx::Size pixel_size = root_pass->output_rect.size(); |
1391 gfx::Size dip_size = | 1396 gfx::Size dip_size = |
1392 ConvertSizeToDIP(scale_factor, pixel_size); | 1397 ConvertSizeToDIP(scale_factor, pixel_size); |
1393 | 1398 |
(...skipping 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3332 | 3337 |
3333 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3338 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3334 // regions that are not draggable. (See ControlRegionView in | 3339 // regions that are not draggable. (See ControlRegionView in |
3335 // native_app_window_cocoa.mm). This requires the render host view to be | 3340 // native_app_window_cocoa.mm). This requires the render host view to be |
3336 // draggable by default. | 3341 // draggable by default. |
3337 - (BOOL)mouseDownCanMoveWindow { | 3342 - (BOOL)mouseDownCanMoveWindow { |
3338 return YES; | 3343 return YES; |
3339 } | 3344 } |
3340 | 3345 |
3341 @end | 3346 @end |
OLD | NEW |