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
authorMarkus Stange <mstange@themasta.com>
Mon, 29 Apr 2019 16:59:10 +0000
changeset 530644 ffbfe4a683f6fc5a2a89fa86e9d992f4c4e00f22
parent 530643 31c0dbb08e0c5bc4e9dbc46bca1c7d44bc9331e6
child 530645 19d8e4a62f4d677541e7e3c71aa3d3ed607f97db
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [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;