mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 10:15:41 +00:00
Bug 1533562 - Do not move the TitlebarGradientView from a ToolbarWindow into a BorderlessWindow when hiding the window chrome. r=spohl
Differential Revision: https://phabricator.services.mozilla.com/D25516 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
537ff00f68
commit
de6910917a
@ -78,6 +78,15 @@ typedef struct _nsCocoaWindowList {
|
|||||||
- (BOOL)isBeingShown;
|
- (BOOL)isBeingShown;
|
||||||
- (BOOL)isVisibleOrBeingShown;
|
- (BOOL)isVisibleOrBeingShown;
|
||||||
|
|
||||||
|
// Returns an autoreleased NSArray containing the NSViews that we consider the
|
||||||
|
// "contents" of this window. All views in the returned array are subviews of
|
||||||
|
// this window's content view. However, the array may not include all of the
|
||||||
|
// content view's subviews; concretely, the ToolbarWindow implementation will
|
||||||
|
// exclude its TitlebarGradientView from the array that is returned here.
|
||||||
|
// In the vast majority of cases, the array will only have a single element:
|
||||||
|
// this window's mainChildView.
|
||||||
|
- (NSArray<NSView*>*)contentViewContents;
|
||||||
|
|
||||||
- (ChildView*)mainChildView;
|
- (ChildView*)mainChildView;
|
||||||
|
|
||||||
- (NSArray*)titlebarControls;
|
- (NSArray*)titlebarControls;
|
||||||
|
@ -1209,10 +1209,12 @@ void nsCocoaWindow::HideWindowChrome(bool aShouldHide) {
|
|||||||
[mWindow removeChildWindow:child];
|
[mWindow removeChildWindow:child];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the content view.
|
// Remove the views in the old window's content view.
|
||||||
NSView* contentView = [mWindow contentView];
|
// The NSArray is autoreleased and retains its NSViews.
|
||||||
[contentView retain];
|
NSArray<NSView*>* contentViewContents = [mWindow contentViewContents];
|
||||||
[contentView removeFromSuperviewWithoutNeedingDisplay];
|
for (NSView* view in contentViewContents) {
|
||||||
|
[view removeFromSuperviewWithoutNeedingDisplay];
|
||||||
|
}
|
||||||
|
|
||||||
// Save state (like window title).
|
// Save state (like window title).
|
||||||
NSMutableDictionary* state = [mWindow exportState];
|
NSMutableDictionary* state = [mWindow exportState];
|
||||||
@ -1226,9 +1228,10 @@ void nsCocoaWindow::HideWindowChrome(bool aShouldHide) {
|
|||||||
// Re-import state.
|
// Re-import state.
|
||||||
[mWindow importState:state];
|
[mWindow importState:state];
|
||||||
|
|
||||||
// Reparent the content view.
|
// Add the old content view subviews to the new window's content view.
|
||||||
[mWindow setContentView:contentView];
|
for (NSView* view in contentViewContents) {
|
||||||
[contentView release];
|
[[mWindow contentView] addSubview:view];
|
||||||
|
}
|
||||||
|
|
||||||
// Reparent child windows.
|
// Reparent child windows.
|
||||||
enumerator = [childWindows objectEnumerator];
|
enumerator = [childWindows objectEnumerator];
|
||||||
@ -2906,6 +2909,10 @@ static const NSString* kStateCollectionBehavior = @"collectionBehavior";
|
|||||||
return [contentView superview] ? [contentView superview] : contentView;
|
return [contentView superview] ? [contentView superview] : contentView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray<NSView*>*)contentViewContents {
|
||||||
|
return [[[[self contentView] subviews] copy] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
- (ChildView*)mainChildView {
|
- (ChildView*)mainChildView {
|
||||||
NSView* contentView = [self contentView];
|
NSView* contentView = [self contentView];
|
||||||
NSView* lastView = [[contentView subviews] lastObject];
|
NSView* lastView = [[contentView subviews] lastObject];
|
||||||
@ -3137,10 +3144,6 @@ static const NSString* kStateCollectionBehavior = @"collectionBehavior";
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)mouseDownCanMoveWindow {
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSView*)hitTest:(NSPoint)aPoint {
|
- (NSView*)hitTest:(NSPoint)aPoint {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
@ -3212,6 +3215,15 @@ static const NSString* kStateCollectionBehavior = @"collectionBehavior";
|
|||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray<NSView*>*)contentViewContents {
|
||||||
|
NSMutableArray<NSView*>* contents = [[[self contentView] subviews] mutableCopy];
|
||||||
|
if (mTitlebarGradientView) {
|
||||||
|
// Do not include the titlebar gradient view in the returned array.
|
||||||
|
[contents removeObject:mTitlebarGradientView];
|
||||||
|
}
|
||||||
|
return [contents autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)updateTitlebarGradientViewPresence {
|
- (void)updateTitlebarGradientViewPresence {
|
||||||
BOOL needTitlebarView = ![self drawsContentsIntoWindowFrame];
|
BOOL needTitlebarView = ![self drawsContentsIntoWindowFrame];
|
||||||
if (needTitlebarView && !mTitlebarGradientView) {
|
if (needTitlebarView && !mTitlebarGradientView) {
|
||||||
|
Loading…
Reference in New Issue
Block a user