From 07920062316d4a588f4b05477cf889efe29d07c6 Mon Sep 17 00:00:00 2001 From: Cameron Kaiser Date: Thu, 31 Aug 2017 18:58:40 -0700 Subject: [PATCH] #417: remove more code from LookAndFeel; tune up a bit --- widget/cocoa/nsLookAndFeel.mm | 10 +++++++++- widget/nsXPLookAndFeel.cpp | 8 ++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/widget/cocoa/nsLookAndFeel.mm b/widget/cocoa/nsLookAndFeel.mm index fd60089bf5..dd7de4c905 100644 --- a/widget/cocoa/nsLookAndFeel.mm +++ b/widget/cocoa/nsLookAndFeel.mm @@ -347,7 +347,7 @@ static nscolor GetColorFromNSColor(NSColor* aColor) aResult = 4; break; case eIntID_ScrollArrowStyle: -#if(0) +#ifdef __LP64__ if (nsCocoaFeatures::OnLionOrLater()) { // OS X Lion's scrollbars have no arrows aResult = eScrollArrow_None; @@ -374,18 +374,24 @@ static nscolor GetColorFromNSColor(NSColor* aColor) aResult = eScrollThumbStyle_Proportional; break; case eIntID_UseOverlayScrollbars: + aResult = 0; +#ifdef __LP64__ if (!mUseOverlayScrollbarsCached) { mUseOverlayScrollbars = SystemWantsOverlayScrollbars() ? 1 : 0; mUseOverlayScrollbarsCached = true; } aResult = mUseOverlayScrollbars; +#endif break; case eIntID_AllowOverlayScrollbarsOverlap: + aResult = 0; +#ifdef __LP64__ if (!mAllowOverlayScrollbarsOverlapCached) { mAllowOverlayScrollbarsOverlap = AllowOverlayScrollbarsOverlap() ? 1 : 0; mAllowOverlayScrollbarsOverlapCached = true; } aResult = mAllowOverlayScrollbarsOverlap; +#endif break; case eIntID_ScrollbarDisplayOnMouseMove: aResult = 0; @@ -474,10 +480,12 @@ static nscolor GetColorFromNSColor(NSColor* aColor) break; case eIntID_SwipeAnimationEnabled: aResult = 0; +#ifdef __LP64__ if ([NSEvent respondsToSelector:@selector( isSwipeTrackingFromScrollEventsEnabled)]) { aResult = [NSEvent isSwipeTrackingFromScrollEventsEnabled] ? 1 : 0; } +#endif break; case eIntID_ColorPickerAvailable: aResult = 1; diff --git a/widget/nsXPLookAndFeel.cpp b/widget/nsXPLookAndFeel.cpp index 7144e8e052..51d2485e11 100644 --- a/widget/nsXPLookAndFeel.cpp +++ b/widget/nsXPLookAndFeel.cpp @@ -821,7 +821,7 @@ nsXPLookAndFeel::GetColorImpl(ColorID aID, bool aUseStandinsForNativeColors, nsresult nsXPLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) { - if (!sInitialized) + if (MOZ_UNLIKELY(!sInitialized)) Init(); // Set the default values for these prefs. but allow different platforms @@ -845,7 +845,7 @@ nsXPLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) } for (unsigned int i = 0; i < ArrayLength(sIntPrefs); ++i) { - if (sIntPrefs[i].isSet && (sIntPrefs[i].id == aID)) { + if (MOZ_UNLIKELY(sIntPrefs[i].isSet && (sIntPrefs[i].id == aID))) { aResult = sIntPrefs[i].intVar; return NS_OK; } @@ -857,11 +857,11 @@ nsXPLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) nsresult nsXPLookAndFeel::GetFloatImpl(FloatID aID, float &aResult) { - if (!sInitialized) + if (MOZ_UNLIKELY(!sInitialized)) Init(); for (unsigned int i = 0; i < ArrayLength(sFloatPrefs); ++i) { - if (sFloatPrefs[i].isSet && sFloatPrefs[i].id == aID) { + if (MOZ_UNLIKELY(sFloatPrefs[i].isSet && sFloatPrefs[i].id == aID)) { aResult = sFloatPrefs[i].floatVar; return NS_OK; }