зеркало из https://github.com/mozilla/gecko-dev.git
Bug 880753: Add public nsLookAndFeel::UseOverlayScrollbars method. r=smichaud
This commit is contained in:
Родитель
e25bc05e2c
Коммит
5b7636acf0
|
@ -24,13 +24,15 @@ public:
|
|||
return 0x2022;
|
||||
}
|
||||
|
||||
static bool UseOverlayScrollbars();
|
||||
|
||||
protected:
|
||||
|
||||
// Apple hasn't defined a constant for scollbars with two arrows on each end, so we'll use this one.
|
||||
static const int kThemeScrollBarArrowsBoth = 2;
|
||||
static const int kThemeScrollBarArrowsUpperLeft = 3;
|
||||
|
||||
static bool UseOverlayScrollbars();
|
||||
static bool SystemWantsOverlayScrollbars();
|
||||
static bool AllowOverlayScrollbarsOverlap();
|
||||
};
|
||||
|
||||
|
|
|
@ -353,7 +353,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
|
|||
aResult = eScrollThumbStyle_Proportional;
|
||||
break;
|
||||
case eIntID_UseOverlayScrollbars:
|
||||
aResult = UseOverlayScrollbars() ? 1 : 0;
|
||||
aResult = SystemWantsOverlayScrollbars() ? 1 : 0;
|
||||
break;
|
||||
case eIntID_AllowOverlayScrollbarsOverlap:
|
||||
aResult = AllowOverlayScrollbarsOverlap() ? 1 : 0;
|
||||
|
@ -471,6 +471,11 @@ nsLookAndFeel::GetFloatImpl(FloatID aID, float &aResult)
|
|||
}
|
||||
|
||||
bool nsLookAndFeel::UseOverlayScrollbars()
|
||||
{
|
||||
return GetInt(eIntID_UseOverlayScrollbars) != 0;
|
||||
}
|
||||
|
||||
bool nsLookAndFeel::SystemWantsOverlayScrollbars()
|
||||
{
|
||||
return ([NSScroller respondsToSelector:@selector(preferredScrollerStyle)] &&
|
||||
[NSScroller preferredScrollerStyle] == mozNSScrollerStyleOverlay);
|
||||
|
|
|
@ -2321,15 +2321,13 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
|
|||
|
||||
case NS_THEME_SCROLLBAR_SMALL:
|
||||
case NS_THEME_SCROLLBAR:
|
||||
if (nsLookAndFeel::GetInt(
|
||||
nsLookAndFeel::eIntID_UseOverlayScrollbars) == 0) {
|
||||
if (!nsLookAndFeel::UseOverlayScrollbars()) {
|
||||
DrawScrollbar(cgContext, macRect, aFrame);
|
||||
}
|
||||
break;
|
||||
case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
|
||||
case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
|
||||
if (nsLookAndFeel::GetInt(
|
||||
nsLookAndFeel::eIntID_UseOverlayScrollbars) != 0) {
|
||||
if (nsLookAndFeel::UseOverlayScrollbars()) {
|
||||
BOOL isHorizontal = (aWidgetType == NS_THEME_SCROLLBAR_THUMB_HORIZONTAL);
|
||||
BOOL isRolledOver = CheckBooleanAttr(GetParentScrollbarFrame(aFrame),
|
||||
nsGkAtoms::hover);
|
||||
|
@ -2373,8 +2371,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
|
|||
break;
|
||||
case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
|
||||
case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
|
||||
if (nsLookAndFeel::GetInt(
|
||||
nsLookAndFeel::eIntID_UseOverlayScrollbars) != 0 &&
|
||||
if (nsLookAndFeel::UseOverlayScrollbars() &&
|
||||
CheckBooleanAttr(GetParentScrollbarFrame(aFrame), nsGkAtoms::hover)) {
|
||||
BOOL isHorizontal = (aWidgetType == NS_THEME_SCROLLBAR_TRACK_HORIZONTAL);
|
||||
const BOOL isOnTopOfDarkBackground = IsDarkBackground(aFrame);
|
||||
|
@ -2583,8 +2580,7 @@ nsNativeThemeCocoa::GetWidgetBorder(nsDeviceContext* aContext,
|
|||
}
|
||||
}
|
||||
|
||||
if (nsLookAndFeel::GetInt(
|
||||
nsLookAndFeel::eIntID_UseOverlayScrollbars) != 0) {
|
||||
if (nsLookAndFeel::UseOverlayScrollbars()) {
|
||||
if (isHorizontal) {
|
||||
aResult->SizeTo(2, 1, 1, 1);
|
||||
} else {
|
||||
|
@ -2841,8 +2837,7 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsRenderingContext* aContext,
|
|||
{
|
||||
*aIsOverridable = false;
|
||||
|
||||
if (nsLookAndFeel::GetInt(
|
||||
nsLookAndFeel::eIntID_UseOverlayScrollbars) != 0) {
|
||||
if (nsLookAndFeel::UseOverlayScrollbars()) {
|
||||
aResult->SizeTo(16, 16);
|
||||
break;
|
||||
}
|
||||
|
@ -3100,8 +3095,7 @@ nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* a
|
|||
// overriden, and the custom transparent resizer looks better when
|
||||
// scrollbars are not present.
|
||||
nsIScrollableFrame* scrollFrame = do_QueryFrame(parentFrame);
|
||||
return (nsLookAndFeel::GetInt(
|
||||
nsLookAndFeel::eIntID_UseOverlayScrollbars) == 0 &&
|
||||
return (!nsLookAndFeel::UseOverlayScrollbars() &&
|
||||
scrollFrame && scrollFrame->GetScrollbarVisibility());
|
||||
break;
|
||||
}
|
||||
|
@ -3157,9 +3151,7 @@ nsNativeThemeCocoa::GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType)
|
|||
|
||||
case NS_THEME_SCROLLBAR_SMALL:
|
||||
case NS_THEME_SCROLLBAR:
|
||||
return nsLookAndFeel::GetInt(
|
||||
nsLookAndFeel::eIntID_UseOverlayScrollbars) != 0 ?
|
||||
eTransparent : eOpaque;
|
||||
return nsLookAndFeel::UseOverlayScrollbars() ? eTransparent : eOpaque;
|
||||
|
||||
case NS_THEME_STATUSBAR:
|
||||
// Knowing that scrollbars and statusbars are opaque improves
|
||||
|
|
Загрузка…
Ссылка в новой задаче