| 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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 // When making an element on the page fullscreen the element's background | 393 // When making an element on the page fullscreen the element's background |
| 394 // may not match the page's, so use black as the gutter color to avoid | 394 // may not match the page's, so use black as the gutter color to avoid |
| 395 // flashes of brighter colors during the transition. | 395 // flashes of brighter colors during the transition. |
| 396 if (render_widget_host_->delegate() && | 396 if (render_widget_host_->delegate() && |
| 397 render_widget_host_->delegate()->IsFullscreenForCurrentTab()) { | 397 render_widget_host_->delegate()->IsFullscreenForCurrentTab()) { |
| 398 return SK_ColorBLACK; | 398 return SK_ColorBLACK; |
| 399 } | 399 } |
| 400 return color; | 400 return color; |
| 401 } | 401 } |
| 402 | 402 |
| 403 void RenderWidgetHostViewMac:: | |
| 404 BrowserCompositorMacSendReclaimCompositorResources( | |
| 405 bool is_swap_ack, | |
| 406 const cc::ReturnedResourceArray& resources) { | |
| 407 render_widget_host_->SendReclaimCompositorResources(is_swap_ack, resources); | |
| 408 } | |
| 409 | |
| 410 void RenderWidgetHostViewMac::BrowserCompositorMacSendBeginFrame( | 403 void RenderWidgetHostViewMac::BrowserCompositorMacSendBeginFrame( |
| 411 const cc::BeginFrameArgs& args) { | 404 const cc::BeginFrameArgs& args) { |
| 412 needs_flush_input_ = false; | 405 needs_flush_input_ = false; |
| 413 render_widget_host_->FlushInput(); | 406 render_widget_host_->FlushInput(); |
| 414 UpdateNeedsBeginFramesInternal(); | 407 UpdateNeedsBeginFramesInternal(); |
| 415 render_widget_host_->Send( | 408 render_widget_host_->Send( |
| 416 new ViewMsg_BeginFrame(render_widget_host_->GetRoutingID(), args)); | 409 new ViewMsg_BeginFrame(render_widget_host_->GetRoutingID(), args)); |
| 417 } | 410 } |
| 418 | 411 |
| 419 //////////////////////////////////////////////////////////////////////////////// | 412 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 // If the Mac Zoom feature is enabled, update it with the bounds of the | 1411 // If the Mac Zoom feature is enabled, update it with the bounds of the |
| 1419 // current focused node so that it can ensure that it's scrolled into view. | 1412 // current focused node so that it can ensure that it's scrolled into view. |
| 1420 // Don't do anything if it's an editable node, as this will be handled by | 1413 // Don't do anything if it's an editable node, as this will be handled by |
| 1421 // OnSelectionBoundsChanged instead. | 1414 // OnSelectionBoundsChanged instead. |
| 1422 if (UAZoomEnabled() && !is_editable_node) { | 1415 if (UAZoomEnabled() && !is_editable_node) { |
| 1423 NSRect bounds = NSRectFromCGRect(node_bounds_in_screen.ToCGRect()); | 1416 NSRect bounds = NSRectFromCGRect(node_bounds_in_screen.ToCGRect()); |
| 1424 UAZoomChangeFocus(&bounds, NULL, kUAZoomFocusTypeOther); | 1417 UAZoomChangeFocus(&bounds, NULL, kUAZoomFocusTypeOther); |
| 1425 } | 1418 } |
| 1426 } | 1419 } |
| 1427 | 1420 |
| 1428 void RenderWidgetHostViewMac::DidCreateNewRendererCompositorFrameSink() { | 1421 void RenderWidgetHostViewMac::DidCreateNewRendererCompositorFrameSink( |
| 1429 browser_compositor_->DidCreateNewRendererCompositorFrameSink(); | 1422 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink) { |
| 1423 browser_compositor_->DidCreateNewRendererCompositorFrameSink( |
| 1424 renderer_compositor_frame_sink); |
| 1430 } | 1425 } |
| 1431 | 1426 |
| 1432 void RenderWidgetHostViewMac::SubmitCompositorFrame( | 1427 void RenderWidgetHostViewMac::SubmitCompositorFrame( |
| 1433 const cc::LocalSurfaceId& local_surface_id, | 1428 const cc::LocalSurfaceId& local_surface_id, |
| 1434 cc::CompositorFrame frame) { | 1429 cc::CompositorFrame frame) { |
| 1435 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); | 1430 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); |
| 1436 | 1431 |
| 1437 // Override the compositor background color. See RenderWidgetHostViewAura | 1432 // Override the compositor background color. See RenderWidgetHostViewAura |
| 1438 // for more details. | 1433 // for more details. |
| 1439 UpdateBackgroundColorFromRenderer(frame.metadata.root_background_color); | 1434 UpdateBackgroundColorFromRenderer(frame.metadata.root_background_color); |
| (...skipping 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3522 | 3517 |
| 3523 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3518 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3524 // regions that are not draggable. (See ControlRegionView in | 3519 // regions that are not draggable. (See ControlRegionView in |
| 3525 // native_app_window_cocoa.mm). This requires the render host view to be | 3520 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3526 // draggable by default. | 3521 // draggable by default. |
| 3527 - (BOOL)mouseDownCanMoveWindow { | 3522 - (BOOL)mouseDownCanMoveWindow { |
| 3528 return YES; | 3523 return YES; |
| 3529 } | 3524 } |
| 3530 | 3525 |
| 3531 @end | 3526 @end |
| OLD | NEW |