Bug 599241 - Draw the persona's accent colour in the titlebar in OpenGL mode as a stop-gap measure until we can draw proper content in the titlebar again. r=mstange a=b

This commit is contained in:
Joe Drew 2010-09-29 14:37:44 -04:00
parent 28c345d48a
commit e0ceecd56e
4 changed files with 30 additions and 6 deletions

View File

@ -98,6 +98,15 @@ LightweightThemeConsumer.prototype = {
}
#ifdef XP_MACOSX
if (active && aData.accentcolor) {
root.setAttribute("activetitlebarcolor", aData.accentcolor);
root.setAttribute("inactivetitlebarcolor", aData.accentcolor);
} else {
root.removeAttribute("activetitlebarcolor");
root.removeAttribute("inactivetitlebarcolor");
}
if (active)
root.setAttribute("drawintitlebar", "true");
else

View File

@ -228,6 +228,8 @@ extern "C" long TSMProcessRawKeyEvent(EventRef carbonEvent);
- (BOOL)isPluginView;
- (BOOL)isUsingOpenGL;
// Simple gestures support
//
// XXX - The swipeWithEvent, beginGestureWithEvent, magnifyWithEvent,

View File

@ -2588,10 +2588,17 @@ NSEvent* gLastDragMouseDownEvent = nil;
[self update];
}
- (BOOL) isUsingOpenGL
{
return mGeckoChild && mGeckoChild->GetLayerManager()->GetBackendType() == LayerManager::LAYERS_OPENGL;
}
// The display system has told us that a portion of our view is dirty. Tell
// gecko to paint it
- (void)drawRect:(NSRect)aRect
{
float oldHeight = [self beginMaybeResetUnifiedToolbar];
CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
[self drawRect:aRect inContext:cgContext];
@ -2600,6 +2607,8 @@ NSEvent* gLastDragMouseDownEvent = nil;
if ([[self window] isKindOfClass:[BaseWindow class]]) {
[(BaseWindow*)[self window] deferredInvalidateShadow];
}
[self endMaybeResetUnifiedToolbar:oldHeight];
}
- (void)drawRect:(NSRect)aRect inContext:(CGContextRef)aContext
@ -2698,8 +2707,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
}
targetContext->Clip();
float oldHeight = [self beginMaybeResetUnifiedToolbar];
nsAutoRetainCocoaObject kungFuDeathGrip(self);
PRBool painted;
{
@ -2716,8 +2723,6 @@ NSEvent* gLastDragMouseDownEvent = nil;
aRect.size.width, aRect.size.height));
}
[self endMaybeResetUnifiedToolbar:oldHeight];
// note that the cairo surface *MUST* be destroyed at this point,
// or bad things will happen (since we can't keep the cgContext around
// beyond this drawRect message handler)

View File

@ -2441,10 +2441,18 @@ ContentPatternDrawCallback(void* aInfo, CGContextRef aContext)
- (void)setFill
{
CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
CGPatternDrawPatternCallback cb = [mWindow drawsContentsIntoWindowFrame] ?
CGPatternDrawPatternCallback cb;
float patternWidth;
NSView* view = [[[mWindow contentView] subviews] lastObject];
if (view && [view isKindOfClass:[ChildView class]] && [(ChildView*)view isUsingOpenGL]) {
cb = &RepeatedPatternDrawCallback;
patternWidth = sPatternWidth;
} else {
cb = [mWindow drawsContentsIntoWindowFrame] ?
&ContentPatternDrawCallback : &RepeatedPatternDrawCallback;
patternWidth = [mWindow drawsContentsIntoWindowFrame] ? [mWindow frame].size.width : sPatternWidth;
}
CGPatternCallbacks callbacks = {0, cb, NULL};
float patternWidth = [mWindow drawsContentsIntoWindowFrame] ? [mWindow frame].size.width : sPatternWidth;
CGPatternRef pattern = CGPatternCreate(mWindow, CGRectMake(0.0f, 0.0f, patternWidth, [mWindow frame].size.height),
CGAffineTransformIdentity, patternWidth, [mWindow frame].size.height,
kCGPatternTilingConstantSpacing, true, &callbacks);