Bug 1533562 - Remove synchronous repaint capability of setTitlebarNeedsDisplayInRect:sync: and also remove the rect parameter because we always pass the same value to it. r=spohl
☠☠ backed out by 73e8dcb8be07 ☠ ☠
authorMarkus Stange <mstange@themasta.com>
Mon, 22 Apr 2019 19:26:00 +0000
changeset 470390 e3fc54ebcd15b682f7f9117c86a0d049fc28c6b0
parent 470389 74eb8e5f7143ed073a993df7a3abdce04b58f830
child 470391 5fae2f233aa03481685694cfa013c9b4d50d5608
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 synchronous repaint capability of setTitlebarNeedsDisplayInRect:sync: and also remove the rect parameter because we always pass the same value to it. r=spohl The synchronous paint was only needed a long time ago when we were calling this method during drawRect. We're not doing that any more, we usually call it from viewWillDraw now. But even at the time, forcing a synchronous paint *within* a paint was extremely sketchy, so best just to remove the code. Differential Revision: https://phabricator.services.mozilla.com/D22642
widget/cocoa/nsCocoaWindow.h
widget/cocoa/nsCocoaWindow.mm
--- a/widget/cocoa/nsCocoaWindow.h
+++ b/widget/cocoa/nsCocoaWindow.h
@@ -165,18 +165,17 @@ typedef struct _nsCocoaWindowList {
   CGFloat mSheetAttachmentPosition;
   NSRect mWindowButtonsRect;
   NSRect mFullScreenButtonRect;
 }
 - (void)setUnifiedToolbarHeight:(CGFloat)aHeight;
 - (CGFloat)unifiedToolbarHeight;
 - (CGFloat)titlebarHeight;
 - (NSRect)titlebarRect;
-- (void)setTitlebarNeedsDisplayInRect:(NSRect)aRect sync:(BOOL)aSync;
-- (void)setTitlebarNeedsDisplayInRect:(NSRect)aRect;
+- (void)setTitlebarNeedsDisplay;
 - (void)setDrawsContentsIntoWindowFrame:(BOOL)aState;
 - (void)setSheetAttachmentPosition:(CGFloat)aY;
 - (CGFloat)sheetAttachmentPosition;
 - (void)placeWindowButtons:(NSRect)aRect;
 - (void)placeFullScreenButton:(NSRect)aRect;
 - (NSPoint)windowButtonsPositionWithDefaultPosition:(NSPoint)aDefaultPosition;
 - (NSPoint)fullScreenButtonPositionWithDefaultPosition:(NSPoint)aDefaultPosition;
 @end
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -3176,33 +3176,24 @@ static const NSString* kStateCollectionB
     if ([self respondsToSelector:@selector(setBottomCornerRounded:)])
       [self setBottomCornerRounded:YES];
   }
   return self;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (void)setTitlebarNeedsDisplayInRect:(NSRect)aRect {
-  [self setTitlebarNeedsDisplayInRect:aRect sync:NO];
-}
-
-- (void)setTitlebarNeedsDisplayInRect:(NSRect)aRect sync:(BOOL)aSync {
-  NSRect titlebarRect = [self titlebarRect];
-  NSRect rect = NSIntersectionRect(titlebarRect, aRect);
+- (void)setTitlebarNeedsDisplay {
+  NSRect rect = [self titlebarRect];
   if (NSIsEmptyRect(rect)) return;
 
   NSView* borderView = [[self contentView] superview];
   if (!borderView) return;
 
-  if (aSync) {
-    [borderView displayRect:rect];
-  } else {
-    [borderView setNeedsDisplayInRect:rect];
-  }
+  [borderView setNeedsDisplayInRect:rect];
 }
 
 - (NSRect)titlebarRect {
   CGFloat titlebarHeight = [self titlebarHeight];
   return NSMakeRect(0, [self frame].size.height - titlebarHeight, [self frame].size.width,
                     titlebarHeight);
 }
 
@@ -3223,20 +3214,17 @@ static const NSString* kStateCollectionB
 
 // Stores the complete height of titlebar + toolbar.
 - (void)setUnifiedToolbarHeight:(CGFloat)aHeight {
   if (aHeight == mUnifiedToolbarHeight) return;
 
   mUnifiedToolbarHeight = aHeight;
 
   if (![self drawsContentsIntoWindowFrame]) {
-    // Redraw the title bar. If we're inside painting, we'll do it right now,
-    // otherwise we'll just invalidate it.
-    BOOL needSyncRedraw = ([NSView focusView] != nil);
-    [self setTitlebarNeedsDisplayInRect:[self titlebarRect] sync:needSyncRedraw];
+    [self setTitlebarNeedsDisplay];
   }
 }
 
 // Extending the content area into the title bar works by resizing the
 // mainChildView so that it covers the titlebar.
 - (void)setDrawsContentsIntoWindowFrame:(BOOL)aState {
   BOOL stateChanged = ([self drawsContentsIntoWindowFrame] != aState);
   [super setDrawsContentsIntoWindowFrame:aState];
@@ -3258,17 +3246,17 @@ static const NSString* kStateCollectionB
     // content area, so that event would have wrong position information. So
     // we'll send a mouse move event with the correct new position.
     ChildViewMouseTracker::ResendLastMouseMoveEvent();
   }
 }
 
 - (void)setWantsTitleDrawn:(BOOL)aDrawTitle {
   [super setWantsTitleDrawn:aDrawTitle];
-  [self setTitlebarNeedsDisplayInRect:[self titlebarRect]];
+  [self setTitlebarNeedsDisplay];
 }
 
 - (void)setSheetAttachmentPosition:(CGFloat)aY {
   mSheetAttachmentPosition = aY;
 }
 
 - (CGFloat)sheetAttachmentPosition {
   return mSheetAttachmentPosition;