Bug 873012 - In case we use overlay scrollbars, and we run on system 10.8 or later, make them overlap in the bottom right corner, r=smichaud

--HG--
extra : rebase_source : 300f78c1230a6f91a102c032b026b1fe2455f634
This commit is contained in:
André Reinald 2013-05-23 14:14:00 -07:00
parent 30e98999ec
commit 3a7449434c
4 changed files with 18 additions and 4 deletions

View File

@ -3768,7 +3768,9 @@ nsGfxScrollFrameInner::LayoutScrollbars(nsBoxLayoutState& aState,
AdjustScrollbarRectForResizer(mOuter, presContext, hRect, hasResizer, false);
}
AdjustOverlappingScrollbars(vRect, hRect);
if (!LookAndFeel::GetInt(LookAndFeel::eIntID_AllowOverlayScrollbarsOverlap)) {
AdjustOverlappingScrollbars(vRect, hRect);
}
if (mVScrollbarBox) {
nsBoxFrame::LayoutChildAt(aState, mVScrollbarBox, vRect);
}

View File

@ -188,6 +188,8 @@ public:
eIntID_MenusCanOverlapOSBar,
// should overlay scrollbars be used?
eIntID_UseOverlayScrollbars,
// allow H and V overlay scrollbars to overlap?
eIntID_AllowOverlayScrollbarsOverlap,
// show/hide scrollbars based on activity
eIntID_ShowHideScrollbars,
// skip navigating to disabled menu item?

View File

@ -31,6 +31,7 @@ protected:
static const int kThemeScrollBarArrowsUpperLeft = 3;
static bool UseOverlayScrollbars();
static bool AllowOverlayScrollbarsOverlap();
};
#endif // nsLookAndFeel_h_

View File

@ -8,6 +8,7 @@
#include "nsIServiceManager.h"
#include "nsNativeThemeColors.h"
#include "nsStyleConsts.h"
#include "nsCocoaFeatures.h"
#include "gfxFont.h"
#import <Cocoa/Cocoa.h>
@ -352,7 +353,10 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
aResult = eScrollThumbStyle_Proportional;
break;
case eIntID_UseOverlayScrollbars:
aResult = UseOverlayScrollbars();
aResult = UseOverlayScrollbars() ? 1 : 0;
break;
case eIntID_AllowOverlayScrollbarsOverlap:
aResult = AllowOverlayScrollbarsOverlap() ? 1 : 0;
break;
case eIntID_TreeOpenDelay:
aResult = 1000;
@ -468,8 +472,13 @@ nsLookAndFeel::GetFloatImpl(FloatID aID, float &aResult)
bool nsLookAndFeel::UseOverlayScrollbars()
{
return [NSScroller respondsToSelector:@selector(preferredScrollerStyle)] &&
[NSScroller preferredScrollerStyle] == mozNSScrollerStyleOverlay;
return ([NSScroller respondsToSelector:@selector(preferredScrollerStyle)] &&
[NSScroller preferredScrollerStyle] == mozNSScrollerStyleOverlay);
}
bool nsLookAndFeel::AllowOverlayScrollbarsOverlap()
{
return (UseOverlayScrollbars() && nsCocoaFeatures::OnMountainLionOrLater());
}
// copied from gfxQuartzFontCache.mm, maybe should go in a Cocoa utils