Bug 1533562 - Remove code that deals with non-rounded bottom corners on regular windows. r=spohl
☠☠ backed out by 73e8dcb8be07 ☠ ☠
authorMarkus Stange <mstange@themasta.com>
Mon, 22 Apr 2019 19:26:15 +0000
changeset 470391 5fae2f233aa03481685694cfa013c9b4d50d5608
parent 470390 e3fc54ebcd15b682f7f9117c86a0d049fc28c6b0
child 470392 3a3b4d52e10a17f947717e0e468665d2bdcfb57e
push id35905
push userdvarga@mozilla.com
push dateTue, 23 Apr 2019 09:53:27 +0000
treeherdermozilla-central@831918f009f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspohl
bugs1533562
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/cocoa/nsCocoaWindow.h
widget/cocoa/nsCocoaWindow.mm
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -596,17 +596,16 @@ class nsChildView final : public nsBaseW
   mozilla::Mutex mViewTearDownLock;
 
   mozilla::Mutex mEffectsLock;
 
   // May be accessed from any thread, protected
   // by mEffectsLock.
   bool mShowsResizeIndicator;
   LayoutDeviceIntRect mResizeIndicatorRect;
-  bool mHasRoundedBottomCorners;
   int mDevPixelCornerRadius;
   bool mIsCoveringTitlebar;
   bool mIsFullscreen;
   bool mIsOpaque;
   LayoutDeviceIntRect mTitlebarRect;
 
   // The area of mTitlebarCGContext that needs to be redrawn during the next
   // transaction. Accessed from any thread, protected by mEffectsLock.
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -181,17 +181,16 @@ static NSMutableDictionary* sNativeKeyEv
                           toGeckoEvent:(WidgetMouseEvent*)outGeckoEvent;
 - (NSMenu*)contextMenu;
 
 - (BOOL)isRectObscuredBySubview:(NSRect)inRect;
 
 - (LayoutDeviceIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect;
 - (BOOL)isUsingOpenGL;
 
-- (BOOL)hasRoundedBottomCorners;
 - (CGFloat)cornerRadius;
 - (void)clearCorners;
 
 - (void)setGLOpaque:(BOOL)aOpaque;
 
 // Overlay drawing functions for traditional CGContext drawing
 - (void)drawTitleString;
 - (void)maskTopCornersInContext:(CGContextRef)aContext;
@@ -319,17 +318,16 @@ struct SwipeEventQueue {
 nsChildView::nsChildView()
     : nsBaseWidget(),
       mView(nullptr),
       mParentView(nil),
       mParentWidget(nullptr),
       mViewTearDownLock("ChildViewTearDown"),
       mEffectsLock("WidgetEffects"),
       mShowsResizeIndicator(false),
-      mHasRoundedBottomCorners(false),
       mDevPixelCornerRadius{0},
       mIsCoveringTitlebar(false),
       mIsFullscreen(false),
       mIsOpaque(false),
       mTitlebarCGContext(nullptr),
       mBackingScaleFactor(0.0),
       mVisible(false),
       mDrawing(false),
@@ -1736,17 +1734,16 @@ LayoutDeviceIntRect nsChildView::RectCon
 
 void nsChildView::PrepareWindowEffects() {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   bool canBeOpaque;
   {
     MutexAutoLock lock(mEffectsLock);
     mShowsResizeIndicator = ShowsResizeIndicator(&mResizeIndicatorRect);
-    mHasRoundedBottomCorners = [mView hasRoundedBottomCorners];
     CGFloat cornerRadius = [mView cornerRadius];
     mDevPixelCornerRadius = cornerRadius * BackingScaleFactor();
     mIsCoveringTitlebar = [mView isCoveringTitlebar];
     NSInteger styleMask = [[mView window] styleMask];
     bool wasFullscreen = mIsFullscreen;
     nsCocoaWindow* windowWidget = GetXULWindowWidget();
     mIsFullscreen =
         (styleMask & NSFullScreenWindowMask) || (windowWidget && windowWidget->InFullScreenMode());
@@ -2129,17 +2126,17 @@ void nsChildView::MaybeDrawRoundedCorner
   Matrix4x4 flipY = Matrix4x4::Scaling(1, -1, 1);
 
   if (mIsCoveringTitlebar && !mIsFullscreen) {
     // Mask the top corners.
     mCornerMaskImage->Draw(aManager, aRect.TopLeft());
     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);
   }
 
   // Reset blend mode.
   aManager->gl()->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA, LOCAL_GL_ONE,
                                      LOCAL_GL_ONE);
@@ -3337,21 +3334,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
 }
 
 - (BOOL)isUsingOpenGL {
   if (!mGeckoChild || ![self window]) return NO;
 
   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;
   return [frameView roundedCornerRadius];
 }
 
 - (void)setGLOpaque:(BOOL)aOpaque {
   CGLLockContext((CGLContextObj)[mGLContext CGLContextObj]);
@@ -3384,25 +3376,23 @@ NSEvent* gLastDragMouseDownEvent = nil;
   CGFloat w = [self bounds].size.width, h = [self bounds].size.height;
   [[NSColor clearColor] set];
 
   if ([self isCoveringTitlebar]) {
     NSRectFill(NSMakeRect(0, 0, radius, radius));
     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);
 
   // First make sure that mTopLeftCornerMask is set up.
   if (!mTopLeftCornerMask || int32_t(CGImageGetWidth(mTopLeftCornerMask)) != devPixelCornerRadius) {
     CGImageRelease(mTopLeftCornerMask);
     CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
--- a/widget/cocoa/nsCocoaWindow.h
+++ b/widget/cocoa/nsCocoaWindow.h
@@ -94,23 +94,16 @@ typedef struct _nsCocoaWindowList {
 
 // If a window has been explicitly removed from the "window cache" (to
 // deactivate it), it's sometimes necessary to "reset" it to reactivate it
 // (and put it back in the "window cache").  One way to do this, which Apple
 // often uses, is to set the "window number" to '-1' and then back to its
 // 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;
 
 // Present since at least OS X 10.5.  The OS calls this method on NSWindow
 // (and its subclasses) to find out which NSFrameView subclass to instantiate
 // to create its "frame view".
 + (Class)frameViewClassForStyleMask:(NSUInteger)styleMask;
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -3165,21 +3165,16 @@ static const NSString* kStateCollectionB
   if ((self = [super initWithContentRect:aContentRect
                                styleMask:aStyle
                                  backing:aBufferingType
                                    defer:aFlag])) {
     mUnifiedToolbarHeight = 22.0f;
     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;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 - (void)setTitlebarNeedsDisplay {
   NSRect rect = [self titlebarRect];