Bug 1291457 - Remove shadow invalidation code. r?spohl
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
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -3762,22 +3762,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
}
// The display system has told us that a portion of our view is dirty. Tell
// gecko to paint it
- (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
{
if (!mGeckoChild || !mGeckoChild->IsVisible())
return;
#ifdef DEBUG_UPDATE
--- a/widget/cocoa/nsCocoaWindow.h
+++ b/widget/cocoa/nsCocoaWindow.h
@@ -36,19 +36,16 @@ typedef struct _nsCocoaWindowList {
@interface BaseWindow : NSWindow
{
// Data Storage
NSMutableDictionary* mState;
BOOL mDrawsIntoWindowFrame;
NSColor* mActiveTitlebarColor;
NSColor* mInactiveTitlebarColor;
- // Shadow
- BOOL mScheduledShadowInvalidation;
-
// Invalidation disabling
BOOL mDisabledNeedsDisplay;
// DPI cache. Getting the physical screen size (CGDisplayScreenSize)
// is ridiculously slow, so we cache it in the toplevel window for all
// descendants to use.
float mDPI;
@@ -64,18 +61,16 @@ typedef struct _nsCocoaWindowList {
- (void)importState:(NSDictionary*)aState;
- (NSMutableDictionary*)exportState;
- (void)setDrawsContentsIntoWindowFrame:(BOOL)aState;
- (BOOL)drawsContentsIntoWindowFrame;
- (void)setTitlebarColor:(NSColor*)aColor forActiveWindow:(BOOL)aActive;
- (NSColor*)titlebarColorForActiveWindow:(BOOL)aActive;
-- (void)deferredInvalidateShadow;
-- (void)invalidateShadow;
- (float)getDPI;
- (void)mouseEntered:(NSEvent*)aEvent;
- (void)mouseExited:(NSEvent*)aEvent;
- (void)mouseMoved:(NSEvent*)aEvent;
- (void)updateTrackingArea;
- (NSView*)trackingAreaView;
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -2995,17 +2995,16 @@ static NSMutableSet *gSwizzledFrameViewC
- (id)initWithContentRect:(NSRect)aContentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)aBufferingType defer:(BOOL)aFlag
{
mDrawsIntoWindowFrame = NO;
[super initWithContentRect:aContentRect styleMask:aStyle backing:aBufferingType defer:aFlag];
mState = nil;
mActiveTitlebarColor = nil;
mInactiveTitlebarColor = nil;
- mScheduledShadowInvalidation = NO;
mDisabledNeedsDisplay = NO;
mDPI = GetDPI(self);
mTrackingArea = nil;
mDirtyRect = NSZeroRect;
mBeingShown = NO;
mDrawTitle = NO;
mBrightTitlebarForeground = NO;
mUseMenuStyle = NO;
@@ -3145,31 +3144,16 @@ static const NSString* kStateCollectionB
}
}
- (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;
}
- (NSView*)trackingAreaView
{
NSView* contentView = [self contentView];