#437, #417: tune up LookAndFeel; some more 10.7+ removals

This commit is contained in:
Cameron Kaiser 2017-09-02 13:44:20 -07:00
parent 94d5cb15d2
commit 981c2e8fef
3 changed files with 211 additions and 175 deletions

View File

@ -62,77 +62,77 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
switch (aID) { switch (aID) {
case eColorID_WindowBackground: case eColorID_WindowBackground:
aColor = NS_RGB(0xff,0xff,0xff); aColor = NS_RGB(0xff,0xff,0xff);
break; return res;
case eColorID_WindowForeground: case eColorID_WindowForeground:
aColor = NS_RGB(0x00,0x00,0x00); aColor = NS_RGB(0x00,0x00,0x00);
break; return res;
case eColorID_WidgetBackground: case eColorID_WidgetBackground:
aColor = NS_RGB(0xdd,0xdd,0xdd); aColor = NS_RGB(0xdd,0xdd,0xdd);
break; return res;
case eColorID_WidgetForeground: case eColorID_WidgetForeground:
aColor = NS_RGB(0x00,0x00,0x00); aColor = NS_RGB(0x00,0x00,0x00);
break; return res;
case eColorID_WidgetSelectBackground: case eColorID_WidgetSelectBackground:
aColor = NS_RGB(0x80,0x80,0x80); aColor = NS_RGB(0x80,0x80,0x80);
break; return res;
case eColorID_WidgetSelectForeground: case eColorID_WidgetSelectForeground:
aColor = NS_RGB(0x00,0x00,0x80); aColor = NS_RGB(0x00,0x00,0x80);
break; return res;
case eColorID_Widget3DHighlight: case eColorID_Widget3DHighlight:
aColor = NS_RGB(0xa0,0xa0,0xa0); aColor = NS_RGB(0xa0,0xa0,0xa0);
break; return res;
case eColorID_Widget3DShadow: case eColorID_Widget3DShadow:
aColor = NS_RGB(0x40,0x40,0x40); aColor = NS_RGB(0x40,0x40,0x40);
break; return res;
case eColorID_TextBackground: case eColorID_TextBackground:
aColor = NS_RGB(0xff,0xff,0xff); aColor = NS_RGB(0xff,0xff,0xff);
break; return res;
case eColorID_TextForeground: case eColorID_TextForeground:
aColor = NS_RGB(0x00,0x00,0x00); aColor = NS_RGB(0x00,0x00,0x00);
break; return res;
case eColorID_TextSelectBackground: case eColorID_TextSelectBackground:
aColor = GetColorFromNSColor([NSColor selectedTextBackgroundColor]); aColor = GetColorFromNSColor([NSColor selectedTextBackgroundColor]);
break; return res;
case eColorID_highlight: // CSS2 color case eColorID_highlight: // CSS2 color
aColor = GetColorFromNSColor([NSColor alternateSelectedControlColor]); aColor = GetColorFromNSColor([NSColor alternateSelectedControlColor]);
break; return res;
case eColorID__moz_menuhover: case eColorID__moz_menuhover:
aColor = GetColorFromNSColor([NSColor alternateSelectedControlColor]); aColor = GetColorFromNSColor([NSColor alternateSelectedControlColor]);
break; return res;
case eColorID_TextSelectForeground: case eColorID_TextSelectForeground:
GetColor(eColorID_TextSelectBackground, aColor); GetColor(eColorID_TextSelectBackground, aColor);
if (aColor == 0x000000) if (aColor == 0x000000)
aColor = NS_RGB(0xff,0xff,0xff); aColor = NS_RGB(0xff,0xff,0xff);
else else
aColor = NS_DONT_CHANGE_COLOR; aColor = NS_DONT_CHANGE_COLOR;
break; return res;
case eColorID_highlighttext: // CSS2 color case eColorID_highlighttext: // CSS2 color
case eColorID__moz_menuhovertext: case eColorID__moz_menuhovertext:
aColor = GetColorFromNSColor([NSColor alternateSelectedControlTextColor]); aColor = GetColorFromNSColor([NSColor alternateSelectedControlTextColor]);
break; return res;
case eColorID_IMESelectedRawTextBackground: case eColorID_IMESelectedRawTextBackground:
case eColorID_IMESelectedConvertedTextBackground: case eColorID_IMESelectedConvertedTextBackground:
case eColorID_IMERawInputBackground: case eColorID_IMERawInputBackground:
case eColorID_IMEConvertedTextBackground: case eColorID_IMEConvertedTextBackground:
aColor = NS_TRANSPARENT; aColor = NS_TRANSPARENT;
break; return res;
case eColorID_IMESelectedRawTextForeground: case eColorID_IMESelectedRawTextForeground:
case eColorID_IMESelectedConvertedTextForeground: case eColorID_IMESelectedConvertedTextForeground:
case eColorID_IMERawInputForeground: case eColorID_IMERawInputForeground:
case eColorID_IMEConvertedTextForeground: case eColorID_IMEConvertedTextForeground:
aColor = NS_SAME_AS_FOREGROUND_COLOR; aColor = NS_SAME_AS_FOREGROUND_COLOR;
break; return res;
case eColorID_IMERawInputUnderline: case eColorID_IMERawInputUnderline:
case eColorID_IMEConvertedTextUnderline: case eColorID_IMEConvertedTextUnderline:
aColor = NS_40PERCENT_FOREGROUND_COLOR; aColor = NS_40PERCENT_FOREGROUND_COLOR;
break; return res;
case eColorID_IMESelectedRawTextUnderline: case eColorID_IMESelectedRawTextUnderline:
case eColorID_IMESelectedConvertedTextUnderline: case eColorID_IMESelectedConvertedTextUnderline:
aColor = NS_SAME_AS_FOREGROUND_COLOR; aColor = NS_SAME_AS_FOREGROUND_COLOR;
break; return res;
case eColorID_SpellCheckerUnderline: case eColorID_SpellCheckerUnderline:
aColor = NS_RGB(0xff, 0, 0); aColor = NS_RGB(0xff, 0, 0);
break; return res;
// //
// css2 system colors http://www.w3.org/TR/REC-CSS2/ui.html#system-colors // css2 system colors http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
@ -147,158 +147,161 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
// //
case eColorID__moz_mac_buttonactivetext: case eColorID__moz_mac_buttonactivetext:
case eColorID__moz_mac_defaultbuttontext: case eColorID__moz_mac_defaultbuttontext:
#ifdef __LP64__
if (nsCocoaFeatures::OnYosemiteOrLater()) { if (nsCocoaFeatures::OnYosemiteOrLater()) {
aColor = NS_RGB(0xFF,0xFF,0xFF); aColor = NS_RGB(0xFF,0xFF,0xFF);
break; return res;
} }
// Otherwise fall through and return the regular button text: // Otherwise fall through and return the regular button text:
#endif
case eColorID_buttontext: case eColorID_buttontext:
case eColorID__moz_buttonhovertext: case eColorID__moz_buttonhovertext:
aColor = GetColorFromNSColor([NSColor controlTextColor]); aColor = GetColorFromNSColor([NSColor controlTextColor]);
break; return res;
case eColorID_captiontext: case eColorID_captiontext:
case eColorID_menutext: case eColorID_menutext:
case eColorID_infotext: case eColorID_infotext:
case eColorID__moz_menubartext: case eColorID__moz_menubartext:
aColor = GetColorFromNSColor([NSColor textColor]); aColor = GetColorFromNSColor([NSColor textColor]);
break; return res;
case eColorID_windowtext: case eColorID_windowtext:
aColor = GetColorFromNSColor([NSColor windowFrameTextColor]); aColor = GetColorFromNSColor([NSColor windowFrameTextColor]);
break; return res;
case eColorID_activecaption: case eColorID_activecaption:
aColor = GetColorFromNSColor([NSColor gridColor]); aColor = GetColorFromNSColor([NSColor gridColor]);
break; return res;
case eColorID_activeborder: case eColorID_activeborder:
aColor = NS_RGB(0x00,0x00,0x00); aColor = NS_RGB(0x00,0x00,0x00);
break; return res;
case eColorID_appworkspace: case eColorID_appworkspace:
aColor = NS_RGB(0xFF,0xFF,0xFF); aColor = NS_RGB(0xFF,0xFF,0xFF);
break; return res;
case eColorID_background: case eColorID_background:
aColor = NS_RGB(0x63,0x63,0xCE); aColor = NS_RGB(0x63,0x63,0xCE);
break; return res;
case eColorID_buttonface: case eColorID_buttonface:
case eColorID__moz_buttonhoverface: case eColorID__moz_buttonhoverface:
aColor = NS_RGB(0xF0,0xF0,0xF0); aColor = NS_RGB(0xF0,0xF0,0xF0);
break; return res;
case eColorID_buttonhighlight: case eColorID_buttonhighlight:
aColor = NS_RGB(0xFF,0xFF,0xFF); aColor = NS_RGB(0xFF,0xFF,0xFF);
break; return res;
case eColorID_buttonshadow: case eColorID_buttonshadow:
aColor = NS_RGB(0xDC,0xDC,0xDC); aColor = NS_RGB(0xDC,0xDC,0xDC);
break; return res;
case eColorID_graytext: case eColorID_graytext:
aColor = GetColorFromNSColor([NSColor disabledControlTextColor]); aColor = GetColorFromNSColor([NSColor disabledControlTextColor]);
break; return res;
case eColorID_inactiveborder: case eColorID_inactiveborder:
aColor = GetColorFromNSColor([NSColor controlBackgroundColor]); aColor = GetColorFromNSColor([NSColor controlBackgroundColor]);
break; return res;
case eColorID_inactivecaption: case eColorID_inactivecaption:
aColor = GetColorFromNSColor([NSColor controlBackgroundColor]); aColor = GetColorFromNSColor([NSColor controlBackgroundColor]);
break; return res;
case eColorID_inactivecaptiontext: case eColorID_inactivecaptiontext:
aColor = NS_RGB(0x45,0x45,0x45); aColor = NS_RGB(0x45,0x45,0x45);
break; return res;
case eColorID_scrollbar: case eColorID_scrollbar:
aColor = GetColorFromNSColor([NSColor scrollBarColor]); aColor = GetColorFromNSColor([NSColor scrollBarColor]);
break; return res;
case eColorID_threeddarkshadow: case eColorID_threeddarkshadow:
aColor = NS_RGB(0xDC,0xDC,0xDC); aColor = NS_RGB(0xDC,0xDC,0xDC);
break; return res;
case eColorID_threedshadow: case eColorID_threedshadow:
aColor = NS_RGB(0xE0,0xE0,0xE0); aColor = NS_RGB(0xE0,0xE0,0xE0);
break; return res;
case eColorID_threedface: case eColorID_threedface:
aColor = NS_RGB(0xF0,0xF0,0xF0); aColor = NS_RGB(0xF0,0xF0,0xF0);
break; return res;
case eColorID_threedhighlight: case eColorID_threedhighlight:
aColor = GetColorFromNSColor([NSColor highlightColor]); aColor = GetColorFromNSColor([NSColor highlightColor]);
break; return res;
case eColorID_threedlightshadow: case eColorID_threedlightshadow:
aColor = NS_RGB(0xDA,0xDA,0xDA); aColor = NS_RGB(0xDA,0xDA,0xDA);
break; return res;
case eColorID_menu: case eColorID_menu:
aColor = GetColorFromNSColor([NSColor alternateSelectedControlTextColor]); aColor = GetColorFromNSColor([NSColor alternateSelectedControlTextColor]);
break; return res;
case eColorID_infobackground: case eColorID_infobackground:
aColor = NS_RGB(0xFF,0xFF,0xC7); aColor = NS_RGB(0xFF,0xFF,0xC7);
break; return res;
case eColorID_windowframe: case eColorID_windowframe:
aColor = GetColorFromNSColor([NSColor gridColor]); aColor = GetColorFromNSColor([NSColor gridColor]);
break; return res;
case eColorID_window: case eColorID_window:
case eColorID__moz_field: case eColorID__moz_field:
case eColorID__moz_combobox: case eColorID__moz_combobox:
aColor = NS_RGB(0xff,0xff,0xff); aColor = NS_RGB(0xff,0xff,0xff);
break; return res;
case eColorID__moz_fieldtext: case eColorID__moz_fieldtext:
case eColorID__moz_comboboxtext: case eColorID__moz_comboboxtext:
aColor = GetColorFromNSColor([NSColor controlTextColor]); aColor = GetColorFromNSColor([NSColor controlTextColor]);
break; return res;
case eColorID__moz_dialog: case eColorID__moz_dialog:
aColor = GetColorFromNSColor([NSColor controlHighlightColor]); aColor = GetColorFromNSColor([NSColor controlHighlightColor]);
break; return res;
case eColorID__moz_dialogtext: case eColorID__moz_dialogtext:
case eColorID__moz_cellhighlighttext: case eColorID__moz_cellhighlighttext:
case eColorID__moz_html_cellhighlighttext: case eColorID__moz_html_cellhighlighttext:
aColor = GetColorFromNSColor([NSColor controlTextColor]); aColor = GetColorFromNSColor([NSColor controlTextColor]);
break; return res;
case eColorID__moz_dragtargetzone: case eColorID__moz_dragtargetzone:
aColor = GetColorFromNSColor([NSColor selectedControlColor]); aColor = GetColorFromNSColor([NSColor selectedControlColor]);
break; return res;
case eColorID__moz_mac_chrome_active: case eColorID__moz_mac_chrome_active:
case eColorID__moz_mac_chrome_inactive: { case eColorID__moz_mac_chrome_inactive: {
int grey = NativeGreyColorAsInt(headerEndGrey, (aID == eColorID__moz_mac_chrome_active)); int grey = NativeGreyColorAsInt(headerEndGrey, (aID == eColorID__moz_mac_chrome_active));
aColor = NS_RGB(grey, grey, grey); aColor = NS_RGB(grey, grey, grey);
} }
break; return res;
case eColorID__moz_mac_focusring: case eColorID__moz_mac_focusring:
aColor = GetColorFromNSColor([NSColor keyboardFocusIndicatorColor]); aColor = GetColorFromNSColor([NSColor keyboardFocusIndicatorColor]);
break; return res;
case eColorID__moz_mac_menushadow: case eColorID__moz_mac_menushadow:
aColor = NS_RGB(0xA3,0xA3,0xA3); aColor = NS_RGB(0xA3,0xA3,0xA3);
break; return res;
case eColorID__moz_mac_menutextdisable: case eColorID__moz_mac_menutextdisable:
aColor = NS_RGB(0x98,0x98,0x98); aColor = NS_RGB(0x98,0x98,0x98);
break; return res;
case eColorID__moz_mac_menutextselect: case eColorID__moz_mac_menutextselect:
aColor = GetColorFromNSColor([NSColor selectedMenuItemTextColor]); aColor = GetColorFromNSColor([NSColor selectedMenuItemTextColor]);
break; return res;
case eColorID__moz_mac_disabledtoolbartext: case eColorID__moz_mac_disabledtoolbartext:
aColor = GetColorFromNSColor([NSColor disabledControlTextColor]); aColor = GetColorFromNSColor([NSColor disabledControlTextColor]);
break; return res;
case eColorID__moz_mac_menuselect: case eColorID__moz_mac_menuselect:
aColor = GetColorFromNSColor([NSColor alternateSelectedControlColor]); aColor = GetColorFromNSColor([NSColor alternateSelectedControlColor]);
break; return res;
case eColorID__moz_buttondefault: case eColorID__moz_buttondefault:
aColor = NS_RGB(0xDC,0xDC,0xDC); aColor = NS_RGB(0xDC,0xDC,0xDC);
break; return res;
case eColorID__moz_cellhighlight: case eColorID__moz_cellhighlight:
case eColorID__moz_html_cellhighlight: case eColorID__moz_html_cellhighlight:
case eColorID__moz_mac_secondaryhighlight: case eColorID__moz_mac_secondaryhighlight:
// For inactive list selection // For inactive list selection
aColor = GetColorFromNSColor([NSColor secondarySelectedControlColor]); aColor = GetColorFromNSColor([NSColor secondarySelectedControlColor]);
break; return res;
case eColorID__moz_eventreerow: case eColorID__moz_eventreerow:
// Background color of even list rows. // Background color of even list rows.
aColor = GetColorFromNSColor([[NSColor controlAlternatingRowBackgroundColors] objectAtIndex:0]); aColor = GetColorFromNSColor([[NSColor controlAlternatingRowBackgroundColors] objectAtIndex:0]);
break; return res;
case eColorID__moz_oddtreerow: case eColorID__moz_oddtreerow:
// Background color of odd list rows. // Background color of odd list rows.
aColor = GetColorFromNSColor([[NSColor controlAlternatingRowBackgroundColors] objectAtIndex:1]); aColor = GetColorFromNSColor([[NSColor controlAlternatingRowBackgroundColors] objectAtIndex:1]);
break; return res;
case eColorID__moz_nativehyperlinktext: case eColorID__moz_nativehyperlinktext:
// There appears to be no available system defined color. HARDCODING to the appropriate color. // There appears to be no available system defined color. HARDCODING to the appropriate color.
aColor = NS_RGB(0x14,0x4F,0xAE); aColor = NS_RGB(0x14,0x4F,0xAE);
break; return res;
default: default:
NS_WARNING("Someone asked nsILookAndFeel for a color I don't know about"); NS_WARNING("Someone asked nsILookAndFeel for a color I don't know about");
aColor = NS_RGB(0xff,0xff,0xff); aColor = NS_RGB(0xff,0xff,0xff);
res = NS_ERROR_FAILURE; res = NS_ERROR_FAILURE;
break; return res;
} }
// unreachable?
res = NS_ERROR_FAILURE;
return res; return res;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
@ -317,35 +320,35 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
switch (aID) { switch (aID) {
case eIntID_CaretBlinkTime: case eIntID_CaretBlinkTime:
aResult = 567; aResult = 567;
break; return res;
case eIntID_CaretWidth: case eIntID_CaretWidth:
aResult = 1; aResult = 1;
break; return res;
case eIntID_ShowCaretDuringSelection: case eIntID_ShowCaretDuringSelection:
aResult = 0; aResult = 0;
break; return res;
case eIntID_SelectTextfieldsOnKeyFocus: case eIntID_SelectTextfieldsOnKeyFocus:
// Select textfield content when focused by kbd // Select textfield content when focused by kbd
// used by EventStateManager::sTextfieldSelectModel // used by EventStateManager::sTextfieldSelectModel
aResult = 1; aResult = 1;
break; return res;
case eIntID_SubmenuDelay: case eIntID_SubmenuDelay:
aResult = 200; aResult = 200;
break; return res;
case eIntID_TooltipDelay: case eIntID_TooltipDelay:
aResult = 500; aResult = 500;
break; return res;
case eIntID_MenusCanOverlapOSBar: case eIntID_MenusCanOverlapOSBar:
// xul popups are not allowed to overlap the menubar. // xul popups are not allowed to overlap the menubar.
aResult = 0; aResult = 0;
break; return res;
case eIntID_SkipNavigatingDisabledMenuItem: case eIntID_SkipNavigatingDisabledMenuItem:
aResult = 1; aResult = 1;
break; return res;
case eIntID_DragThresholdX: case eIntID_DragThresholdX:
case eIntID_DragThresholdY: case eIntID_DragThresholdY:
aResult = 4; aResult = 4;
break; return res;
case eIntID_ScrollArrowStyle: case eIntID_ScrollArrowStyle:
#ifdef __LP64__ #ifdef __LP64__
if (nsCocoaFeatures::OnLionOrLater()) { if (nsCocoaFeatures::OnLionOrLater()) {
@ -369,10 +372,10 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
} }
[pool drain]; [pool drain];
} }
break; return res;
case eIntID_ScrollSliderStyle: case eIntID_ScrollSliderStyle:
aResult = eScrollThumbStyle_Proportional; aResult = eScrollThumbStyle_Proportional;
break; return res;
case eIntID_UseOverlayScrollbars: case eIntID_UseOverlayScrollbars:
aResult = 0; aResult = 0;
#ifdef __LP64__ #ifdef __LP64__
@ -382,7 +385,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
} }
aResult = mUseOverlayScrollbars; aResult = mUseOverlayScrollbars;
#endif #endif
break; return res;
case eIntID_AllowOverlayScrollbarsOverlap: case eIntID_AllowOverlayScrollbarsOverlap:
aResult = 0; aResult = 0;
#ifdef __LP64__ #ifdef __LP64__
@ -392,31 +395,31 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
} }
aResult = mAllowOverlayScrollbarsOverlap; aResult = mAllowOverlayScrollbarsOverlap;
#endif #endif
break; return res;
case eIntID_ScrollbarDisplayOnMouseMove: case eIntID_ScrollbarDisplayOnMouseMove:
aResult = 0; aResult = 0;
break; return res;
case eIntID_ScrollbarFadeBeginDelay: case eIntID_ScrollbarFadeBeginDelay:
aResult = 450; aResult = 450;
break; return res;
case eIntID_ScrollbarFadeDuration: case eIntID_ScrollbarFadeDuration:
aResult = 200; aResult = 200;
break; return res;
case eIntID_TreeOpenDelay: case eIntID_TreeOpenDelay:
aResult = 1000; aResult = 1000;
break; return res;
case eIntID_TreeCloseDelay: case eIntID_TreeCloseDelay:
aResult = 1000; aResult = 1000;
break; return res;
case eIntID_TreeLazyScrollDelay: case eIntID_TreeLazyScrollDelay:
aResult = 150; aResult = 150;
break; return res;
case eIntID_TreeScrollDelay: case eIntID_TreeScrollDelay:
aResult = 100; aResult = 100;
break; return res;
case eIntID_TreeScrollLinesMax: case eIntID_TreeScrollLinesMax:
aResult = 3; aResult = 3;
break; return res;
case eIntID_DWMCompositor: case eIntID_DWMCompositor:
case eIntID_WindowsClassic: case eIntID_WindowsClassic:
case eIntID_WindowsDefaultTheme: case eIntID_WindowsDefaultTheme:
@ -425,21 +428,22 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
case eIntID_OperatingSystemVersionIdentifier: case eIntID_OperatingSystemVersionIdentifier:
aResult = 0; aResult = 0;
res = NS_ERROR_NOT_IMPLEMENTED; res = NS_ERROR_NOT_IMPLEMENTED;
break; return res;
case eIntID_MacGraphiteTheme: case eIntID_MacGraphiteTheme:
aResult = [NSColor currentControlTint] == NSGraphiteControlTint; aResult = [NSColor currentControlTint] == NSGraphiteControlTint;
break; return res;
case eIntID_MacLionTheme: case eIntID_MacLionTheme:
aResult = nsCocoaFeatures::OnLionOrLater(); aResult = nsCocoaFeatures::OnLionOrLater();
break; return res;
case eIntID_MacYosemiteTheme: case eIntID_MacYosemiteTheme:
aResult = nsCocoaFeatures::OnYosemiteOrLater(); aResult = nsCocoaFeatures::OnYosemiteOrLater();
break; return res;
case eIntID_AlertNotificationOrigin: case eIntID_AlertNotificationOrigin:
aResult = NS_ALERT_TOP; aResult = NS_ALERT_TOP;
break; return res;
case eIntID_TabFocusModel: case eIntID_TabFocusModel:
{ {
fprintf(stderr, "TabFocusModel\n");
// we should probably cache this // we should probably cache this
CFPropertyListRef fullKeyboardAccessProperty; CFPropertyListRef fullKeyboardAccessProperty;
fullKeyboardAccessProperty = ::CFPreferencesCopyValue(CFSTR("AppleKeyboardUIMode"), fullKeyboardAccessProperty = ::CFPreferencesCopyValue(CFSTR("AppleKeyboardUIMode"),
@ -457,27 +461,27 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
::CFRelease(fullKeyboardAccessProperty); ::CFRelease(fullKeyboardAccessProperty);
} }
} }
break; return res;
case eIntID_ScrollToClick: case eIntID_ScrollToClick:
{ {
aResult = [[NSUserDefaults standardUserDefaults] boolForKey:@"AppleScrollerPagingBehavior"]; aResult = [[NSUserDefaults standardUserDefaults] boolForKey:@"AppleScrollerPagingBehavior"];
} }
break; return res;
case eIntID_ChosenMenuItemsShouldBlink: case eIntID_ChosenMenuItemsShouldBlink:
aResult = 1; aResult = 1;
break; return res;
case eIntID_IMERawInputUnderlineStyle: case eIntID_IMERawInputUnderlineStyle:
case eIntID_IMEConvertedTextUnderlineStyle: case eIntID_IMEConvertedTextUnderlineStyle:
case eIntID_IMESelectedRawTextUnderlineStyle: case eIntID_IMESelectedRawTextUnderlineStyle:
case eIntID_IMESelectedConvertedTextUnderline: case eIntID_IMESelectedConvertedTextUnderline:
aResult = NS_STYLE_TEXT_DECORATION_STYLE_SOLID; aResult = NS_STYLE_TEXT_DECORATION_STYLE_SOLID;
break; return res;
case eIntID_SpellCheckerUnderlineStyle: case eIntID_SpellCheckerUnderlineStyle:
aResult = NS_STYLE_TEXT_DECORATION_STYLE_DOTTED; aResult = NS_STYLE_TEXT_DECORATION_STYLE_DOTTED;
break; return res;
case eIntID_ScrollbarButtonAutoRepeatBehavior: case eIntID_ScrollbarButtonAutoRepeatBehavior:
aResult = 0; aResult = 0;
break; return res;
case eIntID_SwipeAnimationEnabled: case eIntID_SwipeAnimationEnabled:
aResult = 0; aResult = 0;
#ifdef __LP64__ #ifdef __LP64__
@ -486,16 +490,16 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
aResult = [NSEvent isSwipeTrackingFromScrollEventsEnabled] ? 1 : 0; aResult = [NSEvent isSwipeTrackingFromScrollEventsEnabled] ? 1 : 0;
} }
#endif #endif
break; return res;
case eIntID_ColorPickerAvailable: case eIntID_ColorPickerAvailable:
aResult = 1; aResult = 1;
break; return res;
case eIntID_ContextMenuOffsetVertical: case eIntID_ContextMenuOffsetVertical:
aResult = -6; aResult = -6;
break; return res;
case eIntID_ContextMenuOffsetHorizontal: case eIntID_ContextMenuOffsetHorizontal:
aResult = 1; aResult = 1;
break; return res;
default: default:
aResult = 0; aResult = 0;
res = NS_ERROR_FAILURE; res = NS_ERROR_FAILURE;
@ -516,10 +520,10 @@ nsLookAndFeel::GetFloatImpl(FloatID aID, float &aResult)
switch (aID) { switch (aID) {
case eFloatID_IMEUnderlineRelativeSize: case eFloatID_IMEUnderlineRelativeSize:
aResult = 2.0f; aResult = 2.0f;
break; return res;
case eFloatID_SpellCheckerUnderlineRelativeSize: case eFloatID_SpellCheckerUnderlineRelativeSize:
aResult = 2.0f; aResult = 2.0f;
break; return res;
default: default:
aResult = -1.0; aResult = -1.0;
res = NS_ERROR_FAILURE; res = NS_ERROR_FAILURE;
@ -589,6 +593,8 @@ nsLookAndFeel::GetIntCacheImpl()
nsTArray<LookAndFeelInt> lookAndFeelIntCache = nsTArray<LookAndFeelInt> lookAndFeelIntCache =
nsXPLookAndFeel::GetIntCacheImpl(); nsXPLookAndFeel::GetIntCacheImpl();
// Useless before 10.7.
#ifdef __LP64__
LookAndFeelInt useOverlayScrollbars; LookAndFeelInt useOverlayScrollbars;
useOverlayScrollbars.id = eIntID_UseOverlayScrollbars; useOverlayScrollbars.id = eIntID_UseOverlayScrollbars;
useOverlayScrollbars.value = GetInt(eIntID_UseOverlayScrollbars); useOverlayScrollbars.value = GetInt(eIntID_UseOverlayScrollbars);
@ -598,6 +604,7 @@ nsLookAndFeel::GetIntCacheImpl()
allowOverlayScrollbarsOverlap.id = eIntID_AllowOverlayScrollbarsOverlap; allowOverlayScrollbarsOverlap.id = eIntID_AllowOverlayScrollbarsOverlap;
allowOverlayScrollbarsOverlap.value = GetInt(eIntID_AllowOverlayScrollbarsOverlap); allowOverlayScrollbarsOverlap.value = GetInt(eIntID_AllowOverlayScrollbarsOverlap);
lookAndFeelIntCache.AppendElement(allowOverlayScrollbarsOverlap); lookAndFeelIntCache.AppendElement(allowOverlayScrollbarsOverlap);
#endif
return lookAndFeelIntCache; return lookAndFeelIntCache;
} }
@ -605,23 +612,28 @@ nsLookAndFeel::GetIntCacheImpl()
void void
nsLookAndFeel::SetIntCacheImpl(const nsTArray<LookAndFeelInt>& aLookAndFeelIntCache) nsLookAndFeel::SetIntCacheImpl(const nsTArray<LookAndFeelInt>& aLookAndFeelIntCache)
{ {
// Useless before 10.7.
#ifdef __LP64__
for (auto entry : aLookAndFeelIntCache) { for (auto entry : aLookAndFeelIntCache) {
switch(entry.id) { switch(entry.id) {
case eIntID_UseOverlayScrollbars: case eIntID_UseOverlayScrollbars:
mUseOverlayScrollbars = entry.value; mUseOverlayScrollbars = entry.value;
mUseOverlayScrollbarsCached = true; mUseOverlayScrollbarsCached = true;
break; return res;
case eIntID_AllowOverlayScrollbarsOverlap: case eIntID_AllowOverlayScrollbarsOverlap:
mAllowOverlayScrollbarsOverlap = entry.value; mAllowOverlayScrollbarsOverlap = entry.value;
mAllowOverlayScrollbarsOverlapCached = true; mAllowOverlayScrollbarsOverlapCached = true;
break; return res;
} }
} }
#endif
} }
void void
nsLookAndFeel::RefreshImpl() nsLookAndFeel::RefreshImpl()
{ {
// Useless before 10.7.
#ifdef __LP64__
// We should only clear the cache if we're in the main browser process. // We should only clear the cache if we're in the main browser process.
// Otherwise, we should wait for the parent to inform us of new values // Otherwise, we should wait for the parent to inform us of new values
// to cache via LookAndFeel::SetIntCache. // to cache via LookAndFeel::SetIntCache.
@ -629,4 +641,5 @@ nsLookAndFeel::RefreshImpl()
mUseOverlayScrollbarsCached = false; mUseOverlayScrollbarsCached = false;
mAllowOverlayScrollbarsOverlapCached = false; mAllowOverlayScrollbarsOverlapCached = false;
} }
#endif
} }

View File

@ -250,6 +250,8 @@ bool nsXPLookAndFeel::sUseStandinsForNativeColors = false;
nsLookAndFeel* nsXPLookAndFeel::sInstance = nullptr; nsLookAndFeel* nsXPLookAndFeel::sInstance = nullptr;
bool nsXPLookAndFeel::sShutdown = false; bool nsXPLookAndFeel::sShutdown = false;
bool nsXPLookAndFeel::sAnyIntPrefsSet = false;
bool nsXPLookAndFeel::sAnyFloatPrefsSet = false;
// static // static
nsLookAndFeel* nsLookAndFeel*
@ -296,6 +298,7 @@ nsXPLookAndFeel::IntPrefChanged(nsLookAndFeelIntPref *data)
} }
data->intVar = intpref; data->intVar = intpref;
data->isSet = true; data->isSet = true;
sAnyIntPrefsSet = true;
#ifdef DEBUG_akkana #ifdef DEBUG_akkana
printf("====== Changed int pref %s to %d\n", data->name, data->intVar); printf("====== Changed int pref %s to %d\n", data->name, data->intVar);
#endif #endif
@ -316,6 +319,7 @@ nsXPLookAndFeel::FloatPrefChanged(nsLookAndFeelFloatPref *data)
} }
data->floatVar = (float)intpref / 100.0f; data->floatVar = (float)intpref / 100.0f;
data->isSet = true; data->isSet = true;
sAnyFloatPrefsSet = true;
#ifdef DEBUG_akkana #ifdef DEBUG_akkana
printf("====== Changed float pref %s to %f\n", data->name, data->floatVar); printf("====== Changed float pref %s to %f\n", data->name, data->floatVar);
#endif #endif
@ -359,6 +363,7 @@ nsXPLookAndFeel::InitFromPref(nsLookAndFeelIntPref* aPref)
int32_t intpref; int32_t intpref;
nsresult rv = Preferences::GetInt(aPref->name, &intpref); nsresult rv = Preferences::GetInt(aPref->name, &intpref);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
sAnyIntPrefsSet = true;
aPref->isSet = true; aPref->isSet = true;
aPref->intVar = intpref; aPref->intVar = intpref;
} }
@ -370,6 +375,7 @@ nsXPLookAndFeel::InitFromPref(nsLookAndFeelFloatPref* aPref)
int32_t intpref; int32_t intpref;
nsresult rv = Preferences::GetInt(aPref->name, &intpref); nsresult rv = Preferences::GetInt(aPref->name, &intpref);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
sAnyFloatPrefsSet = true;
aPref->isSet = true; aPref->isSet = true;
aPref->floatVar = (float)intpref / 100.0f; aPref->floatVar = (float)intpref / 100.0f;
} }
@ -404,6 +410,11 @@ nsXPLookAndFeel::OnPrefChanged(const char* aPref, void* aClosure)
nsDependentCString prefName(aPref); nsDependentCString prefName(aPref);
unsigned int i; unsigned int i;
// reset the set caches just in case we can optimize checks away
sAnyFloatPrefsSet = false;
sAnyIntPrefsSet = false;
for (i = 0; i < ArrayLength(sIntPrefs); ++i) { for (i = 0; i < ArrayLength(sIntPrefs); ++i) {
if (prefName.Equals(sIntPrefs[i].name)) { if (prefName.Equals(sIntPrefs[i].name)) {
IntPrefChanged(&sIntPrefs[i]); IntPrefChanged(&sIntPrefs[i]);
@ -446,6 +457,11 @@ nsXPLookAndFeel::Init()
Preferences::RegisterCallback(OnPrefChanged, "accessibility.tabfocus"); Preferences::RegisterCallback(OnPrefChanged, "accessibility.tabfocus");
unsigned int i; unsigned int i;
// reset the set caches just in case we can optimize checks away
sAnyFloatPrefsSet = false;
sAnyIntPrefsSet = false;
for (i = 0; i < ArrayLength(sIntPrefs); ++i) { for (i = 0; i < ArrayLength(sIntPrefs); ++i) {
InitFromPref(&sIntPrefs[i]); InitFromPref(&sIntPrefs[i]);
} }
@ -465,6 +481,8 @@ nsXPLookAndFeel::Init()
"ui.use_standins_for_native_colors", "ui.use_standins_for_native_colors",
sUseStandinsForNativeColors); sUseStandinsForNativeColors);
// Unpossible in TenFourFox and irrelevant before 10.7.
#ifdef __LP64__
if (XRE_IsContentProcess()) { if (XRE_IsContentProcess()) {
mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild* cc =
mozilla::dom::ContentChild::GetSingleton(); mozilla::dom::ContentChild::GetSingleton();
@ -473,6 +491,7 @@ nsXPLookAndFeel::Init()
cc->SendGetLookAndFeelCache(&lookAndFeelIntCache); cc->SendGetLookAndFeelCache(&lookAndFeelIntCache);
LookAndFeel::SetIntCache(lookAndFeelIntCache); LookAndFeel::SetIntCache(lookAndFeelIntCache);
} }
#endif
} }
nsXPLookAndFeel::~nsXPLookAndFeel() nsXPLookAndFeel::~nsXPLookAndFeel()
@ -548,9 +567,9 @@ nsXPLookAndFeel::ColorIsNotCSSAccessible(ColorID aID)
case eColorID_IMESelectedConvertedTextUnderline: case eColorID_IMESelectedConvertedTextUnderline:
case eColorID_SpellCheckerUnderline: case eColorID_SpellCheckerUnderline:
result = true; result = true;
break; return result;
default: default:
break; return result;
} }
return result; return result;
@ -565,95 +584,95 @@ nsXPLookAndFeel::GetStandinForNativeColor(ColorID aID)
// except Mac-specific colors which are taken from Mac OS 10.7. // except Mac-specific colors which are taken from Mac OS 10.7.
switch (aID) { switch (aID) {
// CSS 2 colors: // CSS 2 colors:
case eColorID_activeborder: result = NS_RGB(0xB4, 0xB4, 0xB4); break; case eColorID_activeborder: result = NS_RGB(0xB4, 0xB4, 0xB4); return result;
case eColorID_activecaption: result = NS_RGB(0x99, 0xB4, 0xD1); break; case eColorID_activecaption: result = NS_RGB(0x99, 0xB4, 0xD1); return result;
case eColorID_appworkspace: result = NS_RGB(0xAB, 0xAB, 0xAB); break; case eColorID_appworkspace: result = NS_RGB(0xAB, 0xAB, 0xAB); return result;
case eColorID_background: result = NS_RGB(0x00, 0x00, 0x00); break; case eColorID_background: result = NS_RGB(0x00, 0x00, 0x00); return result;
case eColorID_buttonface: result = NS_RGB(0xF0, 0xF0, 0xF0); break; case eColorID_buttonface: result = NS_RGB(0xF0, 0xF0, 0xF0); return result;
case eColorID_buttonhighlight: result = NS_RGB(0xFF, 0xFF, 0xFF); break; case eColorID_buttonhighlight: result = NS_RGB(0xFF, 0xFF, 0xFF); return result;
case eColorID_buttonshadow: result = NS_RGB(0xA0, 0xA0, 0xA0); break; case eColorID_buttonshadow: result = NS_RGB(0xA0, 0xA0, 0xA0); return result;
case eColorID_buttontext: result = NS_RGB(0x00, 0x00, 0x00); break; case eColorID_buttontext: result = NS_RGB(0x00, 0x00, 0x00); return result;
case eColorID_captiontext: result = NS_RGB(0x00, 0x00, 0x00); break; case eColorID_captiontext: result = NS_RGB(0x00, 0x00, 0x00); return result;
case eColorID_graytext: result = NS_RGB(0x6D, 0x6D, 0x6D); break; case eColorID_graytext: result = NS_RGB(0x6D, 0x6D, 0x6D); return result;
case eColorID_highlight: result = NS_RGB(0x33, 0x99, 0xFF); break; case eColorID_highlight: result = NS_RGB(0x33, 0x99, 0xFF); return result;
case eColorID_highlighttext: result = NS_RGB(0xFF, 0xFF, 0xFF); break; case eColorID_highlighttext: result = NS_RGB(0xFF, 0xFF, 0xFF); return result;
case eColorID_inactiveborder: result = NS_RGB(0xF4, 0xF7, 0xFC); break; case eColorID_inactiveborder: result = NS_RGB(0xF4, 0xF7, 0xFC); return result;
case eColorID_inactivecaption: result = NS_RGB(0xBF, 0xCD, 0xDB); break; case eColorID_inactivecaption: result = NS_RGB(0xBF, 0xCD, 0xDB); return result;
case eColorID_inactivecaptiontext: case eColorID_inactivecaptiontext:
result = NS_RGB(0x43, 0x4E, 0x54); break; result = NS_RGB(0x43, 0x4E, 0x54); return result;
case eColorID_infobackground: result = NS_RGB(0xFF, 0xFF, 0xE1); break; case eColorID_infobackground: result = NS_RGB(0xFF, 0xFF, 0xE1); return result;
case eColorID_infotext: result = NS_RGB(0x00, 0x00, 0x00); break; case eColorID_infotext: result = NS_RGB(0x00, 0x00, 0x00); return result;
case eColorID_menu: result = NS_RGB(0xF0, 0xF0, 0xF0); break; case eColorID_menu: result = NS_RGB(0xF0, 0xF0, 0xF0); return result;
case eColorID_menutext: result = NS_RGB(0x00, 0x00, 0x00); break; case eColorID_menutext: result = NS_RGB(0x00, 0x00, 0x00); return result;
case eColorID_scrollbar: result = NS_RGB(0xC8, 0xC8, 0xC8); break; case eColorID_scrollbar: result = NS_RGB(0xC8, 0xC8, 0xC8); return result;
case eColorID_threeddarkshadow: result = NS_RGB(0x69, 0x69, 0x69); break; case eColorID_threeddarkshadow: result = NS_RGB(0x69, 0x69, 0x69); return result;
case eColorID_threedface: result = NS_RGB(0xF0, 0xF0, 0xF0); break; case eColorID_threedface: result = NS_RGB(0xF0, 0xF0, 0xF0); return result;
case eColorID_threedhighlight: result = NS_RGB(0xFF, 0xFF, 0xFF); break; case eColorID_threedhighlight: result = NS_RGB(0xFF, 0xFF, 0xFF); return result;
case eColorID_threedlightshadow: result = NS_RGB(0xE3, 0xE3, 0xE3); break; case eColorID_threedlightshadow: result = NS_RGB(0xE3, 0xE3, 0xE3); return result;
case eColorID_threedshadow: result = NS_RGB(0xA0, 0xA0, 0xA0); break; case eColorID_threedshadow: result = NS_RGB(0xA0, 0xA0, 0xA0); return result;
case eColorID_window: result = NS_RGB(0xFF, 0xFF, 0xFF); break; case eColorID_window: result = NS_RGB(0xFF, 0xFF, 0xFF); return result;
case eColorID_windowframe: result = NS_RGB(0x64, 0x64, 0x64); break; case eColorID_windowframe: result = NS_RGB(0x64, 0x64, 0x64); return result;
case eColorID_windowtext: result = NS_RGB(0x00, 0x00, 0x00); break; case eColorID_windowtext: result = NS_RGB(0x00, 0x00, 0x00); return result;
case eColorID__moz_buttondefault: case eColorID__moz_buttondefault:
result = NS_RGB(0x69, 0x69, 0x69); break; result = NS_RGB(0x69, 0x69, 0x69); return result;
case eColorID__moz_field: result = NS_RGB(0xFF, 0xFF, 0xFF); break; case eColorID__moz_field: result = NS_RGB(0xFF, 0xFF, 0xFF); return result;
case eColorID__moz_fieldtext: result = NS_RGB(0x00, 0x00, 0x00); break; case eColorID__moz_fieldtext: result = NS_RGB(0x00, 0x00, 0x00); return result;
case eColorID__moz_dialog: result = NS_RGB(0xF0, 0xF0, 0xF0); break; case eColorID__moz_dialog: result = NS_RGB(0xF0, 0xF0, 0xF0); return result;
case eColorID__moz_dialogtext: result = NS_RGB(0x00, 0x00, 0x00); break; case eColorID__moz_dialogtext: result = NS_RGB(0x00, 0x00, 0x00); return result;
case eColorID__moz_dragtargetzone: case eColorID__moz_dragtargetzone:
result = NS_RGB(0xFF, 0xFF, 0xFF); break; result = NS_RGB(0xFF, 0xFF, 0xFF); return result;
case eColorID__moz_cellhighlight: case eColorID__moz_cellhighlight:
result = NS_RGB(0xF0, 0xF0, 0xF0); break; result = NS_RGB(0xF0, 0xF0, 0xF0); return result;
case eColorID__moz_cellhighlighttext: case eColorID__moz_cellhighlighttext:
result = NS_RGB(0x00, 0x00, 0x00); break; result = NS_RGB(0x00, 0x00, 0x00); return result;
case eColorID__moz_html_cellhighlight: case eColorID__moz_html_cellhighlight:
result = NS_RGB(0x33, 0x99, 0xFF); break; result = NS_RGB(0x33, 0x99, 0xFF); return result;
case eColorID__moz_html_cellhighlighttext: case eColorID__moz_html_cellhighlighttext:
result = NS_RGB(0xFF, 0xFF, 0xFF); break; result = NS_RGB(0xFF, 0xFF, 0xFF); return result;
case eColorID__moz_buttonhoverface: case eColorID__moz_buttonhoverface:
result = NS_RGB(0xF0, 0xF0, 0xF0); break; result = NS_RGB(0xF0, 0xF0, 0xF0); return result;
case eColorID__moz_buttonhovertext: case eColorID__moz_buttonhovertext:
result = NS_RGB(0x00, 0x00, 0x00); break; result = NS_RGB(0x00, 0x00, 0x00); return result;
case eColorID__moz_menuhover: case eColorID__moz_menuhover:
result = NS_RGB(0x33, 0x99, 0xFF); break; result = NS_RGB(0x33, 0x99, 0xFF); return result;
case eColorID__moz_menuhovertext: case eColorID__moz_menuhovertext:
result = NS_RGB(0x00, 0x00, 0x00); break; result = NS_RGB(0x00, 0x00, 0x00); return result;
case eColorID__moz_menubartext: case eColorID__moz_menubartext:
result = NS_RGB(0x00, 0x00, 0x00); break; result = NS_RGB(0x00, 0x00, 0x00); return result;
case eColorID__moz_menubarhovertext: case eColorID__moz_menubarhovertext:
result = NS_RGB(0x00, 0x00, 0x00); break; result = NS_RGB(0x00, 0x00, 0x00); return result;
case eColorID__moz_oddtreerow: case eColorID__moz_oddtreerow:
result = NS_RGB(0xFF, 0xFF, 0xFF); break; result = NS_RGB(0xFF, 0xFF, 0xFF); return result;
case eColorID__moz_mac_chrome_active: case eColorID__moz_mac_chrome_active:
result = NS_RGB(0xB2, 0xB2, 0xB2); break; result = NS_RGB(0xB2, 0xB2, 0xB2); return result;
case eColorID__moz_mac_chrome_inactive: case eColorID__moz_mac_chrome_inactive:
result = NS_RGB(0xE1, 0xE1, 0xE1); break; result = NS_RGB(0xE1, 0xE1, 0xE1); return result;
case eColorID__moz_mac_focusring: case eColorID__moz_mac_focusring:
result = NS_RGB(0x60, 0x9D, 0xD7); break; result = NS_RGB(0x60, 0x9D, 0xD7); return result;
case eColorID__moz_mac_menuselect: case eColorID__moz_mac_menuselect:
result = NS_RGB(0x38, 0x75, 0xD7); break; result = NS_RGB(0x38, 0x75, 0xD7); return result;
case eColorID__moz_mac_menushadow: case eColorID__moz_mac_menushadow:
result = NS_RGB(0xA3, 0xA3, 0xA3); break; result = NS_RGB(0xA3, 0xA3, 0xA3); return result;
case eColorID__moz_mac_menutextdisable: case eColorID__moz_mac_menutextdisable:
result = NS_RGB(0x88, 0x88, 0x88); break; result = NS_RGB(0x88, 0x88, 0x88); return result;
case eColorID__moz_mac_menutextselect: case eColorID__moz_mac_menutextselect:
result = NS_RGB(0xFF, 0xFF, 0xFF); break; result = NS_RGB(0xFF, 0xFF, 0xFF); return result;
case eColorID__moz_mac_disabledtoolbartext: case eColorID__moz_mac_disabledtoolbartext:
result = NS_RGB(0x3F, 0x3F, 0x3F); break; result = NS_RGB(0x3F, 0x3F, 0x3F); return result;
case eColorID__moz_mac_secondaryhighlight: case eColorID__moz_mac_secondaryhighlight:
result = NS_RGB(0xD4, 0xD4, 0xD4); break; result = NS_RGB(0xD4, 0xD4, 0xD4); return result;
case eColorID__moz_win_mediatext: case eColorID__moz_win_mediatext:
result = NS_RGB(0xFF, 0xFF, 0xFF); break; result = NS_RGB(0xFF, 0xFF, 0xFF); return result;
case eColorID__moz_win_communicationstext: case eColorID__moz_win_communicationstext:
result = NS_RGB(0xFF, 0xFF, 0xFF); break; result = NS_RGB(0xFF, 0xFF, 0xFF); return result;
case eColorID__moz_nativehyperlinktext: case eColorID__moz_nativehyperlinktext:
result = NS_RGB(0x00, 0x66, 0xCC); break; result = NS_RGB(0x00, 0x66, 0xCC); return result;
case eColorID__moz_comboboxtext: case eColorID__moz_comboboxtext:
result = NS_RGB(0x00, 0x00, 0x00); break; result = NS_RGB(0x00, 0x00, 0x00); return result;
case eColorID__moz_combobox: case eColorID__moz_combobox:
result = NS_RGB(0xFF, 0xFF, 0xFF); break; result = NS_RGB(0xFF, 0xFF, 0xFF); return result;
default: default:
break; return result;
} }
return result; return result;
@ -689,35 +708,35 @@ nsXPLookAndFeel::GetColorImpl(ColorID aID, bool aUseStandinsForNativeColors,
case eColorID_captiontext: case eColorID_captiontext:
// text in active window caption // text in active window caption
aResult = NS_RGB(0xff, 0x00, 0x00); aResult = NS_RGB(0xff, 0x00, 0x00);
break; return result;
case eColorID_highlight: case eColorID_highlight:
// background of selected item // background of selected item
case eColorID_highlighttext: case eColorID_highlighttext:
// text of selected item // text of selected item
aResult = NS_RGB(0xff, 0xff, 0x00); aResult = NS_RGB(0xff, 0xff, 0x00);
break; return result;
case eColorID_inactivecaption: case eColorID_inactivecaption:
// inactive window caption // inactive window caption
case eColorID_inactivecaptiontext: case eColorID_inactivecaptiontext:
// text in inactive window caption // text in inactive window caption
aResult = NS_RGB(0x66, 0x66, 0x00); aResult = NS_RGB(0x66, 0x66, 0x00);
break; return result;
case eColorID_infobackground: case eColorID_infobackground:
// tooltip background color // tooltip background color
case eColorID_infotext: case eColorID_infotext:
// tooltip text color // tooltip text color
aResult = NS_RGB(0x00, 0xff, 0x00); aResult = NS_RGB(0x00, 0xff, 0x00);
break; return result;
case eColorID_menu: case eColorID_menu:
// menu background // menu background
case eColorID_menutext: case eColorID_menutext:
// menu text // menu text
aResult = NS_RGB(0x00, 0xff, 0xff); aResult = NS_RGB(0x00, 0xff, 0xff);
break; return result;
case eColorID_threedface: case eColorID_threedface:
case eColorID_buttonface: case eColorID_buttonface:
@ -725,12 +744,12 @@ nsXPLookAndFeel::GetColorImpl(ColorID aID, bool aUseStandinsForNativeColors,
case eColorID_buttontext: case eColorID_buttontext:
// text on push buttons // text on push buttons
aResult = NS_RGB(0x00, 0x66, 0x66); aResult = NS_RGB(0x00, 0x66, 0x66);
break; return result;
case eColorID_window: case eColorID_window:
case eColorID_windowtext: case eColorID_windowtext:
aResult = NS_RGB(0x00, 0x00, 0xff); aResult = NS_RGB(0x00, 0x00, 0xff);
break; return result;
// from the CSS3 working draft (not yet finalized) // from the CSS3 working draft (not yet finalized)
// http://www.w3.org/tr/2000/wd-css3-userint-20000216.html#color // http://www.w3.org/tr/2000/wd-css3-userint-20000216.html#color
@ -738,12 +757,12 @@ nsXPLookAndFeel::GetColorImpl(ColorID aID, bool aUseStandinsForNativeColors,
case eColorID__moz_field: case eColorID__moz_field:
case eColorID__moz_fieldtext: case eColorID__moz_fieldtext:
aResult = NS_RGB(0xff, 0x00, 0xff); aResult = NS_RGB(0xff, 0x00, 0xff);
break; return result;
case eColorID__moz_dialog: case eColorID__moz_dialog:
case eColorID__moz_dialogtext: case eColorID__moz_dialogtext:
aResult = NS_RGB(0x66, 0x00, 0x66); aResult = NS_RGB(0x66, 0x00, 0x66);
break; return result;
default: default:
rv = NS_ERROR_NOT_AVAILABLE; rv = NS_ERROR_NOT_AVAILABLE;
@ -841,7 +860,7 @@ nsXPLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
* The metrics above are hardcoded platform defaults. All the other * The metrics above are hardcoded platform defaults. All the other
* metrics are stored in sIntPrefs and can be changed at runtime. * metrics are stored in sIntPrefs and can be changed at runtime.
*/ */
break; if (MOZ_LIKELY(!sAnyIntPrefsSet)) return NS_ERROR_NOT_AVAILABLE; // else fall through
} }
for (unsigned int i = 0; i < ArrayLength(sIntPrefs); ++i) { for (unsigned int i = 0; i < ArrayLength(sIntPrefs); ++i) {
@ -859,6 +878,8 @@ nsXPLookAndFeel::GetFloatImpl(FloatID aID, float &aResult)
{ {
if (MOZ_UNLIKELY(!sInitialized)) if (MOZ_UNLIKELY(!sInitialized))
Init(); Init();
if (MOZ_LIKELY(!sAnyFloatPrefsSet)) return NS_ERROR_NOT_AVAILABLE; // else fall through
for (unsigned int i = 0; i < ArrayLength(sFloatPrefs); ++i) { for (unsigned int i = 0; i < ArrayLength(sFloatPrefs); ++i) {
if (MOZ_UNLIKELY(sFloatPrefs[i].isSet && sFloatPrefs[i].id == aID)) { if (MOZ_UNLIKELY(sFloatPrefs[i].isSet && sFloatPrefs[i].id == aID)) {

View File

@ -114,6 +114,8 @@ protected:
static nsLookAndFeel* sInstance; static nsLookAndFeel* sInstance;
static bool sShutdown; static bool sShutdown;
static bool sAnyIntPrefsSet;
static bool sAnyFloatPrefsSet;
}; };
#endif #endif