| 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 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 // If the Mac Zoom feature is enabled, update it with the bounds of the | 1410 // If the Mac Zoom feature is enabled, update it with the bounds of the |
| 1418 // current focused node so that it can ensure that it's scrolled into view. | 1411 // current focused node so that it can ensure that it's scrolled into view. |
| 1419 // Don't do anything if it's an editable node, as this will be handled by | 1412 // Don't do anything if it's an editable node, as this will be handled by |
| 1420 // OnSelectionBoundsChanged instead. | 1413 // OnSelectionBoundsChanged instead. |
| 1421 if (UAZoomEnabled() && !is_editable_node) { | 1414 if (UAZoomEnabled() && !is_editable_node) { |
| 1422 NSRect bounds = NSRectFromCGRect(node_bounds_in_screen.ToCGRect()); | 1415 NSRect bounds = NSRectFromCGRect(node_bounds_in_screen.ToCGRect()); |
| 1423 UAZoomChangeFocus(&bounds, NULL, kUAZoomFocusTypeOther); | 1416 UAZoomChangeFocus(&bounds, NULL, kUAZoomFocusTypeOther); |
| 1424 } | 1417 } |
| 1425 } | 1418 } |
| 1426 | 1419 |
| 1427 void RenderWidgetHostViewMac::DidCreateNewRendererCompositorFrameSink() { | 1420 void RenderWidgetHostViewMac::DidCreateNewRendererCompositorFrameSink( |
| 1428 browser_compositor_->DidCreateNewRendererCompositorFrameSink(); | 1421 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink) { |
| 1422 browser_compositor_->DidCreateNewRendererCompositorFrameSink( |
| 1423 renderer_compositor_frame_sink); |
| 1429 } | 1424 } |
| 1430 | 1425 |
| 1431 void RenderWidgetHostViewMac::SubmitCompositorFrame( | 1426 void RenderWidgetHostViewMac::SubmitCompositorFrame( |
| 1432 const cc::LocalSurfaceId& local_surface_id, | 1427 const cc::LocalSurfaceId& local_surface_id, |
| 1433 cc::CompositorFrame frame) { | 1428 cc::CompositorFrame frame) { |
| 1434 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); | 1429 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); |
| 1435 | 1430 |
| 1436 // Override the compositor background color. See RenderWidgetHostViewAura | 1431 // Override the compositor background color. See RenderWidgetHostViewAura |
| 1437 // for more details. | 1432 // for more details. |
| 1438 UpdateBackgroundColorFromRenderer(frame.metadata.root_background_color); | 1433 UpdateBackgroundColorFromRenderer(frame.metadata.root_background_color); |
| (...skipping 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3521 | 3516 |
| 3522 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3517 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3523 // regions that are not draggable. (See ControlRegionView in | 3518 // regions that are not draggable. (See ControlRegionView in |
| 3524 // native_app_window_cocoa.mm). This requires the render host view to be | 3519 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3525 // draggable by default. | 3520 // draggable by default. |
| 3526 - (BOOL)mouseDownCanMoveWindow { | 3521 - (BOOL)mouseDownCanMoveWindow { |
| 3527 return YES; | 3522 return YES; |
| 3528 } | 3523 } |
| 3529 | 3524 |
| 3530 @end | 3525 @end |
| OLD | NEW |