Revert of mac: [Yosemite] Fix bug where zoom button causes fullscreen mode....

Revert of mac: [Yosemite] Fix bug where zoom button causes fullscreen mode. (https://codereview.chromium.org/402443003/)

Reason for revert:
Broke Mac ASan 64 Builder
http://build.chromium.org/p/chromium.memory/builders/Mac%20ASan%2064%20Builder/builds/7520

obj/chrome/browser/ui/cocoa/browser_ui.version_independent_window.o
../../chrome/browser/ui/cocoa/version_independent_window.mm:109:44:error: cannot initialize a parameter of type 'NSComparisonResult (*)(id, id, void *)' with an rvalue of type 'int (*)(id, id, void *)': different return type ('NSComparisonResult' (aka 'long') vs 'int')
      [superview sortSubviewsUsingFunction:&ReorderContentViewToBack
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSView.h:175:75: note: passing argument to parameter 'compare' here
- (void)sortSubviewsUsingFunction:(NSComparisonResult (*)(id, id, void *))compare context:(void *)context;


Original issue's description:
> mac: [Yosemite] Fix bug where zoom button causes fullscreen mode.
> 
> In Yosemite, holding down alt while clicking the fullscreen button is supposed
> to zoom the window. This doesn't work because Chrome violates unstated AppKit
> assumptions.
> 
> The problem seems to lie in hit testing the location of the zoom button.
> Reordering the subviews by moving the tab strip and the content view behind the
> zoom button fixes the problem.
> 
> BUG=393808
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=284544

TBR=andresantoso@chromium.org,shess@chromium.org,erikchen@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=393808

Review URL: https://codereview.chromium.org/402323002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284576 0039d316-1c4b-4281-b951-d872f2087c98
parent d87b387c
...@@ -6,33 +6,6 @@ ...@@ -6,33 +6,6 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/mac/mac_util.h" #include "base/mac/mac_util.h"
#include "base/mac/scoped_nsobject.h"
// This view always takes the size of its superview. It is intended to be used
// as a NSWindow's contentView. It is needed because NSWindow's implementation
// explicitly resizes the contentView at inopportune times.
@interface FullSizeContentView : NSView
@end
namespace {
// Reorders the subviews of NSWindow's root view so that the contentView is
// moved to the back, and the ordering of the other views is unchanged.
// |context| should be an NSArray containing the subviews of the root view as
// they were previously ordered.
int ReorderContentViewToBack(id firstView, id secondView, void* context) {
NSView* contentView = [[firstView window] contentView];
NSArray* subviews = static_cast<NSArray*>(context);
if (firstView == contentView)
return NSOrderedAscending;
if (secondView == contentView)
return NSOrderedDescending;
NSUInteger index1 = [subviews indexOfObject:firstView];
NSUInteger index2 = [subviews indexOfObject:secondView];
return (index1 < index2) ? NSOrderedAscending : NSOrderedDescending;
}
} // namespace
@interface VersionIndependentWindow () @interface VersionIndependentWindow ()
...@@ -42,6 +15,12 @@ int ReorderContentViewToBack(id firstView, id secondView, void* context) { ...@@ -42,6 +15,12 @@ int ReorderContentViewToBack(id firstView, id secondView, void* context) {
@end @end
// This view always takes the size of its superview. It is intended to be used
// as a NSWindow's contentView. It is needed because NSWindow's implementation
// explicitly resizes the contentView at inopportune times.
@interface FullSizeContentView : NSView
@end
@implementation FullSizeContentView @implementation FullSizeContentView
// This method is directly called by NSWindow during a window resize on OSX // This method is directly called by NSWindow during a window resize on OSX
...@@ -96,18 +75,6 @@ int ReorderContentViewToBack(id firstView, id secondView, void* context) { ...@@ -96,18 +75,6 @@ int ReorderContentViewToBack(id firstView, id secondView, void* context) {
setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[self setContentView:chromeWindowView_]; [self setContentView:chromeWindowView_];
[chromeWindowView_ setFrame:[[[self contentView] superview] bounds]]; [chromeWindowView_ setFrame:[[[self contentView] superview] bounds]];
// Move the content view to the back.
// In Yosemite, the content view takes up the full size of the window,
// and when it is in front of the zoom/fullscreen button, alt-clicking
// the button has the wrong effect.
// Adding subviews to the NSThemeFrame provokes a warning in Yosemite, so
// we sort the subviews in place.
// http://crbug.com/393808
NSView* superview = [[self contentView] superview];
base::scoped_nsobject<NSArray> subviews([[superview subviews] copy]);
[superview sortSubviewsUsingFunction:&ReorderContentViewToBack
context:subviews.get()];
} }
} }
return self; return self;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment