Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1291457 - Remove shadow invalidation code. r=spohl
Browse files Browse the repository at this point in the history
Invalidating a window's shadow is really slow and leads to flickering. Now that
arrow panels don't change their contents during the panel opening animation any
more, their shape stays the same after the first paint, so we don't need the
shadow invalidation functionality for them any more. And as far as I know, we
don't use transparent popups with changing shapes anywhere else.
The system still computes the shadow for the first paint of the window (which
happens during the orderFront call), and it updates the shadow whenever the
window resizes. But not when its size stays the same and only what we draw in
the content is updated.

MozReview-Commit-ID: 138PjbrSFrc
  • Loading branch information
mstange committed Aug 2, 2016
1 parent 73bc946 commit 0590082
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 27 deletions.
6 changes: 0 additions & 6 deletions widget/cocoa/nsChildView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3767,12 +3767,6 @@ - (void)drawRect:(NSRect)aRect
{
CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
[self drawRect:aRect inContext:cgContext];

// If we're a transparent window and our contents have changed, we need
// to make sure the shadow is updated to the new contents.
if ([[self window] isKindOfClass:[BaseWindow class]]) {
[(BaseWindow*)[self window] deferredInvalidateShadow];
}
}

- (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext
Expand Down
5 changes: 0 additions & 5 deletions widget/cocoa/nsCocoaWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ typedef struct _nsCocoaWindowList {
NSColor* mActiveTitlebarColor;
NSColor* mInactiveTitlebarColor;

// Shadow
BOOL mScheduledShadowInvalidation;

// Invalidation disabling
BOOL mDisabledNeedsDisplay;

Expand All @@ -69,8 +66,6 @@ typedef struct _nsCocoaWindowList {
- (void)setTitlebarColor:(NSColor*)aColor forActiveWindow:(BOOL)aActive;
- (NSColor*)titlebarColorForActiveWindow:(BOOL)aActive;

- (void)deferredInvalidateShadow;
- (void)invalidateShadow;
- (float)getDPI;

- (void)mouseEntered:(NSEvent*)aEvent;
Expand Down
16 changes: 0 additions & 16 deletions widget/cocoa/nsCocoaWindow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3000,7 +3000,6 @@ - (id)initWithContentRect:(NSRect)aContentRect styleMask:(NSUInteger)aStyle back
mState = nil;
mActiveTitlebarColor = nil;
mInactiveTitlebarColor = nil;
mScheduledShadowInvalidation = NO;
mDisabledNeedsDisplay = NO;
mDPI = GetDPI(self);
mTrackingArea = nil;
Expand Down Expand Up @@ -3150,21 +3149,6 @@ - (NSColor*)titlebarColorForActiveWindow:(BOOL)aActive
return aActive ? mActiveTitlebarColor : mInactiveTitlebarColor;
}

- (void)deferredInvalidateShadow
{
if (mScheduledShadowInvalidation || [self isOpaque] || ![self hasShadow])
return;

[self performSelector:@selector(invalidateShadow) withObject:nil afterDelay:0];
mScheduledShadowInvalidation = YES;
}

- (void)invalidateShadow
{
[super invalidateShadow];
mScheduledShadowInvalidation = NO;
}

- (float)getDPI
{
return mDPI;
Expand Down

0 comments on commit 0590082

Please sign in to comment.