diff options
author | erikchen@chromium.org <erikchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-29 01:26:19 +0000 |
---|---|---|
committer | erikchen@chromium.org <erikchen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-29 01:26:19 +0000 |
commit | c30ef061ae85307b3668e2b4502d36c39e5dabc9 (patch) | |
tree | 00b0193709090228bb35e96ea855b2879af6bc46 | |
parent | 71c5d596e5ed3416e0a08a3070e469df6b9d99de (diff) | |
download | chromium_src-c30ef061ae85307b3668e2b4502d36c39e5dabc9.zip chromium_src-c30ef061ae85307b3668e2b4502d36c39e5dabc9.tar.gz chromium_src-c30ef061ae85307b3668e2b4502d36c39e5dabc9.tar.bz2 |
Revert of mac: Toolbar renders incorrectly when downloads bar is open. (https://codereview.chromium.org/419683008/)
Reason for revert:
NSInvalidArgumentException reason Unlocking Focus on wrong view (<NSView: 0x#>), expected <FastResizeView: 0x#>
https://code.google.com/p/chromium/issues/detail?id=397089
Original issue's description:
> mac: Toolbar renders incorrectly when downloads bar is open.
>
> The toolbar's superview chromeContentView was incorrectly sized and was too
> small. This happened because chromeContentView's layout was not being updated
> in -[BrowserWindowController layoutSubviews].
>
> I updated the unit tests in browser_window_controller_unittest.mm with 2 changes:
> - All layout checking should use window coordinates, to ensure consistency.
> - Layout checking should ensure that the frame of each view is within the
> bounds of the superview.
>
> BUG=396740
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=285796
TBR=shess@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=396740
Review URL: https://codereview.chromium.org/425853007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286042 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/ui/cocoa/browser_window_controller_private.mm | 8 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/browser_window_controller_unittest.mm | 59 |
2 files changed, 8 insertions, 59 deletions
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm index 6a6a4f0..9b0aa21 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm @@ -185,14 +185,6 @@ willPositionSheet:(NSWindow*)sheet NSWindow* window = [self window]; NSView* contentView = [window contentView]; NSRect contentBounds = [contentView bounds]; - - // Lay out the chromeContentView. - NSView* chromeContentView = [self chromeContentView]; - BOOL autoresizesSubviews = [chromeContentView autoresizesSubviews]; - [chromeContentView setAutoresizesSubviews:NO]; - [chromeContentView setFrame:contentBounds]; - [chromeContentView setAutoresizesSubviews:autoresizesSubviews]; - CGFloat minX = NSMinX(contentBounds); CGFloat minY = NSMinY(contentBounds); CGFloat width = NSWidth(contentBounds); diff --git a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm index 67f5e71..269fa15 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm @@ -20,7 +20,6 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" -#import "chrome/browser/ui/cocoa/fast_resize_view.h" #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" #import "chrome/browser/ui/cocoa/nsview_additions.h" #include "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" @@ -243,61 +242,19 @@ TEST_F(BrowserWindowControllerTest, TestIncognitoWidthSpace) { namespace { -// Returns the frame of the view in window coordinates. -NSRect FrameInWindowForView(NSView* view) { - return [[view superview] convertRect:[view frame] toView:nil]; -} - -// Whether the view's frame is within the bounds of the superview. -BOOL ViewContainmentValid(NSView* view) { - if (NSIsEmptyRect([view frame])) - return true; - - return NSContainsRect([[view superview] bounds], [view frame]); -} - -// Checks the view hierarchy rooted at |view| to ensure that each view is -// properly contained. -BOOL ViewHierarchyContainmentValid(NSView* view) { - // TODO(erikchen): Fix these views to have correct containment. - // http://crbug.com/397665. - if ([view isKindOfClass:NSClassFromString(@"DownloadShelfView")]) - return YES; - if ([view isKindOfClass:NSClassFromString(@"BookmarkBarToolbarView")]) - return YES; - if ([view isKindOfClass:NSClassFromString(@"BrowserActionsContainerView")]) - return YES; - - if (!ViewContainmentValid(view)) { - LOG(ERROR) << "View violates containment: " << - [[view description] UTF8String]; - return false; - } - - for (NSView* subview in [view subviews]) { - BOOL result = ViewHierarchyContainmentValid(subview); - if (!result) - return false; - } - - return true; -} - // Verifies that the toolbar, infobar, tab content area, and download shelf // completely fill the area under the tabstrip. void CheckViewPositions(BrowserWindowController* controller) { - EXPECT_TRUE(ViewHierarchyContainmentValid([[controller window] contentView])); - - NSRect contentView = FrameInWindowForView([[controller window] contentView]); - NSRect tabstrip = FrameInWindowForView([controller tabStripView]); - NSRect toolbar = FrameInWindowForView([controller toolbarView]); - NSRect infobar = FrameInWindowForView([controller infoBarContainerView]); - NSRect tabContent = FrameInWindowForView([controller tabContentArea]); - NSRect download = FrameInWindowForView([[controller downloadShelf] view]); + NSRect contentView = [[[controller window] contentView] bounds]; + NSRect tabstrip = [[controller tabStripView] frame]; + NSRect toolbar = [[controller toolbarView] frame]; + NSRect infobar = [[controller infoBarContainerView] frame]; + NSRect contentArea = [[controller tabContentArea] frame]; + NSRect download = [[[controller downloadShelf] view] frame]; EXPECT_EQ(NSMinY(contentView), NSMinY(download)); - EXPECT_EQ(NSMaxY(download), NSMinY(tabContent)); - EXPECT_EQ(NSMaxY(tabContent), NSMinY(infobar)); + EXPECT_EQ(NSMaxY(download), NSMinY(contentArea)); + EXPECT_EQ(NSMaxY(contentArea), NSMinY(infobar)); // Bookmark bar frame is random memory when hidden. if ([controller bookmarkBarVisible]) { |