diff --git a/widget/src/cocoa/nsChildView.mm b/widget/src/cocoa/nsChildView.mm index 5ce1c4e2c482..3ac7131b94a0 100644 --- a/widget/src/cocoa/nsChildView.mm +++ b/widget/src/cocoa/nsChildView.mm @@ -194,8 +194,6 @@ PRUint32 nsChildView::sLastInputEventCount = 0; + (NSEvent*)makeNewCocoaEventWithType:(NSEventType)type fromEvent:(NSEvent*)theEvent; -- (BOOL)isPaintingSuppressed; - - (void)maybeInvalidateShadow; - (void)invalidateShadow; @@ -2661,13 +2659,6 @@ static const PRInt32 sShadowInvalidationInterval = 100; mNeedsShadowInvalidation = NO; } -- (BOOL)isPaintingSuppressed -{ - NSWindow* win = [self window]; - return ([win isKindOfClass:[ToolbarWindow class]] && - [(ToolbarWindow*)win isPaintingSuppressed]); -} - // The display system has told us that a portion of our view is dirty. Tell // gecko to paint it - (void)drawRect:(NSRect)aRect @@ -2676,7 +2667,7 @@ static const PRInt32 sShadowInvalidationInterval = 100; PRBool isVisible; if (!mGeckoChild || NS_FAILED(mGeckoChild->IsVisible(isVisible)) || - !isVisible || [self isPaintingSuppressed]) + !isVisible) return; CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; diff --git a/widget/src/cocoa/nsCocoaWindow.h b/widget/src/cocoa/nsCocoaWindow.h index 51ce3cf6f9da..55c69ac0d2e0 100644 --- a/widget/src/cocoa/nsCocoaWindow.h +++ b/widget/src/cocoa/nsCocoaWindow.h @@ -152,13 +152,11 @@ struct UnifiedGradientInfo { { TitlebarAndBackgroundColor *mColor; float mUnifiedToolbarHeight; - BOOL mSuppressPainting; } - (void)setTitlebarColor:(NSColor*)aColor forActiveWindow:(BOOL)aActive; - (void)setUnifiedToolbarHeight:(float)aToolbarHeight; - (float)unifiedToolbarHeight; - (float)titlebarHeight; -- (BOOL)isPaintingSuppressed; // This method is also available on NSWindows (via a category), and is the // preferred way to check the background color of a window. - (NSColor*)windowBackgroundColor; diff --git a/widget/src/cocoa/nsCocoaWindow.mm b/widget/src/cocoa/nsCocoaWindow.mm index 9025379607b3..6e1d7d9983ff 100644 --- a/widget/src/cocoa/nsCocoaWindow.mm +++ b/widget/src/cocoa/nsCocoaWindow.mm @@ -1827,7 +1827,6 @@ nsCocoaWindow::UnifiedShading(void* aInfo, const float* aIn, float* aOut) [super setBackgroundColor:mColor]; mUnifiedToolbarHeight = 0.0f; - mSuppressPainting = NO; // setBottomCornerRounded: is a private API call, so we check to make sure // we respond to it just in case. @@ -1905,11 +1904,6 @@ nsCocoaWindow::UnifiedShading(void* aInfo, const float* aIn, float* aOut) return frameRect.size.height - [self contentRectForFrameRect:frameRect].size.height; } -- (BOOL)isPaintingSuppressed -{ - return mSuppressPainting; -} - // Always show the toolbar pill button. - (BOOL)_hasToolbar { @@ -1991,14 +1985,16 @@ nsCocoaWindow::UnifiedShading(void* aInfo, const float* aIn, float* aOut) @implementation ToolbarWindow(Private) -// [self display] seems to be the only way to repaint a window's titlebar. -// The bad thing about it is that it repaints all the window's subviews as well. -// So we use a guard to prevent unnecessary redrawing. - (void)redrawTitlebar { - mSuppressPainting = YES; - [self display]; - mSuppressPainting = NO; + NSView* borderView = [[self contentView] superview]; + if (!borderView) + return; + + NSRect rect = NSMakeRect(0, [[self contentView] bounds].size.height, + [borderView bounds].size.width, [self titlebarHeight]); + // setNeedsDisplayInRect doesn't have any effect here, but displayRect does. + [borderView displayRect:rect]; } @end