From 467f5af7bab96186f0f48562a50bcf70d210fb7f Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Fri, 26 Apr 2019 17:26:14 +0000 Subject: [PATCH] Bug 1533562 - Remove code that deals with non-rounded bottom corners on regular windows. r=spohl Rounded bottom corners have been the default since 10.7. Differential Revision: https://phabricator.services.mozilla.com/D22643 --HG-- extra : moz-landing-system : lando --- widget/cocoa/nsChildView.h | 1 - widget/cocoa/nsChildView.mm | 18 ++++-------------- widget/cocoa/nsCocoaWindow.h | 7 ------- widget/cocoa/nsCocoaWindow.mm | 5 ----- 4 files changed, 4 insertions(+), 27 deletions(-) diff --git a/widget/cocoa/nsChildView.h b/widget/cocoa/nsChildView.h index d30e8634d590..270b3790f599 100644 --- a/widget/cocoa/nsChildView.h +++ b/widget/cocoa/nsChildView.h @@ -601,7 +601,6 @@ class nsChildView final : public nsBaseWidget { // by mEffectsLock. bool mShowsResizeIndicator; LayoutDeviceIntRect mResizeIndicatorRect; - bool mHasRoundedBottomCorners; int mDevPixelCornerRadius; bool mIsCoveringTitlebar; bool mIsFullscreen; diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index cd0cd80a0019..d531b31a8e84 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -186,7 +186,6 @@ static NSMutableDictionary* sNativeKeyEventsMap = [NSMutableDictionary dictionar - (LayoutDeviceIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect; - (BOOL)isUsingOpenGL; -- (BOOL)hasRoundedBottomCorners; - (CGFloat)cornerRadius; - (void)clearCorners; @@ -324,7 +323,6 @@ nsChildView::nsChildView() mViewTearDownLock("ChildViewTearDown"), mEffectsLock("WidgetEffects"), mShowsResizeIndicator(false), - mHasRoundedBottomCorners(false), mDevPixelCornerRadius{0}, mIsCoveringTitlebar(false), mIsFullscreen(false), @@ -1741,7 +1739,6 @@ void nsChildView::PrepareWindowEffects() { { MutexAutoLock lock(mEffectsLock); mShowsResizeIndicator = ShowsResizeIndicator(&mResizeIndicatorRect); - mHasRoundedBottomCorners = [mView hasRoundedBottomCorners]; CGFloat cornerRadius = [mView cornerRadius]; mDevPixelCornerRadius = cornerRadius * BackingScaleFactor(); mIsCoveringTitlebar = [mView isCoveringTitlebar]; @@ -2134,7 +2131,7 @@ void nsChildView::MaybeDrawRoundedCorners(GLManager* aManager, const LayoutDevic mCornerMaskImage->Draw(aManager, aRect.TopRight(), flipX); } - if (mHasRoundedBottomCorners && !mIsFullscreen) { + if (!mIsFullscreen) { // Mask the bottom corners. mCornerMaskImage->Draw(aManager, aRect.BottomLeft(), flipY); mCornerMaskImage->Draw(aManager, aRect.BottomRight(), flipY * flipX); @@ -3342,11 +3339,6 @@ NSEvent* gLastDragMouseDownEvent = nil; return mGLContext || mUsingOMTCompositor; } -- (BOOL)hasRoundedBottomCorners { - return [[self window] respondsToSelector:@selector(bottomCornerRounded)] && - [[self window] bottomCornerRounded]; -} - - (CGFloat)cornerRadius { NSView* frameView = [[[self window] contentView] superview]; if (!frameView || ![frameView respondsToSelector:@selector(roundedCornerRadius)]) return 4.0f; @@ -3389,15 +3381,13 @@ NSEvent* gLastDragMouseDownEvent = nil; NSRectFill(NSMakeRect(w - radius, 0, radius, radius)); } - if ([self hasRoundedBottomCorners]) { - NSRectFill(NSMakeRect(0, h - radius, radius, radius)); - NSRectFill(NSMakeRect(w - radius, h - radius, radius, radius)); - } + NSRectFill(NSMakeRect(0, h - radius, radius, radius)); + NSRectFill(NSMakeRect(w - radius, h - radius, radius, radius)); } // This is the analog of nsChildView::MaybeDrawRoundedCorners for CGContexts. // We only need to mask the top corners here because Cocoa does the masking -// for the window's bottom corners automatically (starting with 10.7). +// for the window's bottom corners automatically. - (void)maskTopCornersInContext:(CGContextRef)aContext { CGFloat radius = [self cornerRadius]; int32_t devPixelCornerRadius = mGeckoChild->CocoaPointsToDevPixels(radius); diff --git a/widget/cocoa/nsCocoaWindow.h b/widget/cocoa/nsCocoaWindow.h index ad4327b1acc6..3b76d4132b7d 100644 --- a/widget/cocoa/nsCocoaWindow.h +++ b/widget/cocoa/nsCocoaWindow.h @@ -99,13 +99,6 @@ typedef struct _nsCocoaWindowList { // original value. - (void)_setWindowNumber:(NSInteger)aNumber; -// If we set the window's stylemask to be textured, the corners on the bottom of -// the window are rounded by default. We use this private method to make -// the corners square again, a la Safari. Starting with 10.7, all windows have -// rounded bottom corners, so this call doesn't have any effect there. -- (void)setBottomCornerRounded:(BOOL)rounded; -- (BOOL)bottomCornerRounded; - // Present in the same form on OS X since at least OS X 10.5. - (NSRect)contentRectForFrameRect:(NSRect)windowFrame styleMask:(NSUInteger)windowStyle; - (NSRect)frameRectForContentRect:(NSRect)windowContentRect styleMask:(NSUInteger)windowStyle; diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm index 4a087860a69f..a0f5e09c1586 100644 --- a/widget/cocoa/nsCocoaWindow.mm +++ b/widget/cocoa/nsCocoaWindow.mm @@ -3170,11 +3170,6 @@ static const NSString* kStateCollectionBehavior = @"collectionBehavior"; mSheetAttachmentPosition = aContentRect.size.height; mWindowButtonsRect = NSZeroRect; mFullScreenButtonRect = NSZeroRect; - - // setBottomCornerRounded: is a private API call, so we check to make sure - // we respond to it just in case. - if ([self respondsToSelector:@selector(setBottomCornerRounded:)]) - [self setBottomCornerRounded:YES]; } return self;