Bug 507845 - Use [borderView displayRect] instead of [window display] to redraw the titlebar. r=josh

The previous hack was causing dropped repaints on Mac OS 10.4.
This commit is contained in:
Markus Stange 2009-08-04 11:13:08 +12:00
Родитель 2f617666a5
Коммит a0207f6c9c
3 изменённых файлов: 9 добавлений и 24 удалений

Просмотреть файл

@ -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];

Просмотреть файл

@ -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;

Просмотреть файл

@ -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