| 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 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 // Don't do anything if it's an editable node, as this will be handled by | 1421 // Don't do anything if it's an editable node, as this will be handled by |
| 1422 // OnSelectionBoundsChanged instead. | 1422 // OnSelectionBoundsChanged instead. |
| 1423 if (UAZoomEnabled() && !is_editable_node) { | 1423 if (UAZoomEnabled() && !is_editable_node) { |
| 1424 NSRect bounds = NSRectFromCGRect(node_bounds_in_screen.ToCGRect()); | 1424 NSRect bounds = NSRectFromCGRect(node_bounds_in_screen.ToCGRect()); |
| 1425 UAZoomChangeFocus(&bounds, NULL, kUAZoomFocusTypeOther); | 1425 UAZoomChangeFocus(&bounds, NULL, kUAZoomFocusTypeOther); |
| 1426 } | 1426 } |
| 1427 } | 1427 } |
| 1428 | 1428 |
| 1429 void RenderWidgetHostViewMac::OnSwapCompositorFrame( | 1429 void RenderWidgetHostViewMac::OnSwapCompositorFrame( |
| 1430 uint32_t compositor_frame_sink_id, | 1430 uint32_t compositor_frame_sink_id, |
| 1431 const cc::LocalSurfaceId& local_surface_id, |
| 1431 cc::CompositorFrame frame) { | 1432 cc::CompositorFrame frame) { |
| 1432 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); | 1433 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); |
| 1433 | 1434 |
| 1434 // Override the compositor background color. See RenderWidgetHostViewAura | 1435 // Override the compositor background color. See RenderWidgetHostViewAura |
| 1435 // for more details. | 1436 // for more details. |
| 1436 SetBackgroundColor(frame.metadata.root_background_color); | 1437 SetBackgroundColor(frame.metadata.root_background_color); |
| 1437 | 1438 |
| 1438 last_scroll_offset_ = frame.metadata.root_scroll_offset; | 1439 last_scroll_offset_ = frame.metadata.root_scroll_offset; |
| 1439 | 1440 |
| 1440 page_at_minimum_scale_ = | 1441 page_at_minimum_scale_ = |
| 1441 frame.metadata.page_scale_factor == frame.metadata.min_page_scale_factor; | 1442 frame.metadata.page_scale_factor == frame.metadata.min_page_scale_factor; |
| 1442 browser_compositor_->SwapCompositorFrame(compositor_frame_sink_id, | 1443 browser_compositor_->SwapCompositorFrame(compositor_frame_sink_id, |
| 1443 std::move(frame)); | 1444 local_surface_id, std::move(frame)); |
| 1444 UpdateDisplayVSyncParameters(); | 1445 UpdateDisplayVSyncParameters(); |
| 1445 } | 1446 } |
| 1446 | 1447 |
| 1447 void RenderWidgetHostViewMac::ClearCompositorFrame() { | 1448 void RenderWidgetHostViewMac::ClearCompositorFrame() { |
| 1448 browser_compositor_->GetDelegatedFrameHost()->ClearDelegatedFrame(); | 1449 browser_compositor_->GetDelegatedFrameHost()->ClearDelegatedFrame(); |
| 1449 } | 1450 } |
| 1450 | 1451 |
| 1451 gfx::Rect RenderWidgetHostViewMac::GetBoundsInRootWindow() { | 1452 gfx::Rect RenderWidgetHostViewMac::GetBoundsInRootWindow() { |
| 1452 // TODO(shess): In case of !window, the view has been removed from | 1453 // TODO(shess): In case of !window, the view has been removed from |
| 1453 // the view hierarchy because the tab isn't main. Could retrieve | 1454 // the view hierarchy because the tab isn't main. Could retrieve |
| (...skipping 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3485 | 3486 |
| 3486 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3487 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3487 // regions that are not draggable. (See ControlRegionView in | 3488 // regions that are not draggable. (See ControlRegionView in |
| 3488 // native_app_window_cocoa.mm). This requires the render host view to be | 3489 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3489 // draggable by default. | 3490 // draggable by default. |
| 3490 - (BOOL)mouseDownCanMoveWindow { | 3491 - (BOOL)mouseDownCanMoveWindow { |
| 3491 return YES; | 3492 return YES; |
| 3492 } | 3493 } |
| 3493 | 3494 |
| 3494 @end | 3495 @end |
| OLD | NEW |