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 <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 #include <OpenGL/gl.h> | 8 #include <OpenGL/gl.h> |
9 #include <QuartzCore/QuartzCore.h> | 9 #include <QuartzCore/QuartzCore.h> |
10 | 10 |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 0); | 786 0); |
787 render_widget_host_->WasShown(renderer_latency_info); | 787 render_widget_host_->WasShown(renderer_latency_info); |
788 | 788 |
789 // If there is not a frame being currently drawn, kick one, so that the below | 789 // If there is not a frame being currently drawn, kick one, so that the below |
790 // pause will have a frame to wait on. | 790 // pause will have a frame to wait on. |
791 render_widget_host_->ScheduleComposite(); | 791 render_widget_host_->ScheduleComposite(); |
792 PauseForPendingResizeOrRepaintsAndDraw(); | 792 PauseForPendingResizeOrRepaintsAndDraw(); |
793 } | 793 } |
794 | 794 |
795 void RenderWidgetHostViewMac::WasHidden() { | 795 void RenderWidgetHostViewMac::WasHidden() { |
796 if (render_widget_host_->is_hidden()) | 796 // We want to call DestroyBrowserCompositorView on inactive tabs, but not on |
797 return; | 797 // an active tab that is being occluded. |
798 | 798 if (![cocoa_view_ window]) |
799 DestroyBrowserCompositorView(); | 799 DestroyBrowserCompositorView(); |
800 | 800 |
801 // If we have a renderer, then inform it that we are being hidden so it can | 801 // If we have a renderer, then inform it that we are being hidden so it can |
802 // reduce its resource utilization. | 802 // reduce its resource utilization. |
803 render_widget_host_->WasHidden(); | 803 if (!render_widget_host_->is_hidden()) |
| 804 render_widget_host_->WasHidden(); |
804 } | 805 } |
805 | 806 |
806 void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) { | 807 void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) { |
807 gfx::Rect rect = GetViewBounds(); | 808 gfx::Rect rect = GetViewBounds(); |
808 rect.set_size(size); | 809 rect.set_size(size); |
809 SetBounds(rect); | 810 SetBounds(rect); |
810 } | 811 } |
811 | 812 |
812 void RenderWidgetHostViewMac::SetBounds(const gfx::Rect& rect) { | 813 void RenderWidgetHostViewMac::SetBounds(const gfx::Rect& rect) { |
813 // |rect.size()| is view coordinates, |rect.origin| is screen coordinates, | 814 // |rect.size()| is view coordinates, |rect.origin| is screen coordinates, |
(...skipping 2494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3308 | 3309 |
3309 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3310 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3310 // regions that are not draggable. (See ControlRegionView in | 3311 // regions that are not draggable. (See ControlRegionView in |
3311 // native_app_window_cocoa.mm). This requires the render host view to be | 3312 // native_app_window_cocoa.mm). This requires the render host view to be |
3312 // draggable by default. | 3313 // draggable by default. |
3313 - (BOOL)mouseDownCanMoveWindow { | 3314 - (BOOL)mouseDownCanMoveWindow { |
3314 return YES; | 3315 return YES; |
3315 } | 3316 } |
3316 | 3317 |
3317 @end | 3318 @end |
OLD | NEW |