Bug 1294788 - Disable AssumeThemePartAndStateAreTransparent() on high contrast mode since Win8.1. r=jrmuizel, a=sledru
authorsotaro <sotaro.ikeda.g@gmail.com>
Fri, 22 Sep 2017 19:07:15 +0900
changeset 431832 508f470ffb60f0135864855cf64f8374687b9438
parent 431831 f0c4b2d3fcb5afe3e4b75b24563e2084b61ca490
child 431833 d285547c68af03aa5afd9e81a52a8ab2644ce69a
push id7821
push userryanvm@gmail.com
push dateMon, 25 Sep 2017 14:09:06 +0000
treeherdermozilla-beta@fd78928b00d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, sledru
bugs1294788, 888870
milestone57.0
Bug 1294788 - Disable AssumeThemePartAndStateAreTransparent() on high contrast mode since Win8.1. r=jrmuizel, a=sledru The problem happened only on themed widget. The problem was triggered by Bug 888870. It just added Windows 8.1 support. When high contrast mode was enabled on Win 10, background color problem happend on themed widgets. There were 2 patterns. - After hover the menu item, its background color remained highlighted - After hover the menu item, its background color became black From it, the problem seemed to be caused by background color drawing of themed widgets. nsNativeThemeWin::DrawWidgetBackground() does the background color drawing. AssumeThemePartAndStateAreTransparent() controls skipping background color drawing of themed widgets. If AssumeThemePartAndStateAreTransparent() was removed, the problem was addressed. From it, how DrawThemeBackground() works seems to be changed on high contrast mode since since Win8.1. To address the problem, the patch remove the skipping on high contrast mode since since Win8.1
widget/windows/nsNativeThemeWin.cpp
--- a/widget/windows/nsNativeThemeWin.cpp
+++ b/widget/windows/nsNativeThemeWin.cpp
@@ -1487,17 +1487,18 @@ nsNativeThemeWin::GetThemePartAndState(n
   aPart = 0;
   aState = 0;
   return NS_ERROR_FAILURE;
 }
 
 static bool
 AssumeThemePartAndStateAreTransparent(int32_t aPart, int32_t aState)
 {
-  if (aPart == MENU_POPUPITEM && aState == MBI_NORMAL) {
+  if (!(IsWin8Point1OrLater() && nsUXThemeData::IsHighContrastOn()) &&
+      aPart == MENU_POPUPITEM && aState == MBI_NORMAL) {
     return true;
   }
   return false;
 }
 
 // When running with per-monitor DPI (on Win8.1+), and rendering on a display
 // with a different DPI setting from the system's default scaling, we need to
 // apply scaling to native-themed elements as the Windows theme APIs assume