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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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:: | 403 void RenderWidgetHostViewMac:: |
404 BrowserCompositorMacSendReclaimCompositorResources( | 404 BrowserCompositorMacSendReclaimCompositorResources( |
405 int compositor_frame_sink_id, | |
406 bool is_swap_ack, | 405 bool is_swap_ack, |
407 const cc::ReturnedResourceArray& resources) { | 406 const cc::ReturnedResourceArray& resources) { |
408 render_widget_host_->Send(new ViewMsg_ReclaimCompositorResources( | 407 render_widget_host_->SendReclaimCompositorResources(is_swap_ack, resources); |
409 render_widget_host_->GetRoutingID(), compositor_frame_sink_id, | |
410 is_swap_ack, resources)); | |
411 } | 408 } |
412 | 409 |
413 void RenderWidgetHostViewMac::BrowserCompositorMacSendBeginFrame( | 410 void RenderWidgetHostViewMac::BrowserCompositorMacSendBeginFrame( |
414 const cc::BeginFrameArgs& args) { | 411 const cc::BeginFrameArgs& args) { |
415 needs_flush_input_ = false; | 412 needs_flush_input_ = false; |
416 render_widget_host_->FlushInput(); | 413 render_widget_host_->FlushInput(); |
417 UpdateNeedsBeginFramesInternal(); | 414 UpdateNeedsBeginFramesInternal(); |
418 render_widget_host_->Send( | 415 render_widget_host_->Send( |
419 new ViewMsg_BeginFrame(render_widget_host_->GetRoutingID(), args)); | 416 new ViewMsg_BeginFrame(render_widget_host_->GetRoutingID(), args)); |
420 } | 417 } |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 // If the Mac Zoom feature is enabled, update it with the bounds of the | 1416 // If the Mac Zoom feature is enabled, update it with the bounds of the |
1420 // current focused node so that it can ensure that it's scrolled into view. | 1417 // current focused node so that it can ensure that it's scrolled into view. |
1421 // Don't do anything if it's an editable node, as this will be handled by | 1418 // Don't do anything if it's an editable node, as this will be handled by |
1422 // OnSelectionBoundsChanged instead. | 1419 // OnSelectionBoundsChanged instead. |
1423 if (UAZoomEnabled() && !is_editable_node) { | 1420 if (UAZoomEnabled() && !is_editable_node) { |
1424 NSRect bounds = NSRectFromCGRect(node_bounds_in_screen.ToCGRect()); | 1421 NSRect bounds = NSRectFromCGRect(node_bounds_in_screen.ToCGRect()); |
1425 UAZoomChangeFocus(&bounds, NULL, kUAZoomFocusTypeOther); | 1422 UAZoomChangeFocus(&bounds, NULL, kUAZoomFocusTypeOther); |
1426 } | 1423 } |
1427 } | 1424 } |
1428 | 1425 |
1429 void RenderWidgetHostViewMac::OnSwapCompositorFrame( | 1426 void RenderWidgetHostViewMac::DidCreateNewRendererCompositorFrameSink() { |
1430 uint32_t compositor_frame_sink_id, | 1427 browser_compositor_->DidCreateNewRendererCompositorFrameSink(); |
| 1428 } |
| 1429 |
| 1430 void RenderWidgetHostViewMac::SubmitCompositorFrame( |
1431 const cc::LocalSurfaceId& local_surface_id, | 1431 const cc::LocalSurfaceId& local_surface_id, |
1432 cc::CompositorFrame frame) { | 1432 cc::CompositorFrame frame) { |
1433 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); | 1433 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); |
1434 | 1434 |
1435 // Override the compositor background color. See RenderWidgetHostViewAura | 1435 // Override the compositor background color. See RenderWidgetHostViewAura |
1436 // for more details. | 1436 // for more details. |
1437 SetBackgroundColor(frame.metadata.root_background_color); | 1437 SetBackgroundColor(frame.metadata.root_background_color); |
1438 | 1438 |
1439 last_scroll_offset_ = frame.metadata.root_scroll_offset; | 1439 last_scroll_offset_ = frame.metadata.root_scroll_offset; |
1440 | 1440 |
1441 page_at_minimum_scale_ = | 1441 page_at_minimum_scale_ = |
1442 frame.metadata.page_scale_factor == frame.metadata.min_page_scale_factor; | 1442 frame.metadata.page_scale_factor == frame.metadata.min_page_scale_factor; |
1443 browser_compositor_->SwapCompositorFrame(compositor_frame_sink_id, | 1443 browser_compositor_->SubmitCompositorFrame(local_surface_id, |
1444 local_surface_id, std::move(frame)); | 1444 std::move(frame)); |
1445 UpdateDisplayVSyncParameters(); | 1445 UpdateDisplayVSyncParameters(); |
1446 } | 1446 } |
1447 | 1447 |
1448 void RenderWidgetHostViewMac::OnBeginFrameDidNotSwap( | 1448 void RenderWidgetHostViewMac::OnBeginFrameDidNotSwap( |
1449 const cc::BeginFrameAck& ack) { | 1449 const cc::BeginFrameAck& ack) { |
1450 browser_compositor_->OnBeginFrameDidNotSwap(ack); | 1450 browser_compositor_->OnBeginFrameDidNotSwap(ack); |
1451 } | 1451 } |
1452 | 1452 |
1453 void RenderWidgetHostViewMac::ClearCompositorFrame() { | 1453 void RenderWidgetHostViewMac::ClearCompositorFrame() { |
1454 browser_compositor_->GetDelegatedFrameHost()->ClearDelegatedFrame(); | 1454 browser_compositor_->GetDelegatedFrameHost()->ClearDelegatedFrame(); |
(...skipping 2052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3507 | 3507 |
3508 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3508 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3509 // regions that are not draggable. (See ControlRegionView in | 3509 // regions that are not draggable. (See ControlRegionView in |
3510 // native_app_window_cocoa.mm). This requires the render host view to be | 3510 // native_app_window_cocoa.mm). This requires the render host view to be |
3511 // draggable by default. | 3511 // draggable by default. |
3512 - (BOOL)mouseDownCanMoveWindow { | 3512 - (BOOL)mouseDownCanMoveWindow { |
3513 return YES; | 3513 return YES; |
3514 } | 3514 } |
3515 | 3515 |
3516 @end | 3516 @end |
OLD | NEW |