summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoragable@chromium.org <agable@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-16 22:59:59 +0000
committeragable@chromium.org <agable@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-16 22:59:59 +0000
commit58986e857151eae1357bdf12cb5897ad166f7acf (patch)
tree3761c51917cee29c9fe3458da0ee6fd0bb903739
parentff9946689eb4f04f6e20febe4c3e85949f9b67af (diff)
downloadchromium_src-58986e857151eae1357bdf12cb5897ad166f7acf.zip
chromium_src-58986e857151eae1357bdf12cb5897ad166f7acf.tar.gz
chromium_src-58986e857151eae1357bdf12cb5897ad166f7acf.tar.bz2
Revert of mac: Fix tab dragging visual bug in Yosemite. (reland) (https://codereview.chromium.org/393933003/)
Reason for revert: Broke TestActivate and TestFullscreen on Mac 10.6 Tests (http://build.chromium.org/p/chromium.mac/builders/Mac10.6%20Tests%20%282%29/builds/53658) Original issue's description: > mac: Fix tab dragging visual bug in Yosemite. (reland) > > -----------------Reland Description------------------ > Core animation was turned on in M35. The fullscreen window was not layer > backed, but should have been. This original CL exposed this bug. > > -----------------Original Description------------------ > In OSX 10.10+, all views must be added to the NSWindow's contentView. Some > views (like the tab strip and the profile icon) are placed on top of the title > bar and require special treatment. All other views are added as subviews of > 'chromeContentView' in TabWindowController. This allows tab dragging and > fullscreen logic to easily move the views that don't need special treatment. > > This CL also removes the instances where a VersionIndependentWindow's > contentView gets replaced by setContentView:. Instead, the 'chromeContentView' > gets passed around as a subview. This allows VersionIndependentWindow to remove > another of its internal hacks. > > Original CL link: https://codereview.chromium.org/379293003/ > BUG=392239 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=283456 TBR=andresantoso@chromium.org,shess@chromium.org,erikchen@chromium.org NOTREECHECKS=true NOTRY=true BUG=392239 Review URL: https://codereview.chromium.org/398903003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283563 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm2
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller_private.mm18
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller_unittest.mm2
-rw-r--r--chrome/browser/ui/cocoa/fullscreen_window.mm2
-rw-r--r--chrome/browser/ui/cocoa/tabs/tab_window_controller.h11
-rw-r--r--chrome/browser/ui/cocoa/tabs/tab_window_controller.mm32
-rw-r--r--chrome/browser/ui/cocoa/version_independent_window.mm8
7 files changed, 26 insertions, 49 deletions
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index 74ba691..26cc36e 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -1557,7 +1557,7 @@ using content::WebContents;
if (!downloadShelfController_.get()) {
downloadShelfController_.reset([[DownloadShelfController alloc]
initWithBrowser:browser_.get() resizeDelegate:self]);
- [self.chromeContentView addSubview:[downloadShelfController_ view]];
+ [[[self window] contentView] addSubview:[downloadShelfController_ view]];
}
return downloadShelfController_;
}
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
index f701c6f..e1b7885 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -566,10 +566,13 @@ willPositionSheet:(NSWindow*)sheet
[tabStripView removeFromSuperview];
}
+ // Ditto for the content view.
+ base::scoped_nsobject<NSView> contentView(
+ [[sourceWindow contentView] retain]);
// Disable autoresizing of subviews while we move views around. This prevents
// spurious renderer resizes.
- [self.chromeContentView setAutoresizesSubviews:NO];
- [self.chromeContentView removeFromSuperview];
+ [contentView setAutoresizesSubviews:NO];
+ [contentView removeFromSuperview];
// Have to do this here, otherwise later calls can crash because the window
// has no delegate.
@@ -581,11 +584,8 @@ willPositionSheet:(NSWindow*)sheet
// drawOverlayRect:]. I'm pretty convinced this is an Apple bug, but there is
// no visual impact. I have been unable to tickle it away with other window
// or view manipulation Cocoa calls. Stack added to suppressions_mac.txt.
- [self.chromeContentView setAutoresizesSubviews:YES];
- [[destWindow contentView] addSubview:self.chromeContentView
- positioned:NSWindowBelow
- relativeTo:nil];
- self.chromeContentView.frame = [[destWindow contentView] bounds];
+ [contentView setAutoresizesSubviews:YES];
+ [destWindow setContentView:contentView];
// Move the incognito badge if present.
if ([self shouldShowAvatar]) {
@@ -852,7 +852,7 @@ willPositionSheet:(NSWindow*)sheet
for (NSWindow* window in [[NSApplication sharedApplication] windows]) {
if ([window
isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) {
- [[window contentView] setHidden:YES];
+ [window.contentView setHidden:YES];
}
}
}
@@ -930,7 +930,7 @@ willPositionSheet:(NSWindow*)sheet
}
- (void)updateSubviewZOrder:(BOOL)inPresentationMode {
- NSView* contentView = self.chromeContentView;
+ NSView* contentView = [[self window] contentView];
NSView* toolbarView = [toolbarController_ view];
if (inPresentationMode) {
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm
index 64faaf6..0823f2d 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm
@@ -615,7 +615,7 @@ TEST_F(BrowserWindowControllerTest, TestFindBarOnTop) {
[controller_ addFindBar:bridge.find_bar_cocoa_controller()];
// Test that the Z-order of the find bar is on top of everything.
- NSArray* subviews = [controller_.chromeContentView subviews];
+ NSArray* subviews = [[[controller_ window] contentView] subviews];
NSUInteger findBar_index =
[subviews indexOfObject:[controller_ findBarView]];
EXPECT_NE(NSNotFound, findBar_index);
diff --git a/chrome/browser/ui/cocoa/fullscreen_window.mm b/chrome/browser/ui/cocoa/fullscreen_window.mm
index 9d927ff..9125b21 100644
--- a/chrome/browser/ui/cocoa/fullscreen_window.mm
+++ b/chrome/browser/ui/cocoa/fullscreen_window.mm
@@ -4,7 +4,6 @@
#import "chrome/browser/ui/cocoa/fullscreen_window.h"
-#import "chrome/browser/ui/cocoa/nsview_additions.h"
#import "chrome/browser/ui/cocoa/themed_window.h"
@implementation FullscreenWindow
@@ -28,7 +27,6 @@
// Borderless windows don't usually show up in the Windows menu so whine at
// Cocoa until it complies. See -dealloc and -setTitle: as well.
[NSApp addWindowsItem:self title:@"" filename:NO];
- [[self contentView] cr_setWantsLayer:YES];
}
return self;
}
diff --git a/chrome/browser/ui/cocoa/tabs/tab_window_controller.h b/chrome/browser/ui/cocoa/tabs/tab_window_controller.h
index ef85470..fd41a56 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_window_controller.h
+++ b/chrome/browser/ui/cocoa/tabs/tab_window_controller.h
@@ -23,19 +23,9 @@
@interface TabWindowController : NSWindowController<NSWindowDelegate> {
@private
- // Wrapper view around web content, and the developer tools view.
base::scoped_nsobject<FastResizeView> tabContentArea_;
-
- // The tab strip overlaps the titlebar of the window.
base::scoped_nsobject<TabStripView> tabStripView_;
- // In OSX 10.10+, all views must be added to the NSWindow's contentView. Some
- // views (like the tab strip and the profile icon) are placed on top of the
- // title bar and require special treatment. All other views should be added
- // as subviews of chromeContentView_. This allows tab dragging and fullscreen
- // logic to easily move the views that don't need special treatment.
- base::scoped_nsobject<NSView> chromeContentView_;
-
// The child window used during dragging to achieve the opacity tricks.
NSWindow* overlayWindow_;
@@ -48,7 +38,6 @@
}
@property(readonly, nonatomic) TabStripView* tabStripView;
@property(readonly, nonatomic) FastResizeView* tabContentArea;
-@property(readonly, nonatomic) NSView* chromeContentView;
// This is the designated initializer for this class.
- (id)initTabWindowControllerWithTabStrip:(BOOL)hasTabStrip;
diff --git a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
index 17327c9..c6dfa62 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
@@ -47,10 +47,7 @@
@implementation TabWindowController
- (id)initTabWindowControllerWithTabStrip:(BOOL)hasTabStrip {
- const CGFloat kDefaultWidth = 750;
- const CGFloat kDefaultHeight = 600;
-
- NSRect contentRect = NSMakeRect(60, 229, kDefaultWidth, kDefaultHeight);
+ NSRect contentRect = NSMakeRect(60, 229, 750, 600);
base::scoped_nsobject<FramedBrowserWindow> window(
[[FramedBrowserWindow alloc] initWithContentRect:contentRect
hasTabStrip:hasTabStrip]);
@@ -60,20 +57,14 @@
if ((self = [super initWithWindow:window])) {
[[self window] setDelegate:self];
- chromeContentView_.reset([[NSView alloc]
- initWithFrame:NSMakeRect(0, 0, kDefaultWidth, kDefaultHeight)]);
- [chromeContentView_
- setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
- [[[self window] contentView] addSubview:chromeContentView_];
-
- tabContentArea_.reset(
- [[FastResizeView alloc] initWithFrame:[chromeContentView_ bounds]]);
+ tabContentArea_.reset([[FastResizeView alloc] initWithFrame:
+ NSMakeRect(0, 0, 750, 600)]);
[tabContentArea_ setAutoresizingMask:NSViewWidthSizable |
NSViewHeightSizable];
- [chromeContentView_ addSubview:tabContentArea_];
+ [[[self window] contentView] addSubview:tabContentArea_];
- tabStripView_.reset([[TabStripView alloc]
- initWithFrame:NSMakeRect(0, 0, kDefaultWidth, 37)]);
+ tabStripView_.reset([[TabStripView alloc] initWithFrame:
+ NSMakeRect(0, 0, 750, 37)]);
[tabStripView_ setAutoresizingMask:NSViewWidthSizable |
NSViewMinYMargin];
if (hasTabStrip)
@@ -90,10 +81,6 @@
return tabContentArea_;
}
-- (NSView*)chromeContentView {
- return chromeContentView_;
-}
-
// Add the top tab strop to the window, above the content box and add it to the
// view hierarchy as a sibling of the content view so it can overlap with the
// window frame.
@@ -140,7 +127,7 @@
[overlayWindow_ setOpaque:NO];
[overlayWindow_ setDelegate:self];
- originalContentView_ = self.chromeContentView;
+ originalContentView_ = [window contentView];
[window addChildWindow:overlayWindow_ ordered:NSWindowAbove];
// Explicitly set the responder to be nil here (for restoring later).
@@ -166,10 +153,7 @@
// places. The TabStripView always needs to be in front of the window's
// content view and therefore it should always be added after the content
// view is set.
- [[window contentView] addSubview:originalContentView_
- positioned:NSWindowBelow
- relativeTo:nil];
- originalContentView_.frame = [[window contentView] bounds];
+ [window setContentView:originalContentView_];
[[window cr_windowView] addSubview:[self tabStripView]];
[[window cr_windowView] updateTrackingAreas];
diff --git a/chrome/browser/ui/cocoa/version_independent_window.mm b/chrome/browser/ui/cocoa/version_independent_window.mm
index 98dacb3..24284a4 100644
--- a/chrome/browser/ui/cocoa/version_independent_window.mm
+++ b/chrome/browser/ui/cocoa/version_independent_window.mm
@@ -32,6 +32,12 @@
[super setFrameSize:size];
}
+// The contentView gets moved around during certain full-screen operations.
+// This is less than ideal, and should eventually be removed.
+- (void)viewDidMoveToSuperview {
+ [self setFrame:[[self superview] bounds]];
+}
+
@end
@implementation NSWindow (VersionIndependentWindow)
@@ -73,8 +79,8 @@
chromeWindowView_.reset([[FullSizeContentView alloc] init]);
[chromeWindowView_
setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
- [self setContentView:chromeWindowView_];
[chromeWindowView_ setFrame:[[[self contentView] superview] bounds]];
+ [self setContentView:chromeWindowView_];
}
}
return self;