diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-06-30 07:24:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-30 07:24:17 +0200 |
commit | c2fc3664d1d94178a48178b72dad462379b57449 (patch) | |
tree | 845967451c0e210648b9607092a9bf1f83eaef70 | |
parent | 86c08f4c4e41ea6de54d7353a9bfec065bcf205a (diff) | |
parent | 6151dca6eac269a8dc4ca23552360aa7856eb9db (diff) | |
download | uxp-c2fc3664d1d94178a48178b72dad462379b57449.tar.gz |
Merge pull request #567 from SpockMan02/moz-mac-lion-theme
Undo Mozilla Bug 1302937; Reinstate -moz-mac-lion-theme media query
-rw-r--r-- | dom/base/nsGkAtomList.h | 2 | ||||
-rw-r--r-- | layout/style/nsCSSRuleProcessor.cpp | 15 | ||||
-rw-r--r-- | layout/style/nsMediaFeatures.cpp | 10 | ||||
-rw-r--r-- | layout/style/test/test_media_queries.html | 7 | ||||
-rw-r--r-- | widget/LookAndFeel.h | 14 | ||||
-rw-r--r-- | widget/cocoa/nsLookAndFeel.mm | 31 | ||||
-rw-r--r-- | widget/gtk/nsLookAndFeel.cpp | 35 | ||||
-rw-r--r-- | widget/windows/nsLookAndFeel.cpp | 1 |
8 files changed, 74 insertions, 41 deletions
diff --git a/dom/base/nsGkAtomList.h b/dom/base/nsGkAtomList.h index 50b4449ecf..8fefa0e02f 100644 --- a/dom/base/nsGkAtomList.h +++ b/dom/base/nsGkAtomList.h @@ -2240,6 +2240,7 @@ GK_ATOM(windows_accent_color_applies, "windows-accent-color-applies") GK_ATOM(windows_accent_color_is_dark, "windows-accent-color-is-dark") GK_ATOM(windows_default_theme, "windows-default-theme") GK_ATOM(mac_graphite_theme, "mac-graphite-theme") +GK_ATOM(mac_lion_theme, "mac-lion-theme") GK_ATOM(mac_yosemite_theme, "mac-yosemite-theme") GK_ATOM(windows_compositor, "windows-compositor") GK_ATOM(windows_glass, "windows-glass") @@ -2271,6 +2272,7 @@ GK_ATOM(_moz_windows_accent_color_applies, "-moz-windows-accent-color-applies") GK_ATOM(_moz_windows_accent_color_is_dark, "-moz-windows-accent-color-is-dark") GK_ATOM(_moz_windows_default_theme, "-moz-windows-default-theme") GK_ATOM(_moz_mac_graphite_theme, "-moz-mac-graphite-theme") +GK_ATOM(_moz_mac_lion_theme, "-moz-mac-lion-theme") GK_ATOM(_moz_mac_yosemite_theme, "-moz-mac-yosemite-theme") GK_ATOM(_moz_windows_compositor, "-moz-windows-compositor") GK_ATOM(_moz_windows_classic, "-moz-windows-classic") diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index 8760a330e1..810a8f8f00 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -1122,6 +1122,11 @@ InitSystemMetrics() sSystemMetrics->AppendElement(nsGkAtoms::mac_graphite_theme); } + rv = LookAndFeel::GetInt(LookAndFeel::eIntID_MacLionTheme, &metricResult); + if (NS_SUCCEEDED(rv) && metricResult) { + sSystemMetrics->AppendElement(nsGkAtoms::mac_lion_theme); + } + rv = LookAndFeel::GetInt(LookAndFeel::eIntID_MacYosemiteTheme, &metricResult); if (NS_SUCCEEDED(rv) && metricResult) { sSystemMetrics->AppendElement(nsGkAtoms::mac_yosemite_theme); @@ -1161,7 +1166,7 @@ InitSystemMetrics() if (NS_SUCCEEDED(rv) && metricResult) { sSystemMetrics->AppendElement(nsGkAtoms::touch_enabled); } - + rv = LookAndFeel::GetInt(LookAndFeel::eIntID_SwipeAnimationEnabled, &metricResult); if (NS_SUCCEEDED(rv) && metricResult) { @@ -1539,7 +1544,7 @@ checkGenericEmptyMatches(Element* aElement, do { child = aElement->GetChildAt(++index); // stop at first non-comment (and non-whitespace for - // :-moz-only-whitespace) node + // :-moz-only-whitespace) node } while (child && !IsSignificantChild(child, true, isWhitespaceSignificant)); return (child == nullptr); } @@ -2233,7 +2238,7 @@ static bool SelectorMatches(Element* aElement, NS_ASSERTION(hasAttr, "HasAttr lied"); result = AttrMatchesValue(attr, value, isHTML); } - + attr = attr->mNext; } while (attr && result); } @@ -3085,7 +3090,7 @@ nsCSSRuleProcessor::AppendFontFaceRules( if (!aArray.AppendElements(cascade->mFontFaceRules)) return false; } - + return true; } @@ -3129,7 +3134,7 @@ nsCSSRuleProcessor::AppendPageRules( return false; } } - + return true; } diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp index 5a54d5455d..854236e511 100644 --- a/layout/style/nsMediaFeatures.cpp +++ b/layout/style/nsMediaFeatures.cpp @@ -706,6 +706,14 @@ nsMediaFeatures::features[] = { GetSystemMetric }, { + &nsGkAtoms::_moz_mac_lion_theme, + nsMediaFeature::eMinMaxNotAllowed, + nsMediaFeature::eBoolInteger, + nsMediaFeature::eNoRequirements, + { &nsGkAtoms::mac_lion_theme }, + GetSystemMetric + }, + { &nsGkAtoms::_moz_mac_yosemite_theme, nsMediaFeature::eMinMaxNotAllowed, nsMediaFeature::eBoolInteger, @@ -728,7 +736,7 @@ nsMediaFeatures::features[] = { nsMediaFeature::eNoRequirements, { &nsGkAtoms::windows_accent_color_is_dark }, GetSystemMetric - }, + }, { &nsGkAtoms::_moz_windows_compositor, nsMediaFeature::eMinMaxNotAllowed, diff --git a/layout/style/test/test_media_queries.html b/layout/style/test/test_media_queries.html index d503fad0b2..59fe030c21 100644 --- a/layout/style/test/test_media_queries.html +++ b/layout/style/test/test_media_queries.html @@ -627,6 +627,7 @@ function run() { expression_should_be_parseable("-moz-overlay-scrollbars"); expression_should_be_parseable("-moz-windows-default-theme"); expression_should_be_parseable("-moz-mac-graphite-theme"); + expression_should_be_parseable("-moz-mac-lion-theme"); expression_should_be_parseable("-moz-mac-yosemite-theme"); expression_should_be_parseable("-moz-windows-accent-color-applies"); expression_should_be_parseable("-moz-windows-compositor"); @@ -643,6 +644,7 @@ function run() { expression_should_be_parseable("-moz-overlay-scrollbars: 0"); expression_should_be_parseable("-moz-windows-default-theme: 0"); expression_should_be_parseable("-moz-mac-graphite-theme: 0"); + expression_should_be_parseable("-moz-mac-lion-theme: 0"); expression_should_be_parseable("-moz-mac-yosemite-theme: 0"); expression_should_be_parseable("-moz-windows-accent-color-applies: 0"); expression_should_be_parseable("-moz-windows-compositor: 0"); @@ -659,6 +661,7 @@ function run() { expression_should_be_parseable("-moz-overlay-scrollbars: 1"); expression_should_be_parseable("-moz-windows-default-theme: 1"); expression_should_be_parseable("-moz-mac-graphite-theme: 1"); + expression_should_be_parseable("-moz-mac-lion-theme: 1"); expression_should_be_parseable("-moz-mac-yosemite-theme: 1"); expression_should_be_parseable("-moz-windows-accent-color-applies: 1"); expression_should_be_parseable("-moz-windows-compositor: 1"); @@ -675,6 +678,7 @@ function run() { expression_should_not_be_parseable("-moz-overlay-scrollbars: -1"); expression_should_not_be_parseable("-moz-windows-default-theme: -1"); expression_should_not_be_parseable("-moz-mac-graphite-theme: -1"); + expression_should_not_be_parseable("-moz-mac-lion-theme: -1"); expression_should_not_be_parseable("-moz-mac-yosemite-theme: -1"); expression_should_not_be_parseable("-moz-windows-accent-color-applies: -1"); expression_should_not_be_parseable("-moz-windows-compositor: -1"); @@ -691,6 +695,7 @@ function run() { expression_should_not_be_parseable("-moz-overlay-scrollbars: true"); expression_should_not_be_parseable("-moz-windows-default-theme: true"); expression_should_not_be_parseable("-moz-mac-graphite-theme: true"); + expression_should_not_be_parseable("-moz-mac-lion-theme: true"); expression_should_not_be_parseable("-moz-mac-yosemite-theme: true"); expression_should_not_be_parseable("-moz-windows-accent-color-applies: true"); expression_should_not_be_parseable("-moz-windows-compositor: true"); @@ -844,5 +849,3 @@ function handle_iframe_onload(event) </pre> </body> </html> - - diff --git a/widget/LookAndFeel.h b/widget/LookAndFeel.h index cf84b33086..60ebc2782c 100644 --- a/widget/LookAndFeel.h +++ b/widget/LookAndFeel.h @@ -250,7 +250,7 @@ public: * should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric. */ eIntID_WindowsAccentColorApplies, - + /* * A Boolean value to determine whether the Windows accent color * is considered dark and should get bright text/controls. @@ -313,6 +313,16 @@ public: */ eIntID_MacGraphiteTheme, + /* + * A Boolean value to determine whether the Mac OS X Lion-specific theming + * should be used. + * + * The value of this metric is not used on non-Mac platforms. These + * platforms should return NS_ERROR_NOT_IMPLEMENTED when queried for this + * metric. + */ + eIntID_MacLionTheme, + /* * A Boolean value to determine whether the Mac OS X Yosemite-specific theming * should be used. @@ -412,7 +422,7 @@ public: */ eIntID_ScrollbarFadeBeginDelay, eIntID_ScrollbarFadeDuration, - + /** * Distance in pixels to offset the context menu from the cursor * on open. diff --git a/widget/cocoa/nsLookAndFeel.mm b/widget/cocoa/nsLookAndFeel.mm index cbee90f581..0b68cd0e4f 100644 --- a/widget/cocoa/nsLookAndFeel.mm +++ b/widget/cocoa/nsLookAndFeel.mm @@ -67,19 +67,19 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; nsresult res = NS_OK; - + switch (aID) { case eColorID_WindowBackground: aColor = NS_RGB(0xff,0xff,0xff); break; case eColorID_WindowForeground: - aColor = NS_RGB(0x00,0x00,0x00); + aColor = NS_RGB(0x00,0x00,0x00); break; case eColorID_WidgetBackground: aColor = NS_RGB(0xdd,0xdd,0xdd); break; case eColorID_WidgetForeground: - aColor = NS_RGB(0x00,0x00,0x00); + aColor = NS_RGB(0x00,0x00,0x00); break; case eColorID_WidgetSelectBackground: aColor = NS_RGB(0x80,0x80,0x80); @@ -107,7 +107,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) break; case eColorID__moz_menuhover: aColor = GetColorFromNSColor([NSColor alternateSelectedControlColor]); - break; + break; case eColorID_TextSelectForeground: GetColor(eColorID_TextSelectBackground, aColor); if (aColor == 0x000000) @@ -147,9 +147,9 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) // css2 system colors http://www.w3.org/TR/REC-CSS2/ui.html#system-colors // // It's really hard to effectively map these to the Appearance Manager properly, - // since they are modeled word for word after the win32 system colors and don't have any - // real counterparts in the Mac world. I'm sure we'll be tweaking these for - // years to come. + // since they are modeled word for word after the win32 system colors and don't have any + // real counterparts in the Mac world. I'm sure we'll be tweaking these for + // years to come. // // Thanks to mpt26@student.canterbury.ac.nz for the hardcoded values that form the defaults // if querying the Appearance Manager fails ;) @@ -161,7 +161,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) break; } // Otherwise fall through and return the regular button text: - + case eColorID_buttontext: case eColorID__moz_buttonhovertext: aColor = GetColorFromNSColor([NSColor controlTextColor]); @@ -267,13 +267,13 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) break; case eColorID__moz_mac_menushadow: aColor = NS_RGB(0xA3,0xA3,0xA3); - break; + break; case eColorID__moz_mac_menutextdisable: aColor = NS_RGB(0x98,0x98,0x98); - break; + break; case eColorID__moz_mac_menutextselect: aColor = GetColorFromNSColor([NSColor selectedMenuItemTextColor]); - break; + break; case eColorID__moz_mac_disabledtoolbartext: aColor = GetColorFromNSColor([NSColor disabledControlTextColor]); break; @@ -307,7 +307,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor) res = NS_ERROR_FAILURE; break; } - + return res; NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; @@ -322,7 +322,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) if (NS_SUCCEEDED(res)) return res; res = NS_OK; - + switch (aID) { case eIntID_CaretBlinkTime: aResult = 567; @@ -411,6 +411,9 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) case eIntID_MacGraphiteTheme: aResult = [NSColor currentControlTint] == NSGraphiteControlTint; break; + case eIntID_MacLionTheme: + aResult = 1; + break; case eIntID_MacYosemiteTheme: aResult = nsCocoaFeatures::OnYosemiteOrLater(); break; @@ -473,7 +476,7 @@ nsLookAndFeel::GetFloatImpl(FloatID aID, float &aResult) if (NS_SUCCEEDED(res)) return res; res = NS_OK; - + switch (aID) { case eFloatID_IMEUnderlineRelativeSize: aResult = 2.0f; diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp index d2b82e4957..7a95f81c6a 100644 --- a/widget/gtk/nsLookAndFeel.cpp +++ b/widget/gtk/nsLookAndFeel.cpp @@ -51,7 +51,7 @@ nsLookAndFeel::nsLookAndFeel() mDefaultFontCached(false), mButtonFontCached(false), mFieldFontCached(false), mMenuFontCached(false) { - Init(); + Init(); } nsLookAndFeel::~nsLookAndFeel() @@ -266,7 +266,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) break; case eColorID_WindowForeground: case eColorID_WidgetForeground: - case eColorID_TextForeground: + case eColorID_TextForeground: case eColorID_captiontext: // text in active window caption, size box, and scrollbar arrow box (!) case eColorID_windowtext: case eColorID__moz_dialogtext: @@ -303,7 +303,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) // not used? aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_NORMAL]); break; - case eColorID_TextForeground: + case eColorID_TextForeground: // not used? aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_NORMAL]); break; @@ -415,7 +415,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) // inactive window caption GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_WINDOW); gtk_style_context_get_background_color(style, - GTK_STATE_FLAG_INSENSITIVE, + GTK_STATE_FLAG_INSENSITIVE, &gdk_color); aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); ReleaseStyleContext(style); @@ -509,7 +509,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) break; case eColorID__moz_dragtargetzone: aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_SELECTED]); - break; + break; case eColorID__moz_buttondefault: // default button border color aColor = GDK_COLOR_TO_NS_RGB(mStyle->black); @@ -552,8 +552,8 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor) } case eColorID__moz_buttonhoverface: { GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_BUTTON); - gtk_style_context_get_background_color(style, - GTK_STATE_FLAG_PRELIGHT, + gtk_style_context_get_background_color(style, + GTK_STATE_FLAG_PRELIGHT, &gdk_color); aColor = GDK_RGBA_TO_NS_RGBA(gdk_color); ReleaseStyleContext(style); @@ -637,7 +637,7 @@ static int32_t ConvertGTKStepperStyleToMozillaScrollArrowStyle(GtkWidget* aWidge { if (!aWidget) return mozilla::LookAndFeel::eScrollArrowStyle_Single; - + return CheckWidgetStyle(aWidget, "has-backward-stepper", mozilla::LookAndFeel::eScrollArrow_StartBackward) | @@ -654,7 +654,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) { nsresult res = NS_OK; - // Set these before they can get overrided in the nsXPLookAndFeel. + // Set these before they can get overrided in the nsXPLookAndFeel. switch (aID) { case eIntID_ScrollButtonLeftMouseButtonAction: aResult = 0; @@ -686,7 +686,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) "gtk-cursor-blink-time", &blink_time, "gtk-cursor-blink", &blink, nullptr); - + if (blink) aResult = (int32_t) blink_time; else @@ -708,11 +708,11 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) entry = gtk_entry_new(); g_object_ref_sink(entry); settings = gtk_widget_get_settings(entry); - g_object_get(settings, + g_object_get(settings, "gtk-entry-select-on-focus", &select_on_focus, nullptr); - + if(select_on_focus) aResult = 1; else @@ -773,7 +773,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) "gtk-dnd-drag-threshold", &threshold, nullptr); g_object_ref_sink(box); - + aResult = threshold; } break; @@ -818,6 +818,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) #endif break; case eIntID_MacGraphiteTheme: + case eIntID_MacLionTheme: aResult = 0; res = NS_ERROR_NOT_IMPLEMENTED; break; @@ -1082,7 +1083,7 @@ nsLookAndFeel::Init() gtk_widget_destroy(widget); g_object_unref(widget); - + // tooltip foreground and background GtkStyle *style = gtk_rc_get_style_by_paths(gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", @@ -1116,7 +1117,7 @@ nsLookAndFeel::Init() if (style) { sMenuBackground = GDK_COLOR_TO_NS_RGB(style->bg[GTK_STATE_NORMAL]); } - + style = gtk_widget_get_style(menuitem); if (style) { sMenuHover = GDK_COLOR_TO_NS_RGB(style->bg[GTK_STATE_PRELIGHT]); @@ -1225,7 +1226,7 @@ nsLookAndFeel::Init() gtk_container_add(GTK_CONTAINER(window), parent); gtk_container_add(GTK_CONTAINER(parent), entry); gtk_container_add(GTK_CONTAINER(parent), textView); - + #if (MOZ_WIDGET_GTK == 2) gtk_widget_set_style(button, nullptr); gtk_widget_set_style(label, nullptr); @@ -1348,7 +1349,7 @@ nsLookAndFeel::Init() sComboBoxText = GDK_RGBA_TO_NS_RGBA(color); ReleaseStyleContext(style); - // Menubar text and hover text colors + // Menubar text and hover text colors style = ClaimStyleContext(MOZ_GTK_MENUBARITEM); gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color); sMenuBarText = GDK_RGBA_TO_NS_RGBA(color); diff --git a/widget/windows/nsLookAndFeel.cpp b/widget/windows/nsLookAndFeel.cpp index 06eee37716..97f81abfdb 100644 --- a/widget/windows/nsLookAndFeel.cpp +++ b/widget/windows/nsLookAndFeel.cpp @@ -423,6 +423,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult) } case eIntID_MacGraphiteTheme: + case eIntID_MacLionTheme: aResult = 0; res = NS_ERROR_NOT_IMPLEMENTED; break; |