Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm

Issue 1971283003: Temporary fix for "white patch" fullscreen regression on OSX (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h" 5 #import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 }; 70 };
71 71
72 @interface TabContentsController (TabContentsContainerViewDelegate) 72 @interface TabContentsController (TabContentsContainerViewDelegate)
73 - (BOOL)contentsInFullscreenCaptureMode; 73 - (BOOL)contentsInFullscreenCaptureMode;
74 // Computes and returns the frame to use for the contents view within the 74 // Computes and returns the frame to use for the contents view within the
75 // container view. 75 // container view.
76 - (NSRect)frameForContentsView; 76 - (NSRect)frameForContentsView;
77 77
78 // Returns YES if the content view should be resized. 78 // Returns YES if the content view should be resized.
79 - (BOOL)shouldResizeContentView; 79 - (BOOL)shouldResizeContentView;
80
81 // Returns YES if the content view is inside a popup.
82 - (BOOL)isPopup;
83
80 @end 84 @end
81 85
82 // An NSView with special-case handling for when the contents view does not 86 // An NSView with special-case handling for when the contents view does not
83 // expand to fill the entire tab contents area. See 'AutoEmbedFullscreen mode' 87 // expand to fill the entire tab contents area. See 'AutoEmbedFullscreen mode'
84 // in header file comments. 88 // in header file comments.
85 @interface TabContentsContainerView : NSView { 89 @interface TabContentsContainerView : NSView {
86 @private 90 @private
87 TabContentsController* delegate_; // weak 91 TabContentsController* delegate_; // weak
88 } 92 }
89 93
(...skipping 15 matching lines...) Expand all
105 } 109 }
106 110
107 // Called by the delegate during dealloc to invalidate the pointer held by this 111 // Called by the delegate during dealloc to invalidate the pointer held by this
108 // view. 112 // view.
109 - (void)delegateDestroyed { 113 - (void)delegateDestroyed {
110 delegate_ = nil; 114 delegate_ = nil;
111 } 115 }
112 116
113 // Override auto-resizing logic to query the delegate for the exact frame to 117 // Override auto-resizing logic to query the delegate for the exact frame to
114 // use for the contents view. 118 // use for the contents view.
119 // TODO(spqchan): The popup check is a temporary solution to fix the regression
120 // issue described in crbug.com/604288. This method doesn't really affect
121 // fullscreen if the content is inside a normal browser window, but would
122 // cause a flash fullscreen widget to blow up if it's inside a popup.
115 - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize { 123 - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize {
116 NSView* const contentsView = 124 NSView* const contentsView =
117 [[self subviews] count] > 0 ? [[self subviews] objectAtIndex:0] : nil; 125 [[self subviews] count] > 0 ? [[self subviews] objectAtIndex:0] : nil;
118 if (!contentsView || [contentsView autoresizingMask] == NSViewNotSizable || 126 if (!contentsView || [contentsView autoresizingMask] == NSViewNotSizable ||
119 !delegate_ || ![delegate_ shouldResizeContentView]) { 127 !delegate_ ||
128 (![delegate_ shouldResizeContentView] && [delegate_ isPopup])) {
120 return; 129 return;
121 } 130 }
122 131
123 ScopedCAActionDisabler disabler; 132 ScopedCAActionDisabler disabler;
124 [contentsView setFrame:[delegate_ frameForContentsView]]; 133 [contentsView setFrame:[delegate_ frameForContentsView]];
125 } 134 }
126 135
127 // Update the background layer's color whenever the view needs to repaint. 136 // Update the background layer's color whenever the view needs to repaint.
128 - (void)setNeedsDisplayInRect:(NSRect)rect { 137 - (void)setNeedsDisplayInRect:(NSRect)rect {
129 [super setNeedsDisplayInRect:rect]; 138 [super setNeedsDisplayInRect:rect];
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 - (BOOL)canBecomeKeyView { 186 - (BOOL)canBecomeKeyView {
178 return NO; // Tab/Shift-Tab should focus the subview, not this view. 187 return NO; // Tab/Shift-Tab should focus the subview, not this view.
179 } 188 }
180 189
181 @end // @implementation TabContentsContainerView 190 @end // @implementation TabContentsContainerView
182 191
183 @implementation TabContentsController 192 @implementation TabContentsController
184 @synthesize webContents = contents_; 193 @synthesize webContents = contents_;
185 @synthesize blockFullscreenResize = blockFullscreenResize_; 194 @synthesize blockFullscreenResize = blockFullscreenResize_;
186 195
187 - (id)initWithContents:(WebContents*)contents { 196 - (id)initWithContents:(WebContents*)contents isPopup:(BOOL)popup {
188 if ((self = [super initWithNibName:nil bundle:nil])) { 197 if ((self = [super initWithNibName:nil bundle:nil])) {
189 fullscreenObserver_.reset(new FullscreenObserver(self)); 198 fullscreenObserver_.reset(new FullscreenObserver(self));
190 [self changeWebContents:contents]; 199 [self changeWebContents:contents];
200 isPopup_ = popup;
191 } 201 }
192 return self; 202 return self;
193 } 203 }
194 204
195 - (void)dealloc { 205 - (void)dealloc {
196 [static_cast<TabContentsContainerView*>([self view]) delegateDestroyed]; 206 [static_cast<TabContentsContainerView*>([self view]) delegateDestroyed];
197 // Make sure the contents view has been removed from the container view to 207 // Make sure the contents view has been removed from the container view to
198 // allow objects to be released. 208 // allow objects to be released.
199 [[self view] removeFromSuperview]; 209 [[self view] removeFromSuperview];
200 [super dealloc]; 210 [super dealloc];
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 } 390 }
381 } 391 }
382 392
383 return NSRectFromCGRect(rect.ToCGRect()); 393 return NSRectFromCGRect(rect.ToCGRect());
384 } 394 }
385 395
386 - (BOOL)shouldResizeContentView { 396 - (BOOL)shouldResizeContentView {
387 return !isEmbeddingFullscreenWidget_ || !blockFullscreenResize_; 397 return !isEmbeddingFullscreenWidget_ || !blockFullscreenResize_;
388 } 398 }
389 399
400 - (BOOL)isPopup {
401 return isPopup_;
402 }
403
390 @end 404 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h ('k') | chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698