Improve Camino drawing performance by avoiding widget updates when the dirty rect is entirely obscured by subviews (bug 166932). Should help Camino typing performance (bug 272954). Camino only, NPODB. r=pinkerton

This commit is contained in:
smfr%smfr.org 2005-07-15 20:53:13 +00:00
Родитель 31b68ad1ba
Коммит e39a9df276
2 изменённых файлов: 22 добавлений и 3 удалений

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

@ -114,7 +114,7 @@ nsAppShellCocoa::Run(void)
NS_IMETHODIMP
nsAppShellCocoa::Exit(void)
{
[NSApp stop];
[NSApp stop:nil];
return NS_OK;
}

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

@ -109,6 +109,7 @@
- (BOOL)childViewHasPlugin;
- (void)flushRect:(NSRect)inRect;
- (BOOL)isRectObscuredBySubview:(NSRect)inRect;
#if USE_CLICK_HOLD_CONTEXTMENU
// called on a timer two seconds after a mouse down to see if we should display
@ -2463,7 +2464,12 @@ nsChildView::Idle()
if (!isVisible) {
return;
}
// Workaround for the fact that NSQuickDrawViews can't be opaque; see the rect
// being drawn is covered by a subview, and, if so, just bail.
if ([self isRectObscuredBySubview:aRect])
return;
// tell gecko to paint.
// If < 10.3, just paint the rect
if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_2) {
@ -2478,7 +2484,7 @@ nsChildView::Idle()
const NSRect *rects;
int count, i;
[self getRectsBeingDrawn:&rects count:&count];
for (i=0; i<count; ++i) {
for (i = 0; i < count; ++i) {
nsRect r;
ConvertCocoaToGeckoRect(rects[i], r);
nsCOMPtr<nsIRenderingContext> rendContext = getter_AddRefs(mGeckoChild->GetRenderingContext());
@ -2487,6 +2493,19 @@ nsChildView::Idle()
}
}
- (BOOL)isRectObscuredBySubview:(NSRect)inRect
{
unsigned int numSubviews = [[self subviews] count];
for (unsigned int i = 0; i < numSubviews; i++)
{
NSRect subviewFrame = [[[self subviews] objectAtIndex:i] frame];
if (NSContainsRect(subviewFrame, inRect))
return YES;
}
return NO;
}
- (void)flushRect:(NSRect)inRect
{
Rect updateRect;