Backed out 5 changesets (bug 1689761, bug 1691793) for causing bustages in nsLookAndFeel.mm
authorMihai Alexandru Michis <malexandru@mozilla.com>
Wed, 10 Feb 2021 17:38:26 +0200
changeset 566830 a65883accdf6e90fae4fe5e85ab43e950e50f649
parent 566829 aa1ad21ca19fc044a7d63f64dbd90417d1bf2aca
child 566831 ffd5979ffbd642edf036d1826c698f403c155535
push id38191
push userbtara@mozilla.com
push dateThu, 11 Feb 2021 05:02:45 +0000
treeherdermozilla-central@5cbcb80f72bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1689761, 1691793
milestone87.0a1
backs out8c53818717a1fb7a9925b8ac612d504167dabced
232a4e735cdcbdb6d16f05e3a9b79f8c69301a31
e63c5a6932e3eab13da954b379af0ee1c6a25b65
14b61d763ae5a8b97e05ce9d6998117c98580afc
2c88585f0fe416cf05832b42550d6e7f76c9e591
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 5 changesets (bug 1689761, bug 1691793) for causing bustages in nsLookAndFeel.mm CLOSED TREE Backed out changeset 8c53818717a1 (bug 1689761) Backed out changeset 232a4e735cdc (bug 1689761) Backed out changeset e63c5a6932e3 (bug 1689761) Backed out changeset 14b61d763ae5 (bug 1691793) Backed out changeset 2c88585f0fe4 (bug 1689761)
browser/themes/addons/alpenglow/manifest.json
browser/themes/linux/browser.css
browser/themes/osx/browser.css
browser/themes/shared/browser.inc.css
browser/themes/shared/tabs.inc.css
browser/themes/shared/toolbarbuttons.inc.css
browser/themes/windows/browser.css
layout/style/nsMediaFeatures.cpp
layout/style/test/mochitest.ini
layout/style/test/test_mq_prefers_contrast_dynamic.html
toolkit/components/extensions/parent/ext-theme.js
widget/cocoa/nsLookAndFeel.h
widget/cocoa/nsLookAndFeel.mm
--- a/browser/themes/addons/alpenglow/manifest.json
+++ b/browser/themes/addons/alpenglow/manifest.json
@@ -59,18 +59,17 @@
       "popup": "hsla(254, 46%, 21%, 1)",
       "popup_text": "hsla(255, 100%, 94%, 1)",
       "popup_border": "hsla(255, 100%, 94%, .32)",
       "popup_highlight": "hsla(255, 100%, 94%, .12)",
       "sidebar": "hsla(240, 15%, 95%, 1)",
       "sidebar_text": "hsla(261, 53%, 15%, 1)",
       "sidebar_border": "hsla(261, 53%, 15%, .24)",
       "sidebar_highlight": "hsla(265, 100%, 72%, 1)",
-      "sidebar_highlight_text": "hsla(0, 0%, 100%, 1)",
-      "focus_outline": "hsla(258, 65%, 48%, 1)"
+      "sidebar_highlight_text": "hsla(0, 0%, 100%, 1)"
     }
   },
   "dark_theme": {
     "images": {
       "additional_backgrounds": [
         "background-noodles-right-dark.svg",
         "background-noodles-left-dark.svg",
         "background-gradient-dark.svg"
@@ -115,19 +114,12 @@
       "popup": "hsla(250, 43%, 25%, 1)",
       "popup_text": "hsla(255, 100%, 94%, 1)",
       "popup_border": "hsla(255, 100%, 94%, .32)",
       "popup_highlight": "hsla(255, 100%, 94%, .12)",
       "sidebar": "hsla(250, 43%, 25%, 1)",
       "sidebar_text": "hsla(255, 100%, 94%, 1)",
       "sidebar_border": "hsla(255, 100%, 94%, .24)",
       "sidebar_highlight": "hsla(259, 76%, 58%, 1)",
-      "sidebar_highlight_text": "hsla(0, 0%, 100%, 1)",
-      "focus_outline": "hsla(265, 100%, 72%, 1)"
-    }
-  },
-
-  "theme_experiment": {
-    "colors": {
-      "focus_outline": "--focus-outline-color"
+      "sidebar_highlight_text": "hsla(0, 0%, 100%, 1)"
     }
   }
 }
--- a/browser/themes/linux/browser.css
+++ b/browser/themes/linux/browser.css
@@ -259,23 +259,21 @@ menuitem.bookmark-item {
 }
 
 @media (-moz-menubar-drag) {
   #TabsToolbar {
     -moz-window-dragging: drag;
   }
 }
 
-@supports not -moz-bool-pref("browser.proton.tabs.enabled") {
 .keyboard-focused-tab > .tab-stack > .tab-content,
 .tabbrowser-tab:focus:not([aria-activedescendant]) > .tab-stack > .tab-content {
   outline: 1px dotted;
   outline-offset: -6px;
 }
-} /*** END !proton ***/
 
 #context_reloadTab {
   list-style-image: url("moz-icon://stock/gtk-refresh?size=menu");
 }
 
 #context_closeOtherTabs {
   list-style-image: url("moz-icon://stock/gtk-clear?size=menu");
 }
--- a/browser/themes/osx/browser.css
+++ b/browser/themes/osx/browser.css
@@ -514,23 +514,21 @@
 }
 
 .tabbrowser-tab[multiselected],
 .tabbrowser-tab[visuallyselected=true] {
   /* overriding tabbox.css */
   text-shadow: inherit;
 }
 
-@supports not -moz-bool-pref("browser.proton.tabs.enabled") {
 :is(.keyboard-focused-tab, .tabbrowser-tab:focus:not([aria-activedescendant])) > .tab-stack > .tab-content > .tab-label-container:not([pinned]),
 :is(.keyboard-focused-tab, .tabbrowser-tab:focus:not([aria-activedescendant])) > .tab-stack > .tab-content > .tab-icon-image[pinned],
 :is(.keyboard-focused-tab, .tabbrowser-tab:focus:not([aria-activedescendant])) > .tab-stack > .tab-content > .tab-throbber[pinned] {
   box-shadow: var(--focus-ring-box-shadow);
 }
-} /*** END !proton ***/
 
 #TabsToolbar > .toolbar-items {
   padding-top: var(--space-above-tabbar);
 }
 
 #TabsToolbar:not(:-moz-lwtheme) {
   color: #333;
 }
--- a/browser/themes/shared/browser.inc.css
+++ b/browser/themes/shared/browser.inc.css
@@ -15,33 +15,16 @@
 :root {
   /* Note: Setting this to 0 (without px) breaks CSS calculations for OSX. */
   --space-above-tabbar: 0px;
   --tabs-navbar-shadow-size: 1px;
   --short-notification-background: #0250BB;
   --short-notification-gradient: #9059FF;
 }
 
-@supports -moz-bool-pref("browser.proton.enabled") {
-  :root {
-    --focus-outline-color: currentColor;
-    --focus-outline: 2px solid var(--focus-outline-color);
-  }
-
-  @media not (prefers-contrast) {
-    :root {
-      --focus-outline-color: #0061E0;
-    }
-
-    :root:-moz-lwtheme-brighttext {
-      --focus-outline-color: #00DDFF;
-    }
-  }
-} /*** END !proton ***/
-
 :root[extradragspace][tabsintitlebar]:not([inFullscreen]) {
   --space-above-tabbar: 8px;
 }
 
 @media (min-resolution: 1.5dppx) {
   :root {
     --tabs-navbar-shadow-size: 0.5px;
   }
--- a/browser/themes/shared/tabs.inc.css
+++ b/browser/themes/shared/tabs.inc.css
@@ -97,24 +97,16 @@
   -moz-box-align: stretch;
 }
 
 @supports -moz-bool-pref("browser.proton.tabs.enabled") {
 .tabbrowser-tab {
   border-radius: var(--proton-tab-radius);
   min-height: var(--tab-min-height);
 }
-
-/* tabbrowser-tab keyboard focus */
-.keyboard-focused-tab > .tab-stack > .tab-background,
-.tabbrowser-tab:focus:not([aria-activedescendant]) > .tab-stack > .tab-background {
-  outline: var(--focus-outline);
-  -moz-outline-radius: var(--proton-tab-radius);
-  outline-offset: -2px;
-}
 } /*** END proton ***/
 
 /* The selected tab should appear above the border between the tabs toolbar and
    the navigation toolbar. */
 .tabbrowser-tab[visuallyselected=true] {
   position: relative;
   z-index: 2;
 }
--- a/browser/themes/shared/toolbarbuttons.inc.css
+++ b/browser/themes/shared/toolbarbuttons.inc.css
@@ -3,16 +3,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 :root {
   --toolbarbutton-hover-transition-duration: 150ms;
 
   --toolbarbutton-outer-padding: 2px;
   --toolbarbutton-inner-padding: 6px;
 
+  --toolbarbutton-focus-outline: 2px solid currentColor;
+
   /* These hover and active colors should work on both light and dark
      backgrounds. We'll later set colors that cater for light and dark
      backgrounds specifically when we can detect them. */
   --toolbarbutton-hover-background: var(--lwt-toolbarbutton-hover-background, hsla(0,0%,70%,.4));
   --toolbarbutton-active-background: var(--lwt-toolbarbutton-active-background, hsla(0,0%,70%,.6));
 
   --backbutton-background: hsla(0,100%,100%,.8);
   --backbutton-hover-background: var(--backbutton-background);
@@ -24,28 +26,16 @@
   --bookmark-block-padding: 4px;
 
   /* This default value of --toolbarbutton-height is defined to prevent
      CSS errors for an invalid variable. The value should not get used,
      as a more specific value should be set when the value will be used. */
   --toolbarbutton-height: 0;
 }
 
-@supports not -moz-bool-pref("browser.proton.enabled") {
-:root {
-  --toolbarbutton-focus-outline: 2px solid currentColor;
-}
-} /*** END !proton ***/
-
-@supports -moz-bool-pref("browser.proton.enabled") {
-:root {
-  --toolbarbutton-focus-outline: var(--focus-outline);
-}
-} /*** END !proton ***/
-
 :root[uidensity=compact] {
   --toolbarbutton-outer-padding: 1px;
   --bookmark-block-padding: 1px;
 }
 
 :root[uidensity=touch] {
   --toolbarbutton-inner-padding: 9px;
   --bookmark-block-padding: 7px;
--- a/browser/themes/windows/browser.css
+++ b/browser/themes/windows/browser.css
@@ -603,24 +603,22 @@ menuitem.bookmark-item {
 @media (-moz-windows-default-theme: 0) {
   /* For high contrast themes. */
   #tabbrowser-tabpanels,
   :root[privatebrowsingmode=temporary] #tabbrowser-tabpanels {
     background-color: -moz-default-background-color;
   }
 }
 
-@supports not -moz-bool-pref("browser.proton.tabs.enabled") {
 /* tabbrowser-tab focus ring */
 .keyboard-focused-tab > .tab-stack > .tab-content,
 .tabbrowser-tab:focus:not([aria-activedescendant]) > .tab-stack > .tab-content {
   outline: 1px dotted;
   outline-offset: -6px;
 }
-} /*** END !proton ***/
 
 /* All tabs menupopup */
 
 .alltabs-item[selected="true"] {
   font-weight: bold;
 }
 
 toolbarbutton.bookmark-item[dragover="true"][open="true"] {
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -275,16 +275,22 @@ StylePrefersColorScheme Gecko_MediaFeatu
 StyleContrastPref Gecko_MediaFeatures_PrefersContrast(
     const Document* aDocument, const bool aForcedColors) {
   if (nsContentUtils::ShouldResistFingerprinting(aDocument)) {
     return StyleContrastPref::NoPreference;
   }
   // Neither Linux, Windows, nor Mac have a way to indicate that low
   // contrast is prefered so the presence of an accessibility theme
   // implies that high contrast is prefered.
+  //
+  // Note that MacOS does not expose whether or not high contrast is
+  // enabled so for MacOS users this will always evaluate to
+  // false. For more information and discussion see:
+  // https://github.com/w3c/csswg-drafts/issues/3856#issuecomment-642313572
+  // https://github.com/w3c/csswg-drafts/issues/2943
   if (!!LookAndFeel::GetInt(LookAndFeel::IntID::UseAccessibilityTheme, 0)) {
     return StyleContrastPref::More;
   }
   return StyleContrastPref::NoPreference;
 }
 
 static PointerCapabilities GetPointerCapabilities(const Document* aDocument,
                                                   LookAndFeel::IntID aID) {
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -279,18 +279,16 @@ support-files = chrome/chrome-only-media
 skip-if = xorigin # Crashes, Assertion failure: mInFlightProcessId == 0, at /builds/worker/checkouts/gecko/docshell/base/CanonicalBrowsingContext.cpp:110, [Child][MessageChannel] Error: (msgtype=0xFFF7,name=<unknown IPC msg name>) Channel error: cannot send/recv
 [test_media_query_list.html]
 [test_media_query_serialization.html]
 [test_mq_any_hover_and_any_pointer.html]
 [test_mq_changes_in_iframe.html]
 support-files = mq_changes_child.html
 run-if = !headless && (os == 'mac' || toolkit == 'android' || toolkit == 'gtk')
 [test_mq_hover_and_pointer.html]
-[test_mq_prefers_contrast_dynamic.html]
-run-if = !headless && (os == 'mac' || toolkit == 'android' || toolkit == 'gtk')
 [test_mq_prefers_reduced_motion_dynamic.html]
 run-if = !headless && (os == 'mac' || toolkit == 'android' || toolkit == 'gtk')
 [test_moz_device_pixel_ratio.html]
 [test_moz_prefixed_cursor.html]
 [test_namespace_rule.html]
 [test_non_content_accessible_properties.html]
 [test_non_content_accessible_pseudos.html]
 [test_non_content_accessible_values.html]
deleted file mode 100644
--- a/layout/style/test/test_mq_prefers_contrast_dynamic.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1691793
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 1691793</title>
-  <script src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1691793">Mozilla Bug 1691793</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-</pre>
-<script>
-"use strict";
-
-SimpleTest.registerCleanupFunction(async () => {
-  await SpecialPowers.flushPrefEnv();
-});
-
-// Returns a Promise which will be resolved when the "change" event is received
-// for the given media query string.
-function promiseForChange(mediaQuery) {
-  return new Promise(resolve => {
-    window.matchMedia(mediaQuery).addEventListener("change", event => {
-      resolve(event.matches);
-    }, { once: true });
-  });
-}
-
-add_task(async () => {
-  await SpecialPowers.pushPrefEnv({ set: [["layout.css.prefers-contrast.enabled", true]]});
-  const initiallyMatches =
-    window.matchMedia("(prefers-contrast: more)").matches;
-  const changePromise = initiallyMatches ?
-    promiseForChange("(prefers-contrast: more)") : null;
-  await SpecialPowers.pushPrefEnv({ set: [["ui.useAccessibilityTheme", 0]]});
-
-  if (changePromise) {
-    await changePromise;
-  }
-
-  ok(!window.matchMedia("(prefers-contrast: more)").matches,
-     "Does not match prefers-contrast: more) when the system unsets " +
-     "UseAccessibilityTheme");
-  ok(!window.matchMedia("(prefers-contrast)").matches,
-     "Does not match (prefers-contrast) when the system unsets " +
-     "UseAccessibilityTheme");
-  ok(window.matchMedia("(prefers-contrast: no-preference)").matches,
-     "Matches (prefers-contrast: no-preference) when the system unsets " +
-     "UseAccessibilityTheme");
-});
-
-add_task(async () => {
-  const more = promiseForChange("(prefers-contrast: more)");
-  const booleanContext = promiseForChange("(prefers-contrast)");
-  const noPreference = promiseForChange("(prefers-contrast: no-preference)");
-
-  await SpecialPowers.pushPrefEnv({ set: [["ui.useAccessibilityTheme", 1]]});
-
-  const [ moreResult, booleanContextResult, noPreferenceResult ] =
-    await Promise.all([ more, booleanContext, noPreference ]);
-
-  ok(moreResult,
-     "Matches (prefers-contrast: more) when the system sets " +
-     "UseAccessibilityTheme");
-  ok(booleanContextResult,
-     "Matches (prefers-contrast) when the system sets UseAccessibilityTheme");
-  ok(!noPreferenceResult,
-     "Does not match (prefers-contrast: no-preference) when the " +
-     "system sets UseAccessibilityTheme");
-});
-
-</script>
-</body>
-</html>
--- a/toolkit/components/extensions/parent/ext-theme.js
+++ b/toolkit/components/extensions/parent/ext-theme.js
@@ -63,23 +63,16 @@ class Theme {
 
       if (experiment) {
         if (extension.experimentsAllowed) {
           this.lwtStyles.experimental = {
             colors: {},
             images: {},
             properties: {},
           };
-          if (this.lwtDarkStyles) {
-            this.lwtDarkStyles.experimental = {
-              colors: {},
-              images: {},
-              properties: {},
-            };
-          }
           const { baseURI } = this.extension;
           if (experiment.stylesheet) {
             experiment.stylesheet = baseURI.resolve(experiment.stylesheet);
           }
           this.experiment = experiment;
         } else {
           const { logger } = this.extension;
           logger.warn("This extension is not allowed to run theme experiments");
--- a/widget/cocoa/nsLookAndFeel.h
+++ b/widget/cocoa/nsLookAndFeel.h
@@ -45,19 +45,16 @@ class nsLookAndFeel final : public nsXPL
   bool mAllowOverlayScrollbarsOverlapCached;
 
   int32_t mSystemUsesDarkTheme;
   bool mSystemUsesDarkThemeCached;
 
   int32_t mPrefersReducedMotion = -1;
   bool mPrefersReducedMotionCached = false;
 
-  int32_t mUseAccessibilityTheme;
-  bool mUseAccessibilityThemeCached;
-
   nscolor mColorTextSelectBackground;
   nscolor mColorTextSelectBackgroundDisabled;
   nscolor mColorHighlight;
   nscolor mColorMenuHover;
   nscolor mColorTextSelectForeground;
   nscolor mColorMenuHoverText;
   nscolor mColorButtonText;
   bool mHasColorButtonText;
--- a/widget/cocoa/nsLookAndFeel.mm
+++ b/widget/cocoa/nsLookAndFeel.mm
@@ -64,18 +64,16 @@ nsLookAndFeel::nsLookAndFeel(const LookA
       mColorFocusRing(0),
       mColorTextSelect(0),
       mColorDisabledToolbarText(0),
       mColorMenuSelect(0),
       mColorCellHighlight(0),
       mColorEvenTreeRow(0),
       mColorOddTreeRow(0),
       mColorActiveSourceListSelection(0),
-      mUseAccessibilityTheme(-1),
-      mUseAccessibilityThemeCached(false),
       mInitialized(false) {
   if (aCache) {
     DoSetCache(*aCache);
   }
 }
 
 nsLookAndFeel::~nsLookAndFeel() {}
 
@@ -102,17 +100,16 @@ void nsLookAndFeel::RefreshImpl() {
   // 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
   // to cache via LookAndFeel::SetIntCache.
   if (XRE_IsParentProcess()) {
     mUseOverlayScrollbarsCached = false;
     mAllowOverlayScrollbarsOverlapCached = false;
     mPrefersReducedMotionCached = false;
     mSystemUsesDarkThemeCached = false;
-    mUseAccessibilityThemeCached = false;
   }
 
   // Fetch colors next time they are requested.
   mInitialized = false;
 }
 
 // Turns an opaque selection color into a partially transparent selection color,
 // which usually leads to better contrast with the text color and which should
@@ -583,31 +580,16 @@ nsresult nsLookAndFeel::NativeGetInt(Int
           [[NSWorkspace sharedWorkspace]
               respondsToSelector:@selector(accessibilityDisplayShouldReduceMotion)]) {
         mPrefersReducedMotion =
             [[NSWorkspace sharedWorkspace] accessibilityDisplayShouldReduceMotion] ? 1 : 0;
         mPrefersReducedMotionCached = true;
       }
       aResult = mPrefersReducedMotion;
       break;
-    case IntID::UseAccessibilityTheme:
-      // Without native event loops,
-      // NSWorkspace.accessibilityDisplayShouldIncreaseContrast returns stale
-      // information, so we get the information only on the parent processes
-      // or when it's the initial query on child processes.  Otherwise we will
-      // get the info via LookAndFeel::SetIntCache on child processes.
-      if (!mUseAccessibilityThemeCached &&
-          [[NSWorkspace sharedWorkspace]
-              respondsToSelector:@selector(accessibilityDisplayShouldIncreaseContrast)]) {
-        mUseAccessibilityTheme =
-            [[NSWorkspace sharedWorkspace] accessibilityDisplayShouldIncreaseContrast] ? 1 : 0;
-        mUseAccessibilityThemeCached = true;
-      }
-      aResult = mUseAccessibilityTheme;
-      break;
     default:
       aResult = 0;
       res = NS_ERROR_FAILURE;
   }
   return res;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
@@ -682,21 +664,16 @@ mozilla::widget::LookAndFeelCache nsLook
   allowOverlayScrollbarsOverlap.value() = GetInt(IntID::AllowOverlayScrollbarsOverlap);
   cache.mInts().AppendElement(allowOverlayScrollbarsOverlap);
 
   LookAndFeelInt prefersReducedMotion;
   prefersReducedMotion.id() = IntID::PrefersReducedMotion;
   prefersReducedMotion.value() = GetInt(IntID::PrefersReducedMotion);
   cache.mInts().AppendElement(prefersReducedMotion);
 
-  LookAndFeelInt useAccessibilityTheme;
-  useAccessibilityTheme.id() = IntID::UseAccessibilityTheme;
-  useAccessibilityTheme.value() = GetInt(IntID::UseAccessibilityTheme);
-  cache.mInts().AppendElement(useAccessibilityTheme);
-
   LookAndFeelInt systemUsesDarkTheme;
   systemUsesDarkTheme.id() = IntID::SystemUsesDarkTheme;
   systemUsesDarkTheme.value() = GetInt(IntID::SystemUsesDarkTheme);
   cache.mInts().AppendElement(systemUsesDarkTheme);
 
   return cache;
 }
 
@@ -716,20 +693,16 @@ void nsLookAndFeel::DoSetCache(const Loo
       case IntID::SystemUsesDarkTheme:
         mSystemUsesDarkTheme = entry.value();
         mSystemUsesDarkThemeCached = true;
         break;
       case IntID::PrefersReducedMotion:
         mPrefersReducedMotion = entry.value();
         mPrefersReducedMotionCached = true;
         break;
-      case IntID::UseAccessibilityTheme:
-        mUseAccessibilityTheme = entry.value();
-        mUseAccessibilityThemeCached = true;
-        break;
       default:
         MOZ_ASSERT_UNREACHABLE("Bogus Int ID in cache");
         break;
     }
   }
 }
 
 void nsLookAndFeel::EnsureInit() {