Backed out changeset b097bd9fd24c because of Windows build bustage

This commit is contained in:
Ehsan Akhgari 2013-05-19 11:29:19 -04:00
parent e43574cf4f
commit cb75c641f1
4 changed files with 4 additions and 30 deletions

View File

@ -2307,14 +2307,14 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
macRect.size.width -= 4;
}
}
const BOOL isOnTopOfDarkBackground = IsDarkBackground(aFrame);
const BOOL isOnTopOfBrightBackground = YES; // TODO: detect this properly
CUIDraw([NSWindow coreUIRenderer], macRect, cgContext,
(CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys:
@"kCUIWidgetOverlayScrollBar", @"widget",
@"regular", @"size",
(isRolledOver ? @"rollover" : @""), @"state",
(isHorizontal ? @"kCUIOrientHorizontal" : @"kCUIOrientVertical"), @"kCUIOrientationKey",
(isOnTopOfDarkBackground ? @"kCUIVariantWhite" : @""), @"kCUIVariantKey",
(isOnTopOfBrightBackground ? @"" : @"kCUIVariantWhite"), @"kCUIVariantKey",
[NSNumber numberWithBool:YES], @"indiconly",
[NSNumber numberWithBool:YES], @"kCUIThumbProportionKey",
[NSNumber numberWithBool:YES], @"is.flipped",
@ -2342,13 +2342,13 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
nsLookAndFeel::eIntID_UseOverlayScrollbars) != 0 &&
CheckBooleanAttr(GetParentScrollbarFrame(aFrame), nsGkAtoms::hover)) {
BOOL isHorizontal = (aWidgetType == NS_THEME_SCROLLBAR_TRACK_HORIZONTAL);
const BOOL isOnTopOfDarkBackground = IsDarkBackground(aFrame);
const BOOL isOnTopOfBrightBackground = YES; // TODO: detect this properly
CUIDraw([NSWindow coreUIRenderer], macRect, cgContext,
(CFDictionaryRef)[NSDictionary dictionaryWithObjectsAndKeys:
@"kCUIWidgetOverlayScrollBar", @"widget",
@"regular", @"size",
(isHorizontal ? @"kCUIOrientHorizontal" : @"kCUIOrientVertical"), @"kCUIOrientationKey",
(isOnTopOfDarkBackground ? @"kCUIVariantWhite" : @""), @"kCUIVariantKey",
(isOnTopOfBrightBackground ? @"" : @"kCUIVariantWhite"), @"kCUIVariantKey",
[NSNumber numberWithBool:YES], @"noindicator",
[NSNumber numberWithBool:YES], @"kCUIThumbProportionKey",
[NSNumber numberWithBool:YES], @"is.flipped",

View File

@ -71,7 +71,6 @@ endif
LOCAL_INCLUDES += \
-I$(srcdir)/../$(MOZ_WIDGET_TOOLKIT) \
-I$(srcdir)/../shared \
-I$(topsrcdir)/layout/base \
-I$(topsrcdir)/layout/forms \
-I$(topsrcdir)/layout/generic \
-I$(topsrcdir)/layout/xul/base/src \

View File

@ -23,7 +23,6 @@
#include "nsMeterFrame.h"
#include "nsMenuFrame.h"
#include "nsRangeFrame.h"
#include "nsCSSRendering.h"
#include "mozilla/dom/Element.h"
#include <algorithm>
@ -678,24 +677,3 @@ nsNativeTheme::IsRangeHorizontal(nsIFrame* aFrame)
return static_cast<nsRangeFrame*>(rangeFrame)->IsHorizontal();
}
bool
nsNativeTheme::IsDarkBackground(nsIFrame* aFrame)
{
nsIScrollableFrame* scrollFrame = aFrame->GetScrollTargetFrame();
while (!scrollFrame && aFrame) {
aFrame = aFrame->GetParent();
scrollFrame = aFrame->GetScrollTargetFrame();
}
nsIFrame* frame = scrollFrame->GetScrolledFrame();
nsStyleContext* bgSC;
if (nsCSSRendering::FindBackground(frame, &bgSC)) {
nscolor bgColor = bgSC->StyleBackground()->mBackgroundColor;
// Consider the background color dark if the sum of the r, g and b values is
// less than 384 in a semi-transparent docement. This heuristic matches what
// WebKit does, and we can improve it later if needed.
return NS_GET_A(bgColor) > 127 &&
NS_GET_R(bgColor) + NS_GET_G(bgColor) + NS_GET_B(bgColor) < 384;
}
return false;
}

View File

@ -173,9 +173,6 @@ class nsNativeTheme : public nsITimerCallback
bool IsRangeHorizontal(nsIFrame* aFrame);
// scrollbar
bool IsDarkBackground(nsIFrame* aFrame);
private:
uint32_t mAnimatedContentTimeout;
nsCOMPtr<nsITimer> mAnimatedContentTimer;