| 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 |
| 403 void RenderWidgetHostViewMac::BrowserCompositorMacSendBeginFrame( | 410 void RenderWidgetHostViewMac::BrowserCompositorMacSendBeginFrame( |
| 404 const cc::BeginFrameArgs& args) { | 411 const cc::BeginFrameArgs& args) { |
| 405 needs_flush_input_ = false; | 412 needs_flush_input_ = false; |
| 406 render_widget_host_->FlushInput(); | 413 render_widget_host_->FlushInput(); |
| 407 UpdateNeedsBeginFramesInternal(); | 414 UpdateNeedsBeginFramesInternal(); |
| 408 render_widget_host_->Send( | 415 render_widget_host_->Send( |
| 409 new ViewMsg_BeginFrame(render_widget_host_->GetRoutingID(), args)); | 416 new ViewMsg_BeginFrame(render_widget_host_->GetRoutingID(), args)); |
| 410 } | 417 } |
| 411 | 418 |
| 412 //////////////////////////////////////////////////////////////////////////////// | 419 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1405 // If the Mac Zoom feature is enabled, update it with the bounds of the | 1412 // If the Mac Zoom feature is enabled, update it with the bounds of the |
| 1406 // current focused node so that it can ensure that it's scrolled into view. | 1413 // current focused node so that it can ensure that it's scrolled into view. |
| 1407 // Don't do anything if it's an editable node, as this will be handled by | 1414 // Don't do anything if it's an editable node, as this will be handled by |
| 1408 // OnSelectionBoundsChanged instead. | 1415 // OnSelectionBoundsChanged instead. |
| 1409 if (UAZoomEnabled() && !is_editable_node) { | 1416 if (UAZoomEnabled() && !is_editable_node) { |
| 1410 NSRect bounds = NSRectFromCGRect(node_bounds_in_screen.ToCGRect()); | 1417 NSRect bounds = NSRectFromCGRect(node_bounds_in_screen.ToCGRect()); |
| 1411 UAZoomChangeFocus(&bounds, NULL, kUAZoomFocusTypeOther); | 1418 UAZoomChangeFocus(&bounds, NULL, kUAZoomFocusTypeOther); |
| 1412 } | 1419 } |
| 1413 } | 1420 } |
| 1414 | 1421 |
| 1415 void RenderWidgetHostViewMac::DidCreateNewRendererCompositorFrameSink( | 1422 void RenderWidgetHostViewMac::DidCreateNewRendererCompositorFrameSink() { |
| 1416 cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink) { | 1423 browser_compositor_->DidCreateNewRendererCompositorFrameSink(); |
| 1417 browser_compositor_->DidCreateNewRendererCompositorFrameSink( | |
| 1418 renderer_compositor_frame_sink); | |
| 1419 } | 1424 } |
| 1420 | 1425 |
| 1421 void RenderWidgetHostViewMac::SubmitCompositorFrame( | 1426 void RenderWidgetHostViewMac::SubmitCompositorFrame( |
| 1422 const cc::LocalSurfaceId& local_surface_id, | 1427 const cc::LocalSurfaceId& local_surface_id, |
| 1423 cc::CompositorFrame frame) { | 1428 cc::CompositorFrame frame) { |
| 1424 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); | 1429 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); |
| 1425 | 1430 |
| 1426 // Override the compositor background color. See RenderWidgetHostViewAura | 1431 // Override the compositor background color. See RenderWidgetHostViewAura |
| 1427 // for more details. | 1432 // for more details. |
| 1428 UpdateBackgroundColorFromRenderer(frame.metadata.root_background_color); | 1433 UpdateBackgroundColorFromRenderer(frame.metadata.root_background_color); |
| (...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3503 | 3508 |
| 3504 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3509 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3505 // regions that are not draggable. (See ControlRegionView in | 3510 // regions that are not draggable. (See ControlRegionView in |
| 3506 // native_app_window_cocoa.mm). This requires the render host view to be | 3511 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3507 // draggable by default. | 3512 // draggable by default. |
| 3508 - (BOOL)mouseDownCanMoveWindow { | 3513 - (BOOL)mouseDownCanMoveWindow { |
| 3509 return YES; | 3514 return YES; |
| 3510 } | 3515 } |
| 3511 | 3516 |
| 3512 @end | 3517 @end |
| OLD | NEW |