Bug 1691965 - Replace (-moz-windows-default-theme) with (prefers-contrast) in some browser/ usages. r=Itiel
authorTim Nguyen <ntim.bugs@gmail.com>
Wed, 10 Feb 2021 22:16:44 +0000
changeset 566886 4a5e7a2e86e29fe311924f4653de23199b62070c
parent 566885 66ae0882ef558ea8b94c8855daaa0bc1a8f442b0
child 566887 5cbcb80f72bd7606c8572aa89247235ddcbd7762
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)
reviewersItiel
bugs1691965
milestone87.0a1
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
Bug 1691965 - Replace (-moz-windows-default-theme) with (prefers-contrast) in some browser/ usages. r=Itiel Differential Revision: https://phabricator.services.mozilla.com/D104695
browser/components/aboutlogins/content/components/login-item.css
browser/components/urlbar/UrlbarValueFormatter.jsm
browser/themes/shared/customizableui/customizeMode.inc.css
browser/themes/shared/urlbar-searchbar.inc.css
--- a/browser/components/aboutlogins/content/components/login-item.css
+++ b/browser/components/aboutlogins/content/components/login-item.css
@@ -460,17 +460,17 @@ input[name="password"] {
 .error-message-link > a,
 .error-message-link > a:hover,
 .error-message-link > a:hover:active {
   color: currentColor;
   text-decoration: underline;
   font-weight: 600;
 }
 
-@media (-moz-windows-default-theme: 0) {
+@media (prefers-contrast) {
   .alert-icon {
     fill: currentColor;
   }
 }
 
 @media (prefers-color-scheme: dark) {
   :host {
     --reveal-checkbox-opacity: .8;
--- a/browser/components/urlbar/UrlbarValueFormatter.jsm
+++ b/browser/components/urlbar/UrlbarValueFormatter.jsm
@@ -6,17 +6,16 @@
 
 var EXPORTED_SYMBOLS = ["UrlbarValueFormatter"];
 
 const { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 
 XPCOMUtils.defineLazyModuleGetters(this, {
-  AppConstants: "resource://gre/modules/AppConstants.jsm",
   PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
   Services: "resource://gre/modules/Services.jsm",
   UrlbarPrefs: "resource:///modules/UrlbarPrefs.jsm",
   UrlbarUtils: "resource:///modules/UrlbarUtils.jsm",
 });
 
 /**
  * Applies URL highlighting and other styling to the text in the urlbar input,
@@ -426,18 +425,17 @@ class UrlbarValueFormatter {
     // default themes, where the contrast between our background color and
     // the input's frame color might actually be too low.  We can
     // (hackily) force setColors to use our colors as given by passing
     // them as the alternate colors.  Otherwise, allow setColors to swap
     // them, which we can do by passing "currentColor".  See
     // nsTextPaintStyle::GetHighlightColors for details.
     if (
       this.document.documentElement.querySelector(":-moz-lwtheme") ||
-      (AppConstants.platform == "win" &&
-        this.window.matchMedia("(-moz-windows-default-theme: 0)").matches)
+      this.window.matchMedia("(prefers-contrast)").matches
     ) {
       // non-default theme(s)
       selection.setColors(fg, bg, "currentColor", "currentColor");
     } else {
       // default themes
       selection.setColors(fg, bg, fg, bg);
     }
 
--- a/browser/themes/shared/customizableui/customizeMode.inc.css
+++ b/browser/themes/shared/customizableui/customizeMode.inc.css
@@ -53,20 +53,17 @@
 }
 
 #customization-footer {
   border-top: 1px solid rgba(0,0,0,.15);
   padding: 10px;
 }
 
 %if defined(XP_MACOSX) || defined(XP_WIN)
-%ifdef XP_WIN
-@media (-moz-windows-default-theme) {
-%endif
-
+@media not (prefers-contrast) {
 .customizationmode-button {
   border: 1px solid #b1b1b1;
   border-radius: 2px;
   background-color: #fcfcfd;
   appearance: none;
 }
 
 .customizationmode-checkbox,
@@ -139,20 +136,17 @@
 
 #customization-done-button:is(:active,:hover):not([disabled]) {
   background-color: #0060df;
 }
 
 .customizationmode-button[disabled="true"] {
   opacity: .5;
 }
-
-%ifdef XP_WIN
-} /* @media (-moz-windows-default-theme) */
-%endif
+}
 %endif /* defined(XP_MACOSX) || defined(XP_WIN) */
 
 .customizationmode-button > .box-inherit > .box-inherit > .button-icon,
 .customizationmode-button > .button-box > .button-icon {
   height: 16px;
 }
 
 #customization-uidensity-button > .box-inherit > .box-inherit > .button-text,
--- a/browser/themes/shared/urlbar-searchbar.inc.css
+++ b/browser/themes/shared/urlbar-searchbar.inc.css
@@ -326,30 +326,28 @@
   fill: var(--lwt-toolbar-field-focus-color);
   background-color: var(--lwt-toolbar-field-focus);
 }
 
 #urlbar-search-mode-indicator:hover > #urlbar-search-mode-indicator-close {
   display: block;
 }
 
-/* Windows high-contrast themes */
-%ifdef XP_WIN
-@media (-moz-windows-default-theme: 0) {
+/* Low/high-contrast themes */
+@media (prefers-contrast) {
   #urlbar-search-mode-indicator {
     background-color: Highlight;
     outline-color: Highlight;
     color: HighlightText;
   }
 
   #urlbar-search-mode-indicator-close {
     stroke-opacity: 1.0;
   }
 }
-%endif
 
 @supports -moz-bool-pref("browser.urlbar.experimental.searchModeIndicatorHover") {
   #urlbar-search-mode-indicator-close:hover {
     background-color: #ededf0; /* Grey 20 */
   }
   #urlbar-search-mode-indicator-close:hover:active {
     background-color: #d7d7db; /* Grey 30 */
   }