author | Markus Stange <mstange@themasta.com> |
Sat, 13 Aug 2011 16:15:46 +0200 | |
changeset 74369 | bcab3415d9ee64c259aa6666c479ad6de7e18be6 |
parent 74368 | 53bbf9d8a0e5833a72eb87c5981a11bb35fa85fb |
child 74370 | e99b737739888ad18dfd8be8b862bc97737f5704 |
push id | 1195 |
push user | mstange@themasta.com |
push date | Sat, 13 Aug 2011 14:27:25 +0000 |
treeherder | mozilla-inbound@e99b73773988 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | josh |
bugs | 678002, 678184 |
milestone | 8.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/widget/src/cocoa/nsCocoaWindow.mm +++ b/widget/src/cocoa/nsCocoaWindow.mm @@ -2427,55 +2427,48 @@ DrawNativeTitlebar(CGContextRef aContext } } // Pattern draw callback for standard titlebar gradients and solid titlebar colors static void TitlebarDrawCallback(void* aInfo, CGContextRef aContext) { ToolbarWindow *window = (ToolbarWindow*)aInfo; - - // Remember: this context is NOT flipped, so the origin is in the bottom left. - float titlebarWidth = [window frame].size.width; - float titlebarHeight = [window titlebarHeight]; - float titlebarOrigin = [window frame].size.height - titlebarHeight; - NSRect titlebarRect = NSMakeRect(0, titlebarOrigin, titlebarWidth, titlebarHeight); - - [NSGraphicsContext saveGraphicsState]; - [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:aContext flipped:NO]]; + NSRect titlebarRect = [window titlebarRect]; if ([window drawsContentsIntoWindowFrame]) { NSView* view = [[[window contentView] subviews] lastObject]; if (!view || ![view isKindOfClass:[ChildView class]]) return; // Gecko drawing assumes flippedness, but the current context isn't flipped // (because we're painting into the window's border view, which is not a - // ChildView, so it isn't flpped). + // ChildView, so it isn't flipped). // So we need to set a flip transform. CGContextScaleCTM(aContext, 1.0f, -1.0f); CGContextTranslateCTM(aContext, 0.0f, -[window frame].size.height); - NSRect flippedTitlebarRect = NSMakeRect(0, 0, titlebarWidth, titlebarHeight); + NSRect flippedTitlebarRect = { NSZeroPoint, titlebarRect.size }; [(ChildView*)view drawRect:flippedTitlebarRect inTitlebarContext:aContext]; } else { BOOL isMain = [window isMainWindow]; NSColor *titlebarColor = [window titlebarColorForActiveWindow:isMain]; if (!titlebarColor) { // If the titlebar color is nil, draw the default titlebar shading. DrawNativeTitlebar(aContext, NSRectToCGRect(titlebarRect), [window unifiedToolbarHeight], isMain); } else { // If the titlebar color is not nil, just set and draw it normally. + [NSGraphicsContext saveGraphicsState]; + [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:aContext flipped:NO]]; [titlebarColor set]; NSRectFill(titlebarRect); + [NSGraphicsContext restoreGraphicsState]; } } - - [NSGraphicsContext restoreGraphicsState]; } - (void)setFill { float patternWidth = [mWindow frame].size.width; CGPatternCallbacks callbacks = {0, &TitlebarDrawCallback, NULL}; CGPatternRef pattern = CGPatternCreate(mWindow, CGRectMake(0.0f, 0.0f, patternWidth, [mWindow frame].size.height),