--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -191,17 +191,16 @@ static NSMutableDictionary* sNativeKeyEv
- (BOOL)hasRoundedBottomCorners;
- (CGFloat)cornerRadius;
- (void)clearCorners;
-(void)setGLOpaque:(BOOL)aOpaque;
// Overlay drawing functions for traditional CGContext drawing
- (void)drawTitleString;
-- (void)drawTitlebarHighlight;
- (void)maskTopCornersInContext:(CGContextRef)aContext;
#if USE_CLICK_HOLD_CONTEXTMENU
// called on a timer two seconds after a mouse down to see if we should display
// a context menu (click-hold)
- (void)clickHoldCallback:(id)inEvent;
#endif
@@ -2009,28 +2008,26 @@ nsChildView::ConfigureAPZControllerThrea
} else {
nsBaseWidget::ConfigureAPZControllerThread();
}
}
LayoutDeviceIntRect
nsChildView::RectContainingTitlebarControls()
{
- // Start with a thin strip at the top of the window for the highlight line.
- NSRect rect = NSMakeRect(0, 0, [mView bounds].size.width,
- [(ChildView*)mView cornerRadius]);
-
- // If we draw the titlebar title string, increase the height to the default
- // titlebar height. This height does not necessarily include all the titlebar
- // controls because we may have moved them further down, but at least it will
- // include the whole title text.
+ NSRect rect = NSZeroRect;
+
+ // If we draw the titlebar title string, set the rect to the full window
+ // width times the default titlebar height. This height does not necessarily
+ // include all the titlebar controls because we may have moved them further
+ // down, but at least it will include the whole title text.
BaseWindow* window = (BaseWindow*)[mView window];
if ([window wantsTitleDrawn] && [window isKindOfClass:[ToolbarWindow class]]) {
CGFloat defaultTitlebarHeight = [(ToolbarWindow*)window titlebarHeight];
- rect.size.height = std::max(rect.size.height, defaultTitlebarHeight);
+ rect = NSMakeRect(0, 0, [mView bounds].size.width, defaultTitlebarHeight);
}
// Add the rects of the titlebar controls.
for (id view in [window titlebarControls]) {
rect = NSUnionRect(rect, [mView convertRect:[view bounds] fromView:view]);
}
return CocoaPointsToDevPixels(rect);
}
@@ -2251,48 +2248,16 @@ nsChildView::MaybeDrawResizeIndicator(GL
gfx::BorrowedCGContext borrow(drawTarget);
DrawResizer(borrow.cg);
borrow.Finish();
});
mResizerImage->Draw(aManager, mResizeIndicatorRect.TopLeft());
}
-// Draw the highlight line at the top of the titlebar.
-// This function draws into the current NSGraphicsContext and assumes flippedness.
-static void
-DrawTitlebarHighlight(NSSize aWindowSize, CGFloat aRadius, CGFloat aDevicePixelWidth)
-{
- [NSGraphicsContext saveGraphicsState];
-
- // Set up the clip path. We start with the outer rectangle and cut out a
- // slightly smaller inner rectangle with rounded corners.
- // The outer corners of the resulting path will be square, but they will be
- // masked away in a later step.
- NSBezierPath* path = [NSBezierPath bezierPath];
- [path setWindingRule:NSEvenOddWindingRule];
- NSRect pathRect = NSMakeRect(0, 0, aWindowSize.width, aRadius + 2);
- [path appendBezierPathWithRect:pathRect];
- pathRect = NSInsetRect(pathRect, aDevicePixelWidth, aDevicePixelWidth);
- CGFloat innerRadius = aRadius - aDevicePixelWidth;
- [path appendBezierPathWithRoundedRect:pathRect xRadius:innerRadius yRadius:innerRadius];
- [path addClip];
-
- // Now we fill the path with a subtle highlight gradient.
- // We don't use NSGradient because it's 5x to 15x slower than the manual fill,
- // as indicated by the performance test in bug 880620.
- for (CGFloat y = 0; y < aRadius; y += aDevicePixelWidth) {
- CGFloat t = y / aRadius;
- [[NSColor colorWithDeviceWhite:1.0 alpha:0.4 * (1.0 - t)] set];
- NSRectFillUsingOperation(NSMakeRect(0, y, aWindowSize.width, aDevicePixelWidth), NSCompositeSourceOver);
- }
-
- [NSGraphicsContext restoreGraphicsState];
-}
-
static CGContextRef
CreateCGContext(const LayoutDeviceIntSize& aSize)
{
CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
CGContextRef ctx =
CGBitmapContextCreate(NULL,
aSize.width,
aSize.height,
@@ -2426,19 +2391,16 @@ nsChildView::UpdateTitlebarCGContext()
}
[NSGraphicsContext setCurrentContext:context];
CGContextRestoreGState(ctx);
}
CGContextRestoreGState(ctx);
- DrawTitlebarHighlight([frameView bounds].size, [(ChildView*)mView cornerRadius],
- DevPixelsToCocoaPoints(1));
-
[NSGraphicsContext setCurrentContext:oldContext];
CGContextRestoreGState(ctx);
mUpdatedTitlebarRegion.OrWith(CocoaPointsToDevPixels(dirtyTitlebarRect));
}
// This method draws an overlay in the top of the window which contains the
@@ -3895,17 +3857,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
// Gecko refused to draw, but we've claimed to be opaque, so we have to
// draw something--fill with white.
CGContextSetRGBFillColor(aContext, 1, 1, 1, 1);
CGContextFillRect(aContext, NSRectToCGRect(aRect));
}
if ([self isCoveringTitlebar]) {
[self drawTitleString];
- [self drawTitlebarHighlight];
[self maskTopCornersInContext:aContext];
}
#ifdef DEBUG_UPDATE
fprintf (stderr, "---- update done ----\n");
#if 0
CGContextSetRGBStrokeColor (aContext,
@@ -4085,22 +4046,16 @@ NSEvent* gLastDragMouseDownEvent = nil;
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],
- mGeckoChild->DevPixelsToCocoaPoints(1));
-}
-
- (void)viewWillDraw
{
nsAutoRetainCocoaObject kungFuDeathGrip(self);
if (mGeckoChild) {
// The OS normally *will* draw our NSWindow, no matter what we do here.
// But Gecko can delete our parent widget(s) (along with mGeckoChild)
// while processing a paint request, which closes our NSWindow and