From 827e56912164612d6130cc1c6674707bdb897bcd Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Wed, 20 Nov 2013 17:21:24 +0100 Subject: [PATCH] Bug 934023 - Use the correct cell rect when drawing the window buttons. r=smichaud --HG-- extra : rebase_source : 02a43c9e84c3f796bb8dc547734dc2169915ce86 --- widget/cocoa/nsChildView.mm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index f81bfbb1743..6f8bfa6df93 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -2198,7 +2198,8 @@ nsChildView::UpdateTitlebarImageBuffer() if (dirtyTitlebarRegion.IsEmpty()) return; - ClearRegion(mTitlebarImageBuffer, dirtyTitlebarRegion); + gfxUtils::ClipToRegion(mTitlebarImageBuffer, dirtyTitlebarRegion); + mTitlebarImageBuffer->ClearRect(gfx::Rect(0, 0, titlebarBufferSize.width, titlebarBufferSize.height)); gfx::BorrowedCGContext borrow(mTitlebarImageBuffer); CGContextRef ctx = borrow.cg; @@ -2222,9 +2223,7 @@ nsChildView::UpdateTitlebarImageBuffer() for (id view in [window titlebarControls]) { NSRect viewFrame = [view frame]; nsIntRect viewRect = CocoaPointsToDevPixels([mView convertRect:viewFrame fromView:frameView]); - nsIntRegion intersection; - intersection.And(dirtyTitlebarRegion, viewRect); - if (intersection.IsEmpty()) { + if (!dirtyTitlebarRegion.Intersects(viewRect)) { continue; } // All of the titlebar controls we're interested in are subclasses of @@ -2249,8 +2248,7 @@ nsChildView::UpdateTitlebarImageBuffer() [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:ctx flipped:[view isFlipped]]]; - NSRect intersectRect = DevPixelsToCocoaPoints(intersection.GetBounds()); - [cell drawWithFrame:[view convertRect:intersectRect fromView:mView] inView:button]; + [cell drawWithFrame:[button bounds] inView:button]; [NSGraphicsContext setCurrentContext:context]; CGContextRestoreGState(ctx); @@ -2264,6 +2262,8 @@ nsChildView::UpdateTitlebarImageBuffer() [NSGraphicsContext setCurrentContext:oldContext]; borrow.Finish(); + mTitlebarImageBuffer->PopClip(); + mUpdatedTitlebarRegion.Or(mUpdatedTitlebarRegion, dirtyTitlebarRegion); }