From 6e4c8dd34bd905b24f7e0e6a4ef868eeaf61134d Mon Sep 17 00:00:00 2001
From: wolfbeast <mcwerewolf@gmail.com>
Date: Thu, 26 Jul 2018 17:58:48 +0200
Subject: Bypass transparency optimization with HC themes.

Don't use transparency optimization for theme items in Windows 8
or later with a high contrast theme in use.

See MoonchildProductions/Pale-Moon#1591
---
 widget/windows/nsNativeThemeWin.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'widget/windows')

diff --git a/widget/windows/nsNativeThemeWin.cpp b/widget/windows/nsNativeThemeWin.cpp
index 8950dcf90..475ebce94 100644
--- a/widget/windows/nsNativeThemeWin.cpp
+++ b/widget/windows/nsNativeThemeWin.cpp
@@ -1360,7 +1360,10 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
 static bool
 AssumeThemePartAndStateAreTransparent(int32_t aPart, int32_t aState)
 {
-  if (aPart == MENU_POPUPITEM && aState == MBI_NORMAL) {
+  // When using a high contrast theme on Windows 8 or later, we can't
+  // use this optimization.
+  if (!(IsWin8OrLater() && nsUXThemeData::IsHighContrastOn()) &&
+      aPart == MENU_POPUPITEM && aState == MBI_NORMAL) {
     return true;
   }
   return false;
-- 
cgit v1.2.3


From 74c6c585ab519e3314bdf6b0fa23d8aa757b78a5 Mon Sep 17 00:00:00 2001
From: wolfbeast <mcwerewolf@gmail.com>
Date: Fri, 24 Aug 2018 13:21:17 +0200
Subject: Introduce ui.menu.allow_content_scroll

When true, overrides the OS convention to prevent scrolling of content when contextual menus are open.
This resolves #730.
---
 widget/windows/nsWindow.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'widget/windows')

diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp
index b2bb59bd3..5ce0117b0 100644
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -366,6 +366,9 @@ static const int32_t kResizableBorderMinSize = 3;
 // Cached pointer events enabler value, True if pointer events are enabled.
 static bool gIsPointerEventsEnabled = false;
 
+// Cached scroll outside menu enabler value, True if scrolling is allowed.
+static bool gIsScrollingOutsideEnabled = false;
+
 // We should never really try to accelerate windows bigger than this. In some
 // cases this might lead to no D3D9 acceleration where we could have had it
 // but D3D9 does not reliably report when it supports bigger windows. 8192
@@ -665,6 +668,10 @@ nsWindow::nsWindow()
     Preferences::AddBoolVarCache(&gIsPointerEventsEnabled,
                                  "dom.w3c_pointer_events.enabled",
                                  gIsPointerEventsEnabled);
+    Preferences::AddBoolVarCache(&gIsScrollingOutsideEnabled,
+                                 "ui.menu.allow_content_scroll",
+                                 gIsScrollingOutsideEnabled);
+                                 
   } // !sInstanceCount
 
   mIdleService = nullptr;
@@ -7703,7 +7710,8 @@ nsWindow::DealWithPopups(HWND aWnd, UINT aMessage,
           break;
         }
       }
-      return consumeRollupEvent;
+      // Consume event if appropriate unless overridden.
+      return consumeRollupEvent && !gIsScrollingOutsideEnabled;
 
     case WM_ACTIVATEAPP:
       break;
-- 
cgit v1.2.3


From ab961aeb54335fd07c66de2e3b8c3b6af6f89ea2 Mon Sep 17 00:00:00 2001
From: wolfbeast <mcwerewolf@gmail.com>
Date: Mon, 3 Sep 2018 10:11:38 +0200
Subject: Remove all C++ Telemetry Accumulation calls.

This creates a number of stubs and leaves some surrounding code that may be irrelevant (eg. recorded time stamps, status variables).
Stub resolution/removal should be a follow-up to this.
---
 widget/windows/nsLookAndFeel.cpp | 3 ---
 widget/windows/nsWindow.cpp      | 6 ------
 2 files changed, 9 deletions(-)

(limited to 'widget/windows')

diff --git a/widget/windows/nsLookAndFeel.cpp b/widget/windows/nsLookAndFeel.cpp
index 97f81abfd..a907622d9 100644
--- a/widget/windows/nsLookAndFeel.cpp
+++ b/widget/windows/nsLookAndFeel.cpp
@@ -11,7 +11,6 @@
 #include "nsUXThemeConstants.h"
 #include "gfxFont.h"
 #include "WinUtils.h"
-#include "mozilla/Telemetry.h"
 #include "mozilla/WindowsVersion.h"
 #include "gfxFontConstants.h"
 
@@ -65,8 +64,6 @@ nsLookAndFeel::nsLookAndFeel()
   : nsXPLookAndFeel()
   , mUseAccessibilityTheme(0)
 {
-  mozilla::Telemetry::Accumulate(mozilla::Telemetry::TOUCH_ENABLED_DEVICE,
-                                 WinUtils::IsTouchDeviceSupportPresent());
 }
 
 nsLookAndFeel::~nsLookAndFeel()
diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp
index 5ce0117b0..122d18686 100644
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -4232,10 +4232,6 @@ nsWindow::DispatchMouseEvent(EventMessage aEventMessage, WPARAM wParam,
   }
 
   if (WinUtils::GetIsMouseFromTouch(aEventMessage)) {
-    if (aEventMessage == eMouseDown) {
-      Telemetry::Accumulate(Telemetry::FX_TOUCH_USED, 1);
-    }
-
     if (mTouchWindow) {
       // If mTouchWindow is true, then we must have APZ enabled and be
       // feeding it raw touch events. In that case we don't need to
@@ -6750,8 +6746,6 @@ bool nsWindow::OnGesture(WPARAM wParam, LPARAM lParam)
     bool endFeedback = true;
 
     if (mGesture.PanDeltaToPixelScroll(wheelEvent)) {
-      mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
-          (uint32_t) ScrollInputMethod::MainThreadTouch);
       DispatchEvent(&wheelEvent, status);
     }
 
-- 
cgit v1.2.3