Backed out changeset 31a3362f641c (bug 1344910) for crashes in marionette.py | application crashed
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 21 Jun 2017 15:00:08 +0200
changeset 598359 8282a7374309453f7a66bf1fbe0bcd8879a929e1
parent 598358 3878dd93fa71888588d5bf73caa9b2e56f5b1106
child 598360 fec6f08ea5ff7cda1154eceee994ab0762fcdd13
push id65172
push usergpascutto@mozilla.com
push dateWed, 21 Jun 2017 16:21:54 +0000
bugs1344910
milestone56.0a1
backs out31a3362f641c45953dc820e2c8cadd42ca3cc51e
Backed out changeset 31a3362f641c (bug 1344910) for crashes in marionette.py | application crashed
layout/style/nsCSSKeywordList.h
layout/style/nsCSSProps.cpp
widget/LookAndFeel.h
widget/nsXPLookAndFeel.cpp
widget/windows/nsLookAndFeel.cpp
widget/windows/nsLookAndFeel.h
widget/windows/nsWindow.cpp
--- a/layout/style/nsCSSKeywordList.h
+++ b/layout/style/nsCSSKeywordList.h
@@ -742,17 +742,16 @@ CSS_KEY(groupbox, groupbox)
 CSS_KEY(checkbox-container, checkbox_container)
 CSS_KEY(radio-container, radio_container)
 CSS_KEY(checkbox-label, checkbox_label)
 CSS_KEY(radio-label, radio_label)
 CSS_KEY(button-focus, button_focus)
 CSS_KEY(-moz-win-media-toolbox, _moz_win_media_toolbox)
 CSS_KEY(-moz-win-communications-toolbox, _moz_win_communications_toolbox)
 CSS_KEY(-moz-win-browsertabbar-toolbox, _moz_win_browsertabbar_toolbox)
-CSS_KEY(-moz-win-accentcolor, _moz_win_accentcolor)
 CSS_KEY(-moz-win-mediatext, _moz_win_mediatext)
 CSS_KEY(-moz-win-communicationstext, _moz_win_communicationstext)
 CSS_KEY(-moz-win-glass, _moz_win_glass)
 CSS_KEY(-moz-win-borderless-glass, _moz_win_borderless_glass)
 CSS_KEY(-moz-window-titlebar, _moz_window_titlebar)
 CSS_KEY(-moz-window-titlebar-maximized, _moz_window_titlebar_maximized)
 CSS_KEY(-moz-window-frame-left, _moz_window_frame_left)
 CSS_KEY(-moz-window-frame-right, _moz_window_frame_right)
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -1132,17 +1132,16 @@ const KTableEntry nsCSSProps::kColorKTab
   { eCSSKeyword__moz_mac_secondaryhighlight, LookAndFeel::eColorID__moz_mac_secondaryhighlight },
   { eCSSKeyword__moz_menuhover, LookAndFeel::eColorID__moz_menuhover },
   { eCSSKeyword__moz_menuhovertext, LookAndFeel::eColorID__moz_menuhovertext },
   { eCSSKeyword__moz_menubartext, LookAndFeel::eColorID__moz_menubartext },
   { eCSSKeyword__moz_menubarhovertext, LookAndFeel::eColorID__moz_menubarhovertext },
   { eCSSKeyword__moz_oddtreerow, LookAndFeel::eColorID__moz_oddtreerow },
   { eCSSKeyword__moz_visitedhyperlinktext, NS_COLOR_MOZ_VISITEDHYPERLINKTEXT },
   { eCSSKeyword_currentcolor, NS_COLOR_CURRENTCOLOR },
-  { eCSSKeyword__moz_win_accentcolor, LookAndFeel::eColorID__moz_win_accentcolor },
   { eCSSKeyword__moz_win_mediatext, LookAndFeel::eColorID__moz_win_mediatext },
   { eCSSKeyword__moz_win_communicationstext, LookAndFeel::eColorID__moz_win_communicationstext },
   { eCSSKeyword__moz_nativehyperlinktext, LookAndFeel::eColorID__moz_nativehyperlinktext },
   { eCSSKeyword__moz_comboboxtext, LookAndFeel::eColorID__moz_comboboxtext },
   { eCSSKeyword__moz_combobox, LookAndFeel::eColorID__moz_combobox },
   { eCSSKeyword_UNKNOWN, -1 }
 };
 
--- a/widget/LookAndFeel.h
+++ b/widget/LookAndFeel.h
@@ -153,18 +153,16 @@ public:
     eColorID__moz_mac_menutextselect,
     // text color of disabled text on toolbars
     eColorID__moz_mac_disabledtoolbartext,
     //inactive light hightlight
     eColorID__moz_mac_secondaryhighlight,
 
     // vista rebars
 
-    // accent color for title bar
-    eColorID__moz_win_accentcolor,
     // media rebar text
     eColorID__moz_win_mediatext,
     // communications rebar text
     eColorID__moz_win_communicationstext,
 
     // Hyperlink color extracted from the system, not affected by the
     // browser.anchor_color user pref.
     // There is no OS-specified safe background color for this text,
--- a/widget/nsXPLookAndFeel.cpp
+++ b/widget/nsXPLookAndFeel.cpp
@@ -653,19 +653,16 @@ nsXPLookAndFeel::GetStandinForNativeColo
     case eColorID__moz_mac_menutextdisable:
       result = NS_RGB(0x88, 0x88, 0x88); break;
     case eColorID__moz_mac_menutextselect:
       result = NS_RGB(0xFF, 0xFF, 0xFF); break;
     case eColorID__moz_mac_disabledtoolbartext:
       result = NS_RGB(0x3F, 0x3F, 0x3F); break;
     case eColorID__moz_mac_secondaryhighlight:
       result = NS_RGB(0xD4, 0xD4, 0xD4); break;
-    case eColorID__moz_win_accentcolor:
-      // Seems to be the default color (hardcoded because of bug 1065998)
-      result = NS_RGB(0x9E, 0x9E, 0x9E); break;
     case eColorID__moz_win_mediatext:
       result = NS_RGB(0xFF, 0xFF, 0xFF); break;
     case eColorID__moz_win_communicationstext:
       result = NS_RGB(0xFF, 0xFF, 0xFF); break;
     case eColorID__moz_nativehyperlinktext:
       result = NS_RGB(0x00, 0x66, 0xCC); break;
     case eColorID__moz_comboboxtext:
       result = NS_RGB(0x00, 0x00, 0x00); break;
--- a/widget/windows/nsLookAndFeel.cpp
+++ b/widget/windows/nsLookAndFeel.cpp
@@ -257,26 +257,16 @@ nsLookAndFeel::NativeGetColor(ColorID aI
     case eColorID__moz_fieldtext:
     case eColorID__moz_comboboxtext:
       idx = COLOR_WINDOWTEXT;
       break;
     case eColorID__moz_dialog:
     case eColorID__moz_cellhighlight:
       idx = COLOR_3DFACE;
       break;
-    case eColorID__moz_win_accentcolor:
-      res = GetAccentColor(aColor);
-      if (NS_SUCCEEDED(res)) {
-        return res;
-      }
-      NS_WARNING("Using fallback for accent color - UI code failed to use the "
-                 "-moz-windows-accent-color-applies media query properly");
-      // Seems to be the default color (hardcoded because of bug 1065998)
-      aColor = NS_RGB(158, 158, 158);
-      return NS_OK;
     case eColorID__moz_win_mediatext:
       if (IsAppThemed()) {
         res = ::GetColorFromTheme(eUXMediaToolbar,
                                   TP_BUTTON, TS_NORMAL, TMT_TEXTCOLOR, aColor);
         if (NS_SUCCEEDED(res))
           return res;
       }
       // if we've gotten here just return -moz-dialogtext instead
@@ -752,47 +742,8 @@ nsLookAndFeel::SetIntCacheImpl(const nsT
       break;
       case eIntID_WindowsThemeIdentifier:
       mNativeThemeId = entry.value;
       break;
     }
   }
 }
 
-/* static */ nsresult
-nsLookAndFeel::GetAccentColor(nscolor& aColor)
-{
-  nsresult rv;
-
-  if (!mDwmKey) {
-    mDwmKey = do_CreateInstance("@mozilla.org/windows-registry-key;1", &rv);
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return rv;
-    }
-  }
-
-  rv = mDwmKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
-                     NS_LITERAL_STRING("SOFTWARE\\Microsoft\\Windows\\DWM"),
-                     nsIWindowsRegKey::ACCESS_QUERY_VALUE);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  // The ColorPrevalence value is set to 1 when the "Show color on title bar"
-  // setting in the Color section of Window's Personalization settings is
-  // turned on.
-  uint32_t accentColor, colorPrevalence;
-  if (NS_SUCCEEDED(mDwmKey->ReadIntValue(NS_LITERAL_STRING("AccentColor"), &accentColor)) &&
-      NS_SUCCEEDED(mDwmKey->ReadIntValue(NS_LITERAL_STRING("ColorPrevalence"), &colorPrevalence)) &&
-      colorPrevalence == 1) {
-    // The order of the color components in the DWORD stored in the registry
-    // happens to be the same order as we store the components in nscolor
-    // so we can just assign directly here.
-    aColor = accentColor;
-    rv = NS_OK;
-  } else {
-    rv = NS_ERROR_NOT_AVAILABLE;
-  }
-
-  mDwmKey->Close();
-
-  return rv;
-}
--- a/widget/windows/nsLookAndFeel.h
+++ b/widget/windows/nsLookAndFeel.h
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __nsLookAndFeel
 #define __nsLookAndFeel
 
 #include "nsXPLookAndFeel.h"
 #include "gfxFont.h"
 #include "mozilla/RangedArray.h"
-#include "nsIWindowsRegKey.h"
 
 /*
  * Gesture System Metrics
  */
 #ifndef SM_DIGITIZER
 #define SM_DIGITIZER         94
 #define TABLET_CONFIG_NONE   0x00000000
 #define NID_INTEGRATED_TOUCH 0x00000001
@@ -47,23 +46,16 @@ public:
                    float aDevPixPerCSSPixel) override;
   void RefreshImpl() override;
   char16_t GetPasswordCharacterImpl() override;
 
   nsTArray<LookAndFeelInt> GetIntCacheImpl() override;
   void SetIntCacheImpl(const nsTArray<LookAndFeelInt>& aLookAndFeelIntCache) override;
 
 private:
-  /**
-   * Fetches the Windows accent color from the Windows settings if
-   * the accent color is set to apply to the title bar, otherwise
-   * returns an error code.
-   */
-  nsresult GetAccentColor(nscolor& aColor);
-
   // Content process cached values that get shipped over from the browser
   // process.
   int32_t mUseAccessibilityTheme;
   int32_t mUseDefaultTheme; // is the current theme a known default?
   int32_t mNativeThemeId; // see LookAndFeel enum 'WindowsTheme'
 
   struct CachedSystemFont {
     CachedSystemFont()
@@ -74,13 +66,11 @@ private:
     bool mHaveFont;
     nsString mFontName;
     gfxFontStyle mFontStyle;
   };
 
   mozilla::RangedArray<CachedSystemFont,
                        FontID_MINIMUM,
                        FontID_MAXIMUM + 1 - FontID_MINIMUM> mSystemFontCache;
-
-  nsCOMPtr<nsIWindowsRegKey> mDwmKey;
 };
 
 #endif
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -5192,29 +5192,22 @@ nsWindow::ProcessMessage(UINT msg, WPARA
         fontEnum->UpdateFontList(&didChange);
         ForceFontUpdate();
       } //if (NS_SUCCEEDED(rv))
     }
     break;
 
     case WM_SETTINGCHANGE:
     {
-      if (lParam) {
+      if (IsWin10OrLater() && mWindowType == eWindowType_invisible && lParam) {
         auto lParamString = reinterpret_cast<const wchar_t*>(lParam);
-        if (!wcscmp(lParamString, L"ImmersiveColorSet")) {
-          // WM_SYSCOLORCHANGE is not dispatched for accent color changes
-          OnSysColorChanged();
-          break;
-        }
-        if (IsWin10OrLater() && mWindowType == eWindowType_invisible) {
-          if (!wcscmp(lParamString, L"UserInteractionMode")) {
-            nsCOMPtr<nsIWindowsUIUtils> uiUtils(do_GetService("@mozilla.org/windows-ui-utils;1"));
-            if (uiUtils) {
-              uiUtils->UpdateTabletModeState();
-            }
+        if (!wcscmp(lParamString, L"UserInteractionMode")) {
+          nsCOMPtr<nsIWindowsUIUtils> uiUtils(do_GetService("@mozilla.org/windows-ui-utils;1"));
+          if (uiUtils) {
+            uiUtils->UpdateTabletModeState();
           }
         }
       }
     }
     break;
 
     case WM_NCCALCSIZE:
     {