зеркало из https://github.com/mozilla/gecko-dev.git
Bug 888615 - [Australis] Reland the patch for bug 877767 which was backed out in the landing of Australis.
This commit is contained in:
Родитель
c652774643
Коммит
ba2db93ae9
|
@ -109,6 +109,18 @@ class GLManager;
|
|||
|
||||
@interface NSView (Undocumented)
|
||||
|
||||
// Draws the title string of a window.
|
||||
// Present on NSThemeFrame since at least 10.6.
|
||||
// _drawTitleBar is somewhat complex, and has changed over the years
|
||||
// since OS X 10.6. But in that time it's never done anything that
|
||||
// would break when called outside of -[NSView drawRect:] (which we
|
||||
// sometimes do), or whose output can't be redirected to a
|
||||
// CGContextRef object (which we also sometimes do). This is likely
|
||||
// to remain true for the indefinite future. However we should
|
||||
// check _drawTitleBar in each new major version of OS X. For more
|
||||
// information see bug 877767.
|
||||
- (void)_drawTitleBar:(NSRect)aRect;
|
||||
|
||||
// Returns an NSRect that is the bounding box for all an NSView's dirty
|
||||
// rectangles (ones that need to be redrawn). The full list of dirty
|
||||
// rectangles can be obtained by calling -[NSView _dirtyRegion] and then
|
||||
|
|
|
@ -167,6 +167,7 @@ uint32_t nsChildView::sLastInputEventCount = 0;
|
|||
- (void)clearCorners;
|
||||
|
||||
// Overlay drawing functions for traditional CGContext drawing
|
||||
- (void)drawTitleString;
|
||||
- (void)drawTitlebarHighlight;
|
||||
- (void)maskTopCornersInContext:(CGContextRef)aContext;
|
||||
|
||||
|
@ -2264,6 +2265,11 @@ nsChildView::UpdateTitlebarCGContext()
|
|||
NSGraphicsContext* context = [NSGraphicsContext graphicsContextWithGraphicsPort:ctx flipped:[frameView isFlipped]];
|
||||
[NSGraphicsContext setCurrentContext:context];
|
||||
|
||||
// Draw the title string.
|
||||
if ([frameView respondsToSelector:@selector(_drawTitleBar:)]) {
|
||||
[frameView _drawTitleBar:[frameView bounds]];
|
||||
}
|
||||
|
||||
// Draw the titlebar controls into the titlebar image.
|
||||
for (id view in [window titlebarControls]) {
|
||||
NSRect viewFrame = [view frame];
|
||||
|
@ -3545,6 +3551,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||
}
|
||||
|
||||
if ([self isCoveringTitlebar]) {
|
||||
[self drawTitleString];
|
||||
[self drawTitlebarHighlight];
|
||||
[self maskTopCornersInContext:aContext];
|
||||
}
|
||||
|
@ -3701,6 +3708,26 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||
CGContextRestoreGState(aContext);
|
||||
}
|
||||
|
||||
- (void)drawTitleString
|
||||
{
|
||||
NSView* frameView = [[[self window] contentView] superview];
|
||||
if (![frameView respondsToSelector:@selector(_drawTitleBar:)]) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSGraphicsContext* oldContext = [NSGraphicsContext currentContext];
|
||||
CGContextRef ctx = (CGContextRef)[oldContext graphicsPort];
|
||||
CGContextSaveGState(ctx);
|
||||
if ([oldContext isFlipped] != [frameView isFlipped]) {
|
||||
CGContextTranslateCTM(ctx, 0, [self bounds].size.height);
|
||||
CGContextScaleCTM(ctx, 1, -1);
|
||||
}
|
||||
[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:ctx flipped:[frameView isFlipped]]];
|
||||
[frameView _drawTitleBar:[frameView bounds]];
|
||||
CGContextRestoreGState(ctx);
|
||||
[NSGraphicsContext setCurrentContext:oldContext];
|
||||
}
|
||||
|
||||
- (void)drawTitlebarHighlight
|
||||
{
|
||||
DrawTitlebarHighlight([self bounds].size, [self cornerRadius],
|
||||
|
|
Загрузка…
Ссылка в новой задаче