Bug 1734009 - Pass color-related arguments down to the non-native theme in a more convenient way. r=dholbert, a=RyanVM
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 05 Oct 2021 09:40:00 +0000
changeset 663275 0ba5639fa9a0340dfbc894b92eee081d30474ff9
parent 663274 59b63f067f11870e294598b282714fefde62f4cf
child 663276 2a7849f2907a4c4531200f07c3d6cd63d47f411c
push id15936
push userryanvm@gmail.com
push dateThu, 14 Oct 2021 19:36:48 +0000
treeherdermozilla-beta@1fb919a4ac2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert, RyanVM
bugs1734009
milestone94.0
Bug 1734009 - Pass color-related arguments down to the non-native theme in a more convenient way. r=dholbert, a=RyanVM This avoids adding yet another parameter for the light/dark color-scheme. This shouldn't have any behavior change, but is a prerequisite to implement dark form controls on the non-native theme. Differential Revision: https://phabricator.services.mozilla.com/D127482
widget/android/nsNativeBasicThemeAndroid.cpp
widget/android/nsNativeBasicThemeAndroid.h
widget/cocoa/nsNativeBasicThemeCocoa.cpp
widget/cocoa/nsNativeBasicThemeCocoa.h
widget/gtk/nsNativeBasicThemeGTK.cpp
widget/gtk/nsNativeBasicThemeGTK.h
widget/nsNativeBasicTheme.cpp
widget/nsNativeBasicTheme.h
widget/windows/nsNativeBasicThemeWin.h
--- a/widget/android/nsNativeBasicThemeAndroid.cpp
+++ b/widget/android/nsNativeBasicThemeAndroid.cpp
@@ -37,20 +37,20 @@ nsNativeBasicThemeAndroid::GetMinimumWid
   return NS_OK;
 }
 
 template <typename PaintBackendData>
 void nsNativeBasicThemeAndroid::DoPaintScrollbarThumb(
     PaintBackendData& aPaintData, const LayoutDeviceRect& aRect,
     bool aHorizontal, nsIFrame* aFrame, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors aUseSystemColors, DPIRatio aDpiRatio) {
+    const Colors& aColors, DPIRatio aDpiRatio) {
   // TODO(emilio): Maybe do like macOS and draw a stroke?
-  const auto color = ComputeScrollbarThumbColor(
-      aFrame, aStyle, aElementState, aDocumentState, aUseSystemColors);
+  const auto color = ComputeScrollbarThumbColor(aFrame, aStyle, aElementState,
+                                                aDocumentState, aColors);
 
   // Draw the thumb rect centered in the scrollbar.
   LayoutDeviceRect thumbRect(aRect);
   if (aHorizontal) {
     thumbRect.height *= 0.5f;
     thumbRect.y += thumbRect.height * 0.5f;
   } else {
     thumbRect.width *= 0.5f;
@@ -63,30 +63,29 @@ void nsNativeBasicThemeAndroid::DoPaintS
                              sRGBColor::White(0.0f), 0.0f, radius / aDpiRatio,
                              aDpiRatio);
 }
 
 bool nsNativeBasicThemeAndroid::PaintScrollbarThumb(
     DrawTarget& aDt, const LayoutDeviceRect& aRect, bool aHorizontal,
     nsIFrame* aFrame, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors aUseSystemColors, DPIRatio aDpiRatio) {
+    const Colors& aColors, DPIRatio aDpiRatio) {
   DoPaintScrollbarThumb(aDt, aRect, aHorizontal, aFrame, aStyle, aElementState,
-                        aDocumentState, aUseSystemColors, aDpiRatio);
+                        aDocumentState, aColors, aDpiRatio);
   return true;
 }
 
 bool nsNativeBasicThemeAndroid::PaintScrollbarThumb(
     WebRenderBackendData& aWrData, const LayoutDeviceRect& aRect,
     bool aHorizontal, nsIFrame* aFrame, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors aUseSystemColors, DPIRatio aDpiRatio) {
+    const Colors& aColors, DPIRatio aDpiRatio) {
   DoPaintScrollbarThumb(aWrData, aRect, aHorizontal, aFrame, aStyle,
-                        aElementState, aDocumentState, aUseSystemColors,
-                        aDpiRatio);
+                        aElementState, aDocumentState, aColors, aDpiRatio);
   return true;
 }
 
 already_AddRefed<nsITheme> do_GetBasicNativeThemeDoNotUseDirectly() {
   static mozilla::StaticRefPtr<nsITheme> gInstance;
   if (MOZ_UNLIKELY(!gInstance)) {
     gInstance = new nsNativeBasicThemeAndroid();
     ClearOnShutdown(&gInstance);
--- a/widget/android/nsNativeBasicThemeAndroid.h
+++ b/widget/android/nsNativeBasicThemeAndroid.h
@@ -20,77 +20,77 @@ class nsNativeBasicThemeAndroid final : 
   ScrollbarSizes GetScrollbarSizes(nsPresContext*, StyleScrollbarWidth,
                                    Overlay) override;
 
   template <typename PaintBackendData>
   void DoPaintScrollbarThumb(PaintBackendData&, const LayoutDeviceRect& aRect,
                              bool aHorizontal, nsIFrame* aFrame,
                              const ComputedStyle& aStyle,
                              const EventStates& aElementState,
-                             const EventStates& aDocumentState, UseSystemColors,
+                             const EventStates& aDocumentState, const Colors&,
                              DPIRatio);
   bool PaintScrollbarThumb(DrawTarget&, const LayoutDeviceRect& aRect,
                            bool aHorizontal, nsIFrame* aFrame,
                            const ComputedStyle& aStyle,
                            const EventStates& aElementState,
-                           const EventStates& aDocumentState, UseSystemColors,
+                           const EventStates& aDocumentState, const Colors&,
                            DPIRatio) override;
   bool PaintScrollbarThumb(WebRenderBackendData&, const LayoutDeviceRect& aRect,
                            bool aHorizontal, nsIFrame* aFrame,
                            const ComputedStyle& aStyle,
                            const EventStates& aElementState,
-                           const EventStates& aDocumentState, UseSystemColors,
+                           const EventStates& aDocumentState, const Colors&,
                            DPIRatio) override;
 
   bool PaintScrollbarTrack(DrawTarget&, const LayoutDeviceRect& aRect,
                            bool aHorizontal, nsIFrame* aFrame,
                            const ComputedStyle& aStyle,
-                           const EventStates& aDocumentState, UseSystemColors,
+                           const EventStates& aDocumentState, const Colors&,
                            DPIRatio) override {
     // There's no visible track on android.
     return true;
   }
   bool PaintScrollbarTrack(WebRenderBackendData&, const LayoutDeviceRect& aRect,
                            bool aHorizontal, nsIFrame* aFrame,
                            const ComputedStyle& aStyle,
-                           const EventStates& aDocumentState, UseSystemColors,
+                           const EventStates& aDocumentState, const Colors&,
                            DPIRatio) override {
     // There's no visible track on Android.
     return true;
   }
 
   bool PaintScrollbar(DrawTarget&, const LayoutDeviceRect& aRect,
                       bool aHorizontal, nsIFrame* aFrame,
                       const ComputedStyle& aStyle,
                       const EventStates& aElementState,
-                      const EventStates& aDocumentState, UseSystemColors,
+                      const EventStates& aDocumentState, const Colors&,
                       DPIRatio) override {
     // Draw nothing, we only draw the thumb.
     return true;
   }
   bool PaintScrollbar(WebRenderBackendData&, const LayoutDeviceRect& aRect,
                       bool aHorizontal, nsIFrame* aFrame,
                       const ComputedStyle& aStyle,
                       const EventStates& aElementState,
-                      const EventStates& aDocumentState, UseSystemColors,
+                      const EventStates& aDocumentState, const Colors&,
                       DPIRatio) override {
     // Draw nothing, we only draw the thumb.
     return true;
   }
 
   bool PaintScrollCorner(DrawTarget&, const LayoutDeviceRect& aRect,
                          nsIFrame* aFrame, const ComputedStyle& aStyle,
-                         const EventStates& aDocumentState, UseSystemColors,
+                         const EventStates& aDocumentState, const Colors&,
                          DPIRatio aDpiRatio) override {
     // Draw nothing, we only draw the thumb.
     return true;
   }
   bool PaintScrollCorner(WebRenderBackendData&, const LayoutDeviceRect& aRect,
                          nsIFrame* aFrame, const ComputedStyle& aStyle,
-                         const EventStates& aDocumentState, UseSystemColors,
+                         const EventStates& aDocumentState, const Colors&,
                          DPIRatio aDpiRatio) override {
     // Draw nothing, we only draw the thumb.
     return true;
   }
 
   bool ThemeSupportsScrollbarButtons() override { return false; }
 
  protected:
--- a/widget/cocoa/nsNativeBasicThemeCocoa.cpp
+++ b/widget/cocoa/nsNativeBasicThemeCocoa.cpp
@@ -95,28 +95,28 @@ void nsNativeBasicThemeCocoa::DoPaintScr
                              sRGBColor::FromABGR(thumb.mStrokeColor),
                              thumb.mStrokeWidth, radius / aDpiRatio, aDpiRatio);
 }
 
 bool nsNativeBasicThemeCocoa::PaintScrollbarThumb(
     DrawTarget& aDt, const LayoutDeviceRect& aRect, bool aHorizontal,
     nsIFrame* aFrame, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors, DPIRatio aDpiRatio) {
+    const Colors&, DPIRatio aDpiRatio) {
   // TODO: Maybe respect the UseSystemColors setting?
   DoPaintScrollbarThumb(aDt, aRect, aHorizontal, aFrame, aStyle, aElementState,
                         aDocumentState, aDpiRatio);
   return true;
 }
 
 bool nsNativeBasicThemeCocoa::PaintScrollbarThumb(
     WebRenderBackendData& aWrData, const LayoutDeviceRect& aRect,
     bool aHorizontal, nsIFrame* aFrame, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors, DPIRatio aDpiRatio) {
+    const Colors&, DPIRatio aDpiRatio) {
   // TODO: Maybe respect the UseSystemColors setting?
   DoPaintScrollbarThumb(aWrData, aRect, aHorizontal, aFrame, aStyle,
                         aElementState, aDocumentState, aDpiRatio);
   return true;
 }
 
 template <typename PaintBackendData>
 void nsNativeBasicThemeCocoa::DoPaintScrollbarTrack(
@@ -133,27 +133,27 @@ void nsNativeBasicThemeCocoa::DoPaintScr
                sRGBColor::FromABGR(rect.mColor));
     }
   }
 }
 
 bool nsNativeBasicThemeCocoa::PaintScrollbarTrack(
     DrawTarget& aDt, const LayoutDeviceRect& aRect, bool aHorizontal,
     nsIFrame* aFrame, const ComputedStyle& aStyle,
-    const EventStates& aDocumentState, UseSystemColors, DPIRatio aDpiRatio) {
+    const EventStates& aDocumentState, const Colors&, DPIRatio aDpiRatio) {
   // TODO: Maybe respect the UseSystemColors setting?
   DoPaintScrollbarTrack(aDt, aRect, aHorizontal, aFrame, aStyle, aDocumentState,
                         aDpiRatio);
   return true;
 }
 
 bool nsNativeBasicThemeCocoa::PaintScrollbarTrack(
     WebRenderBackendData& aWrData, const LayoutDeviceRect& aRect,
     bool aHorizontal, nsIFrame* aFrame, const ComputedStyle& aStyle,
-    const EventStates& aDocumentState, UseSystemColors, DPIRatio aDpiRatio) {
+    const EventStates& aDocumentState, const Colors&, DPIRatio aDpiRatio) {
   // TODO: Maybe respect the UseSystemColors setting?
   DoPaintScrollbarTrack(aWrData, aRect, aHorizontal, aFrame, aStyle,
                         aDocumentState, aDpiRatio);
   return true;
 }
 
 template <typename PaintBackendData>
 void nsNativeBasicThemeCocoa::DoPaintScrollCorner(
@@ -170,23 +170,23 @@ void nsNativeBasicThemeCocoa::DoPaintScr
                sRGBColor::FromABGR(rect.mColor));
     }
   }
 }
 
 bool nsNativeBasicThemeCocoa::PaintScrollCorner(
     DrawTarget& aDt, const LayoutDeviceRect& aRect, nsIFrame* aFrame,
     const ComputedStyle& aStyle, const EventStates& aDocumentState,
-    UseSystemColors, DPIRatio aDpiRatio) {
+    const Colors&, DPIRatio aDpiRatio) {
   // TODO: Maybe respect the UseSystemColors setting?
   DoPaintScrollCorner(aDt, aRect, aFrame, aStyle, aDocumentState, aDpiRatio);
   return true;
 }
 
 bool nsNativeBasicThemeCocoa::PaintScrollCorner(
     WebRenderBackendData& aWrData, const LayoutDeviceRect& aRect,
     nsIFrame* aFrame, const ComputedStyle& aStyle,
-    const EventStates& aDocumentState, UseSystemColors, DPIRatio aDpiRatio) {
+    const EventStates& aDocumentState, const Colors&, DPIRatio aDpiRatio) {
   // TODO: Maybe respect the UseSystemColors setting?
   DoPaintScrollCorner(aWrData, aRect, aFrame, aStyle, aDocumentState,
                       aDpiRatio);
   return true;
 }
--- a/widget/cocoa/nsNativeBasicThemeCocoa.h
+++ b/widget/cocoa/nsNativeBasicThemeCocoa.h
@@ -31,74 +31,74 @@ class nsNativeBasicThemeCocoa : public n
                              bool aHorizontal, nsIFrame* aFrame,
                              const ComputedStyle& aStyle,
                              const EventStates& aElementState,
                              const EventStates& aDocumentState, DPIRatio);
   bool PaintScrollbarThumb(DrawTarget&, const LayoutDeviceRect& aRect,
                            bool aHorizontal, nsIFrame* aFrame,
                            const ComputedStyle& aStyle,
                            const EventStates& aElementState,
-                           const EventStates& aDocumentState, UseSystemColors,
+                           const EventStates& aDocumentState, const Colors&,
                            DPIRatio) override;
   bool PaintScrollbarThumb(WebRenderBackendData&, const LayoutDeviceRect& aRect,
                            bool aHorizontal, nsIFrame* aFrame,
                            const ComputedStyle& aStyle,
                            const EventStates& aElementState,
-                           const EventStates& aDocumentState, UseSystemColors,
+                           const EventStates& aDocumentState, const Colors&,
                            DPIRatio) override;
 
   template <typename PaintBackendData>
   void DoPaintScrollbarTrack(PaintBackendData&, const LayoutDeviceRect& aRect,
                              bool aHorizontal, nsIFrame* aFrame,
                              const ComputedStyle& aStyle,
                              const EventStates& aDocumentState,
                              DPIRatio aDpiRatio);
   bool PaintScrollbarTrack(DrawTarget&, const LayoutDeviceRect& aRect,
                            bool aHorizontal, nsIFrame* aFrame,
                            const ComputedStyle& aStyle,
-                           const EventStates& aDocumentState, UseSystemColors,
+                           const EventStates& aDocumentState, const Colors&,
                            DPIRatio) override;
   bool PaintScrollbarTrack(WebRenderBackendData&, const LayoutDeviceRect& aRect,
                            bool aHorizontal, nsIFrame* aFrame,
                            const ComputedStyle& aStyle,
-                           const EventStates& aDocumentState, UseSystemColors,
+                           const EventStates& aDocumentState, const Colors&,
                            DPIRatio) override;
 
   bool PaintScrollbar(DrawTarget&, const LayoutDeviceRect& aRect,
                       bool aHorizontal, nsIFrame* aFrame,
                       const ComputedStyle& aStyle,
                       const EventStates& aElementState,
-                      const EventStates& aDocumentState, UseSystemColors,
+                      const EventStates& aDocumentState, const Colors&,
                       DPIRatio) override {
     // Draw nothing; the scrollbar track is drawn in PaintScrollbarTrack.
     return true;
   }
   bool PaintScrollbar(WebRenderBackendData&, const LayoutDeviceRect& aRect,
                       bool aHorizontal, nsIFrame* aFrame,
                       const ComputedStyle& aStyle,
                       const EventStates& aElementState,
-                      const EventStates& aDocumentState, UseSystemColors,
+                      const EventStates& aDocumentState, const Colors&,
                       DPIRatio) override {
     // Draw nothing; the scrollbar track is drawn in PaintScrollbarTrack.
     return true;
   }
 
   template <typename PaintBackendData>
   void DoPaintScrollCorner(PaintBackendData&, const LayoutDeviceRect& aRect,
                            nsIFrame* aFrame, const ComputedStyle& aStyle,
                            const EventStates& aDocumentState,
                            DPIRatio aDpiRatio);
 
   bool PaintScrollCorner(DrawTarget&, const LayoutDeviceRect& aRect,
                          nsIFrame* aFrame, const ComputedStyle& aStyle,
-                         const EventStates& aDocumentState, UseSystemColors,
+                         const EventStates& aDocumentState, const Colors&,
                          DPIRatio aDpiRatio) override;
   bool PaintScrollCorner(WebRenderBackendData&, const LayoutDeviceRect& aRect,
                          nsIFrame* aFrame, const ComputedStyle& aStyle,
-                         const EventStates& aDocumentState, UseSystemColors,
+                         const EventStates& aDocumentState, const Colors&,
                          DPIRatio aDpiRatio) override;
 
   ThemeGeometryType ThemeGeometryTypeForWidget(nsIFrame*,
                                                StyleAppearance) override;
   bool ThemeSupportsWidget(nsPresContext*, nsIFrame*, StyleAppearance) override;
 
  protected:
   virtual ~nsNativeBasicThemeCocoa() = default;
--- a/widget/gtk/nsNativeBasicThemeGTK.cpp
+++ b/widget/gtk/nsNativeBasicThemeGTK.cpp
@@ -20,27 +20,21 @@ already_AddRefed<nsITheme> do_GetBasicNa
     gInstance = new nsNativeBasicThemeGTK();
     ClearOnShutdown(&gInstance);
   }
   return do_AddRef(gInstance);
 }
 
 nsITheme::Transparency nsNativeBasicThemeGTK::GetWidgetTransparency(
     nsIFrame* aFrame, StyleAppearance aAppearance) {
-  if (!sOverlayScrollbars) {
-    if (aAppearance == StyleAppearance::ScrollbarVertical ||
-        aAppearance == StyleAppearance::ScrollbarHorizontal) {
-      nsPresContext* pc = aFrame->PresContext();
-      auto docState = pc->Document()->GetDocumentState();
-      const auto useSystemColors = ShouldUseSystemColors(*pc);
-      const auto* style = nsLayoutUtils::StyleForScrollbar(aFrame);
-      auto trackColor =
-          ComputeScrollbarTrackColor(aFrame, *style, docState, useSystemColors);
-      return trackColor.a == 1.0 ? eOpaque : eTransparent;
-    }
+  if (!sOverlayScrollbars &&
+      (aAppearance == StyleAppearance::ScrollbarVertical ||
+       aAppearance == StyleAppearance::ScrollbarHorizontal) &&
+      IsScrollbarTrackOpaque(aFrame)) {
+    return eOpaque;
   }
   return nsNativeBasicTheme::GetWidgetTransparency(aFrame, aAppearance);
 }
 
 bool nsNativeBasicThemeGTK::ThemeSupportsScrollbarButtons() {
   return StaticPrefs::widget_non_native_theme_gtk_scrollbar_allow_buttons();
 }
 
@@ -104,19 +98,19 @@ static bool IsParentScrollbarHoveredOrAc
                                                       NS_EVENT_STATE_ACTIVE);
 }
 
 template <typename PaintBackendData>
 bool nsNativeBasicThemeGTK::DoPaintScrollbarThumb(
     PaintBackendData& aPaintData, const LayoutDeviceRect& aRect,
     bool aHorizontal, nsIFrame* aFrame, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors aUseSystemColors, DPIRatio aDpiRatio) {
+    const Colors& aColors, DPIRatio aDpiRatio) {
   sRGBColor thumbColor = ComputeScrollbarThumbColor(
-      aFrame, aStyle, aElementState, aDocumentState, aUseSystemColors);
+      aFrame, aStyle, aElementState, aDocumentState, aColors);
 
   LayoutDeviceRect thumbRect(aRect);
 
   if (sOverlayScrollbars && !IsParentScrollbarHoveredOrActive(aFrame)) {
     if (aHorizontal) {
       thumbRect.height *= 0.5;
       thumbRect.y += thumbRect.height;
     } else {
@@ -144,23 +138,23 @@ bool nsNativeBasicThemeGTK::DoPaintScrol
                              radius / aDpiRatio, aDpiRatio);
   return true;
 }
 
 bool nsNativeBasicThemeGTK::PaintScrollbarThumb(
     DrawTarget& aDrawTarget, const LayoutDeviceRect& aRect, bool aHorizontal,
     nsIFrame* aFrame, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors aUseSystemColors, DPIRatio aDpiRatio) {
+    const Colors& aColors, DPIRatio aDpiRatio) {
   return DoPaintScrollbarThumb(aDrawTarget, aRect, aHorizontal, aFrame, aStyle,
-                               aElementState, aDocumentState, aUseSystemColors,
+                               aElementState, aDocumentState, aColors,
                                aDpiRatio);
 }
 
 bool nsNativeBasicThemeGTK::PaintScrollbarThumb(
     WebRenderBackendData& aWrData, const LayoutDeviceRect& aRect,
     bool aHorizontal, nsIFrame* aFrame, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors aUseSystemColors, DPIRatio aDpiRatio) {
+    const Colors& aColors, DPIRatio aDpiRatio) {
   return DoPaintScrollbarThumb(aWrData, aRect, aHorizontal, aFrame, aStyle,
-                               aElementState, aDocumentState, aUseSystemColors,
+                               aElementState, aDocumentState, aColors,
                                aDpiRatio);
 }
--- a/widget/gtk/nsNativeBasicThemeGTK.h
+++ b/widget/gtk/nsNativeBasicThemeGTK.h
@@ -8,40 +8,40 @@
 #define nsNativeBasicThemeGTK_h
 
 #include "nsNativeBasicTheme.h"
 
 class nsNativeBasicThemeGTK : public nsNativeBasicTheme {
  public:
   nsNativeBasicThemeGTK() = default;
 
+  Transparency GetWidgetTransparency(nsIFrame*, StyleAppearance) override;
+
   NS_IMETHOD GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame*,
                                   StyleAppearance,
                                   mozilla::LayoutDeviceIntSize* aResult,
                                   bool* aIsOverridable) override;
 
-  nsITheme::Transparency GetWidgetTransparency(nsIFrame*,
-                                               StyleAppearance) override;
   bool PaintScrollbarThumb(DrawTarget&, const LayoutDeviceRect&,
                            bool aHorizontal, nsIFrame*,
                            const ComputedStyle& aStyle,
                            const EventStates& aElementState,
-                           const EventStates& aDocumentState, UseSystemColors,
+                           const EventStates& aDocumentState, const Colors&,
                            DPIRatio) override;
   bool PaintScrollbarThumb(WebRenderBackendData&, const LayoutDeviceRect&,
                            bool aHorizontal, nsIFrame*,
                            const ComputedStyle& aStyle,
                            const EventStates& aElementState,
-                           const EventStates& aDocumentState, UseSystemColors,
+                           const EventStates& aDocumentState, const Colors&,
                            DPIRatio) override;
   template <typename PaintBackendData>
   bool DoPaintScrollbarThumb(PaintBackendData&, const LayoutDeviceRect&,
                              bool aHorizontal, nsIFrame*, const ComputedStyle&,
                              const EventStates& aElementState,
-                             const EventStates& aDocumentState, UseSystemColors,
+                             const EventStates& aDocumentState, const Colors&,
                              DPIRatio);
 
   bool ThemeSupportsScrollbarButtons() override;
 
  protected:
   virtual ~nsNativeBasicThemeGTK() = default;
 };
 
--- a/widget/nsNativeBasicTheme.cpp
+++ b/widget/nsNativeBasicTheme.cpp
@@ -242,16 +242,34 @@ class nsNativeBasicTheme::AccentColor {
   sRGBColor GetDarker() const {
     if (!mAccentColor) {
       return sDefaultPalette.mAccentDarker;
     }
     return sRGBColor::FromABGR(ColorPalette::GetDarker(*mAccentColor));
   }
 };
 
+// Widget color information associated to a particular frame.
+class nsNativeBasicTheme::Colors {
+  const AccentColor mAccentColor;
+  const bool mUseSystemColors;
+  const LookAndFeel::ColorScheme mColorScheme;
+
+ public:
+  explicit Colors(const nsIFrame* aFrame)
+      : mAccentColor(*aFrame->Style()),
+        mUseSystemColors(ShouldUseSystemColors(*aFrame->PresContext()) ==
+                         UseSystemColors::Yes),
+        mColorScheme(LookAndFeel::ColorSchemeForFrame(aFrame)) {}
+
+  const AccentColor& Accent() const { return mAccentColor; }
+  bool UseSystemColors() const { return mUseSystemColors; }
+  bool IsDark() const { return mColorScheme == LookAndFeel::ColorScheme::Dark; }
+};
+
 CSSIntCoord nsNativeBasicTheme::sHorizontalScrollbarHeight = CSSIntCoord(0);
 CSSIntCoord nsNativeBasicTheme::sVerticalScrollbarWidth = CSSIntCoord(0);
 bool nsNativeBasicTheme::sOverlayScrollbars = false;
 
 static constexpr nsLiteralCString kPrefs[] = {
     "widget.non-native-theme.use-theme-accent"_ns,
     "widget.non-native-theme.win.scrollbar.use-system-size"_ns,
     "widget.non-native-theme.scrollbar.size"_ns,
@@ -413,28 +431,28 @@ static LayoutDeviceRect CheckBoxRadioRec
   // Place a square rect in the center of aRect.
   auto size = std::trunc(std::min(aRect.width, aRect.height));
   auto position = aRect.Center() - LayoutDevicePoint(size * 0.5, size * 0.5);
   return LayoutDeviceRect(position, LayoutDeviceSize(size, size));
 }
 
 std::pair<sRGBColor, sRGBColor> nsNativeBasicTheme::ComputeCheckboxColors(
     const EventStates& aState, StyleAppearance aAppearance,
-    const AccentColor& aAccent, UseSystemColors aUseSystemColors) {
+    const Colors& aColors) {
   MOZ_ASSERT(aAppearance == StyleAppearance::Checkbox ||
              aAppearance == StyleAppearance::Radio);
   bool isDisabled = aState.HasState(NS_EVENT_STATE_DISABLED);
   bool isPressed =
       aState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE);
   bool isHovered = aState.HasState(NS_EVENT_STATE_HOVER);
   bool isChecked = aState.HasState(NS_EVENT_STATE_CHECKED);
   bool isIndeterminate = aAppearance == StyleAppearance::Checkbox &&
                          aState.HasState(NS_EVENT_STATE_INDETERMINATE);
 
-  if (bool(aUseSystemColors)) {
+  if (aColors.UseSystemColors()) {
     sRGBColor backgroundColor = SystemColor(StyleSystemColor::Buttonface);
     sRGBColor borderColor = SystemColor(StyleSystemColor::Buttontext);
     if (isDisabled) {
       borderColor = SystemColor(StyleSystemColor::Graytext);
       if (isChecked || isIndeterminate) {
         backgroundColor = borderColor;
       }
     } else if (isChecked || isIndeterminate) {
@@ -448,47 +466,46 @@ std::pair<sRGBColor, sRGBColor> nsNative
   sRGBColor borderColor = sColorGrey40;
   if (isDisabled) {
     backgroundColor = sColorWhiteAlpha50;
     borderColor = sColorGrey40Alpha50;
     if (isChecked || isIndeterminate) {
       backgroundColor = borderColor;
     }
   } else if (isChecked || isIndeterminate) {
-    const auto& color = isPressed   ? aAccent.GetDarker()
-                        : isHovered ? aAccent.GetDark()
-                                    : aAccent.Get();
+    const auto& color = isPressed   ? aColors.Accent().GetDarker()
+                        : isHovered ? aColors.Accent().GetDark()
+                                    : aColors.Accent().Get();
     backgroundColor = borderColor = color;
   } else if (isPressed) {
     backgroundColor = sColorGrey20;
     borderColor = sColorGrey60;
   } else if (isHovered) {
     backgroundColor = sColorWhite;
     borderColor = sColorGrey50;
   }
 
   return std::make_pair(backgroundColor, borderColor);
 }
 
-sRGBColor nsNativeBasicTheme::ComputeCheckmarkColor(
-    const EventStates& aState, const AccentColor& aAccent,
-    UseSystemColors aUseSystemColors) {
-  if (bool(aUseSystemColors)) {
+sRGBColor nsNativeBasicTheme::ComputeCheckmarkColor(const EventStates& aState,
+                                                    const Colors& aColors) {
+  if (aColors.UseSystemColors()) {
     return SystemColor(StyleSystemColor::Selecteditemtext);
   }
   if (aState.HasState(NS_EVENT_STATE_DISABLED)) {
     return sColorWhiteAlpha80;
   }
-  return aAccent.GetForeground();
+  return aColors.Accent().GetForeground();
 }
 
-sRGBColor nsNativeBasicTheme::ComputeBorderColor(
-    const EventStates& aState, UseSystemColors aUseSystemColors) {
+sRGBColor nsNativeBasicTheme::ComputeBorderColor(const EventStates& aState,
+                                                 const Colors& aColors) {
   bool isDisabled = aState.HasState(NS_EVENT_STATE_DISABLED);
-  if (bool(aUseSystemColors)) {
+  if (aColors.UseSystemColors()) {
     return SystemColor(isDisabled ? StyleSystemColor::Graytext
                                   : StyleSystemColor::Buttontext);
   }
   bool isActive =
       aState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE);
   bool isHovered = aState.HasState(NS_EVENT_STATE_HOVER);
   bool isFocused = aState.HasState(NS_EVENT_STATE_FOCUSRING);
   if (isDisabled) {
@@ -508,25 +525,24 @@ sRGBColor nsNativeBasicTheme::ComputeBor
   }
   if (isHovered) {
     return sColorGrey50;
   }
   return sColorGrey40;
 }
 
 std::pair<sRGBColor, sRGBColor> nsNativeBasicTheme::ComputeButtonColors(
-    const EventStates& aState, UseSystemColors aUseSystemColors,
-    nsIFrame* aFrame) {
+    const EventStates& aState, const Colors& aColors, nsIFrame* aFrame) {
   bool isActive =
       aState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE);
   bool isDisabled = aState.HasState(NS_EVENT_STATE_DISABLED);
   bool isHovered = aState.HasState(NS_EVENT_STATE_HOVER);
 
   const sRGBColor backgroundColor = [&] {
-    if (bool(aUseSystemColors)) {
+    if (aColors.UseSystemColors()) {
       return SystemColor(StyleSystemColor::Buttonface);
     }
 
     if (isDisabled) {
       return sColorGrey10Alpha50;
     }
     if (IsDateTimeResetButton(aFrame)) {
       return sColorWhite;
@@ -535,70 +551,70 @@ std::pair<sRGBColor, sRGBColor> nsNative
       return sColorGrey30;
     }
     if (isHovered) {
       return sColorGrey20;
     }
     return sColorGrey10;
   }();
 
-  const sRGBColor borderColor = ComputeBorderColor(aState, aUseSystemColors);
+  const sRGBColor borderColor = ComputeBorderColor(aState, aColors);
   return std::make_pair(backgroundColor, borderColor);
 }
 
 // NOTE: This should be kept in sync with forms.css, see the comment in the
 // input:autofill rule.
 constexpr nscolor kAutofillColor = NS_RGBA(255, 249, 145, 128);
 
 std::pair<sRGBColor, sRGBColor> nsNativeBasicTheme::ComputeTextfieldColors(
-    const EventStates& aState, UseSystemColors aUseSystemColors) {
+    const EventStates& aState, const Colors& aColors) {
   nscolor backgroundColor = [&] {
-    if (bool(aUseSystemColors)) {
+    if (aColors.UseSystemColors()) {
       return SystemNsColor(StyleSystemColor::Field);
     }
     if (aState.HasState(NS_EVENT_STATE_DISABLED)) {
       return NS_RGBA(0xff, 0xff, 0xff, 128);
     }
     return NS_RGB(0xff, 0xff, 0xff);
   }();
 
   if (aState.HasState(NS_EVENT_STATE_AUTOFILL) &&
       StaticPrefs::layout_css_autofill_background()) {
     backgroundColor = NS_ComposeColors(backgroundColor, kAutofillColor);
   }
 
-  const sRGBColor borderColor = ComputeBorderColor(aState, aUseSystemColors);
+  const sRGBColor borderColor = ComputeBorderColor(aState, aColors);
   return std::make_pair(sRGBColor::FromABGR(backgroundColor), borderColor);
 }
 
 std::pair<sRGBColor, sRGBColor> nsNativeBasicTheme::ComputeRangeProgressColors(
-    const EventStates& aState, const AccentColor& aAccent,
-    UseSystemColors aUseSystemColors) {
-  if (bool(aUseSystemColors)) {
+    const EventStates& aState, const Colors& aColors) {
+  if (aColors.UseSystemColors()) {
     return SystemColorPair(StyleSystemColor::Selecteditem,
                            StyleSystemColor::Buttontext);
   }
 
   bool isActive =
       aState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE);
   bool isDisabled = aState.HasState(NS_EVENT_STATE_DISABLED);
   bool isHovered = aState.HasState(NS_EVENT_STATE_HOVER);
 
   if (isDisabled) {
     return std::make_pair(sColorGrey40Alpha50, sColorGrey40Alpha50);
   }
   if (isActive || isHovered) {
-    return std::make_pair(aAccent.GetDark(), aAccent.GetDarker());
+    return std::make_pair(aColors.Accent().GetDark(),
+                          aColors.Accent().GetDarker());
   }
-  return std::make_pair(aAccent.Get(), aAccent.GetDark());
+  return std::make_pair(aColors.Accent().Get(), aColors.Accent().GetDark());
 }
 
 std::pair<sRGBColor, sRGBColor> nsNativeBasicTheme::ComputeRangeTrackColors(
-    const EventStates& aState, UseSystemColors aUseSystemColors) {
-  if (bool(aUseSystemColors)) {
+    const EventStates& aState, const Colors& aColors) {
+  if (aColors.UseSystemColors()) {
     return SystemColorPair(StyleSystemColor::TextBackground,
                            StyleSystemColor::Buttontext);
   }
   bool isActive =
       aState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE);
   bool isDisabled = aState.HasState(NS_EVENT_STATE_DISABLED);
   bool isHovered = aState.HasState(NS_EVENT_STATE_HOVER);
 
@@ -607,100 +623,106 @@ std::pair<sRGBColor, sRGBColor> nsNative
   }
   if (isActive || isHovered) {
     return std::make_pair(sColorGrey20, sColorGrey50);
   }
   return std::make_pair(sColorGrey10, sColorGrey40);
 }
 
 std::pair<sRGBColor, sRGBColor> nsNativeBasicTheme::ComputeRangeThumbColors(
-    const EventStates& aState, const AccentColor& aAccent,
-    UseSystemColors aUseSystemColors) {
-  if (bool(aUseSystemColors)) {
+    const EventStates& aState, const Colors& aColors) {
+  if (aColors.UseSystemColors()) {
     return SystemColorPair(StyleSystemColor::Selecteditemtext,
                            StyleSystemColor::Selecteditem);
   }
 
   bool isActive =
       aState.HasAllStates(NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE);
   bool isDisabled = aState.HasState(NS_EVENT_STATE_DISABLED);
   bool isHovered = aState.HasState(NS_EVENT_STATE_HOVER);
 
   const sRGBColor& backgroundColor = [&] {
     if (isDisabled) {
       return sColorGrey40;
     }
     if (isActive) {
-      return aAccent.Get();
+      return aColors.Accent().Get();
     }
     if (isHovered) {
       return sColorGrey60;
     }
     return sColorGrey50;
   }();
 
   const sRGBColor borderColor = sColorWhite;
 
   return std::make_pair(backgroundColor, borderColor);
 }
 
 std::pair<sRGBColor, sRGBColor> nsNativeBasicTheme::ComputeProgressColors(
-    const AccentColor& aAccent, UseSystemColors aUseSystemColors) {
-  if (bool(aUseSystemColors)) {
+    const Colors& aColors) {
+  if (aColors.UseSystemColors()) {
     return SystemColorPair(StyleSystemColor::Selecteditem,
                            StyleSystemColor::Buttontext);
   }
-  return std::make_pair(aAccent.Get(), aAccent.GetDark());
+  return std::make_pair(aColors.Accent().Get(), aColors.Accent().GetDark());
 }
 
 std::pair<sRGBColor, sRGBColor> nsNativeBasicTheme::ComputeProgressTrackColors(
-    UseSystemColors aUseSystemColors) {
-  if (bool(aUseSystemColors)) {
+    const Colors& aColors) {
+  if (aColors.UseSystemColors()) {
     return SystemColorPair(StyleSystemColor::Buttonface,
                            StyleSystemColor::Buttontext);
   }
   return std::make_pair(sColorGrey10, sColorGrey40);
 }
 
 std::pair<sRGBColor, sRGBColor> nsNativeBasicTheme::ComputeMeterchunkColors(
-    const EventStates& aMeterState, UseSystemColors aUseSystemColors) {
-  if (bool(aUseSystemColors)) {
-    // Accent color doesn't matter when using system colors.
-    return ComputeProgressColors(AccentColor(), aUseSystemColors);
+    const EventStates& aMeterState, const Colors& aColors) {
+  if (aColors.UseSystemColors()) {
+    return ComputeProgressColors(aColors);
   }
   sRGBColor borderColor = sColorMeterGreen20;
   sRGBColor chunkColor = sColorMeterGreen10;
 
   if (aMeterState.HasState(NS_EVENT_STATE_SUB_OPTIMUM)) {
     borderColor = sColorMeterYellow20;
     chunkColor = sColorMeterYellow10;
   } else if (aMeterState.HasState(NS_EVENT_STATE_SUB_SUB_OPTIMUM)) {
     borderColor = sColorMeterRed20;
     chunkColor = sColorMeterRed10;
   }
 
   return std::make_pair(chunkColor, borderColor);
 }
 
 std::array<sRGBColor, 3> nsNativeBasicTheme::ComputeFocusRectColors(
-    const AccentColor& aAccent, UseSystemColors aUseSystemColors) {
-  if (bool(aUseSystemColors)) {
+    const Colors& aColors) {
+  if (aColors.UseSystemColors()) {
     return {SystemColor(StyleSystemColor::Selecteditem),
             SystemColor(StyleSystemColor::Buttontext),
             SystemColor(StyleSystemColor::TextBackground)};
   }
 
-  return {aAccent.Get(), sColorWhiteAlpha80, aAccent.GetLight()};
+  return {aColors.Accent().Get(), sColorWhiteAlpha80,
+          aColors.Accent().GetLight()};
+}
+
+bool nsNativeBasicTheme::IsScrollbarTrackOpaque(nsIFrame* aFrame) {
+  auto trackColor = ComputeScrollbarTrackColor(
+      aFrame, *nsLayoutUtils::StyleForScrollbar(aFrame),
+      aFrame->PresContext()->Document()->GetDocumentState(), Colors(aFrame));
+  return trackColor.a == 1.0f;
 }
 
 sRGBColor nsNativeBasicTheme::ComputeScrollbarTrackColor(
     nsIFrame* aFrame, const ComputedStyle& aStyle,
-    const EventStates& aDocumentState, UseSystemColors aUseSystemColors) {
+    const EventStates& aDocumentState, const Colors& aColors) {
   const nsStyleUI* ui = aStyle.StyleUI();
-  if (bool(aUseSystemColors)) {
+  if (aColors.UseSystemColors()) {
     return SystemColor(StyleSystemColor::TextBackground);
   }
   if (ShouldUseDarkScrollbar(aFrame, aStyle)) {
     return sRGBColor::FromU8(20, 20, 25, 77);
   }
   if (ui->mScrollbarColor.IsColors()) {
     return sRGBColor::FromABGR(
         ui->mScrollbarColor.AsColors().track.CalcColor(aStyle));
@@ -836,18 +858,18 @@ static bool ShouldUseColorForActiveDarkS
   };
   return IsDifferentEnough(NS_GET_R(aColor), NS_GET_G(aColor)) ||
          IsDifferentEnough(NS_GET_R(aColor), NS_GET_B(aColor));
 }
 
 sRGBColor nsNativeBasicTheme::ComputeScrollbarThumbColor(
     nsIFrame* aFrame, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors aUseSystemColors) {
-  if (!bool(aUseSystemColors) && ShouldUseDarkScrollbar(aFrame, aStyle)) {
+    const Colors& aColors) {
+  if (!aColors.UseSystemColors() && ShouldUseDarkScrollbar(aFrame, aStyle)) {
     if (aElementState.HasState(NS_EVENT_STATE_ACTIVE) &&
         StaticPrefs::widget_non_native_theme_scrollbar_active_always_themed()) {
       auto color = LookAndFeel::GetColor(
           StyleSystemColor::ThemedScrollbarThumbActive,
           LookAndFeel::ColorScheme::Light, LookAndFeel::UseStandins::No);
       if (color && ShouldUseColorForActiveDarkScrollbarThumb(*color)) {
         return sRGBColor::FromABGR(*color);
       }
@@ -862,79 +884,80 @@ sRGBColor nsNativeBasicTheme::ComputeScr
         ui->mScrollbarColor.AsColors().thumb.CalcColor(aStyle), aElementState));
   }
 
   auto systemColor = [&] {
     if (aDocumentState.HasState(NS_DOCUMENT_STATE_WINDOW_INACTIVE)) {
       return StyleSystemColor::ThemedScrollbarThumbInactive;
     }
     if (aElementState.HasState(NS_EVENT_STATE_ACTIVE)) {
-      if (bool(aUseSystemColors)) {
+      if (aColors.UseSystemColors()) {
         return StyleSystemColor::Selecteditem;
       }
       return StyleSystemColor::ThemedScrollbarThumbActive;
     }
     if (aElementState.HasState(NS_EVENT_STATE_HOVER)) {
-      if (bool(aUseSystemColors)) {
+      if (aColors.UseSystemColors()) {
         return StyleSystemColor::Selecteditem;
       }
       return StyleSystemColor::ThemedScrollbarThumbHover;
     }
-    if (bool(aUseSystemColors)) {
+    if (aColors.UseSystemColors()) {
       return StyleSystemColor::TextForeground;
     }
     return StyleSystemColor::ThemedScrollbarThumb;
   }();
 
   return SystemColorOrElse(systemColor, [&] {
     return sRGBColor::FromABGR(AdjustUnthemedScrollbarThumbColor(
         sScrollbarThumbColor.ToABGR(), aElementState));
   });
 }
 
 std::pair<sRGBColor, sRGBColor>
 nsNativeBasicTheme::ComputeScrollbarButtonColors(
     nsIFrame* aFrame, StyleAppearance aAppearance, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors aUseSystemColors) {
-  if (bool(aUseSystemColors)) {
+    const Colors& aColors) {
+  if (aColors.UseSystemColors()) {
     if (aElementState.HasAtLeastOneOfStates(NS_EVENT_STATE_ACTIVE |
                                             NS_EVENT_STATE_HOVER)) {
       return SystemColorPair(StyleSystemColor::Selecteditem,
                              StyleSystemColor::Buttonface);
     }
     return SystemColorPair(StyleSystemColor::TextBackground,
                            StyleSystemColor::TextForeground);
   }
 
-  auto trackColor = ComputeScrollbarTrackColor(aFrame, aStyle, aDocumentState,
-                                               aUseSystemColors);
+  auto trackColor =
+      ComputeScrollbarTrackColor(aFrame, aStyle, aDocumentState, aColors);
   nscolor buttonColor =
       GetScrollbarButtonColor(trackColor.ToABGR(), aElementState);
   auto arrowColor =
       GetScrollbarArrowColor(buttonColor)
           .map(sRGBColor::FromABGR)
           .valueOrFrom([&] {
             return ComputeScrollbarThumbColor(aFrame, aStyle, aElementState,
-                                              aDocumentState, aUseSystemColors);
+                                              aDocumentState, aColors);
           });
   return {sRGBColor::FromABGR(buttonColor), arrowColor};
 }
 
 static const CSSCoord kInnerFocusOutlineWidth = 2.0f;
 
 template <typename PaintBackendData>
-void nsNativeBasicTheme::PaintRoundedFocusRect(
-    PaintBackendData& aBackendData, const LayoutDeviceRect& aRect,
-    const AccentColor& aAccent, UseSystemColors aUseSystemColors,
-    DPIRatio aDpiRatio, CSSCoord aRadius, CSSCoord aOffset) {
+void nsNativeBasicTheme::PaintRoundedFocusRect(PaintBackendData& aBackendData,
+                                               const LayoutDeviceRect& aRect,
+                                               const Colors& aColors,
+                                               DPIRatio aDpiRatio,
+                                               CSSCoord aRadius,
+                                               CSSCoord aOffset) {
   // NOTE(emilio): If the widths or offsets here change, make sure to tweak
   // the GetWidgetOverflow path for FocusOutline.
-  auto [innerColor, middleColor, outerColor] =
-      ComputeFocusRectColors(aAccent, aUseSystemColors);
+  auto [innerColor, middleColor, outerColor] = ComputeFocusRectColors(aColors);
 
   LayoutDeviceRect focusRect(aRect);
 
   // The focus rect is painted outside of the border area (aRect), see:
   //
   //   data:text/html,<div style="border: 1px solid; outline: 2px solid
   //   red">Foobar</div>
   //
@@ -1100,59 +1123,55 @@ void nsNativeBasicTheme::PaintRoundedRec
   if (needsClip) {
     aDrawTarget.PopClip();
   }
 }
 
 void nsNativeBasicTheme::PaintCheckboxControl(DrawTarget& aDrawTarget,
                                               const LayoutDeviceRect& aRect,
                                               const EventStates& aState,
-                                              const AccentColor& aAccent,
-                                              UseSystemColors aUseSystemColors,
+                                              const Colors& aColors,
                                               DPIRatio aDpiRatio) {
-  auto [backgroundColor, borderColor] = ComputeCheckboxColors(
-      aState, StyleAppearance::Checkbox, aAccent, aUseSystemColors);
+  auto [backgroundColor, borderColor] =
+      ComputeCheckboxColors(aState, StyleAppearance::Checkbox, aColors);
   {
     const CSSCoord radius = 2.0f;
     CSSCoord borderWidth = kCheckboxRadioBorderWidth;
     if (backgroundColor == borderColor) {
       borderWidth = 0.0f;
     }
     PaintRoundedRectWithRadius(aDrawTarget, aRect, backgroundColor, borderColor,
                                borderWidth, radius, aDpiRatio);
   }
 
   if (aState.HasState(NS_EVENT_STATE_INDETERMINATE)) {
-    PaintIndeterminateMark(aDrawTarget, aRect, aState, aAccent,
-                           aUseSystemColors);
+    PaintIndeterminateMark(aDrawTarget, aRect, aState, aColors);
   } else if (aState.HasState(NS_EVENT_STATE_CHECKED)) {
-    PaintCheckMark(aDrawTarget, aRect, aState, aAccent, aUseSystemColors);
+    PaintCheckMark(aDrawTarget, aRect, aState, aColors);
   }
 
   if (aState.HasState(NS_EVENT_STATE_FOCUSRING)) {
-    PaintRoundedFocusRect(aDrawTarget, aRect, aAccent, aUseSystemColors,
-                          aDpiRatio, 5.0f, 1.0f);
+    PaintRoundedFocusRect(aDrawTarget, aRect, aColors, aDpiRatio, 5.0f, 1.0f);
   }
 }
 
 constexpr CSSCoord kCheckboxRadioContentBoxSize = 10.0f;
 constexpr CSSCoord kCheckboxRadioBorderBoxSize =
     kCheckboxRadioContentBoxSize + kCheckboxRadioBorderWidth * 2.0f;
 
 // Returns the right scale for points in a aSize x aSize sized box, centered at
 // 0x0 to fill aRect in the smaller dimension.
 static float ScaleToFillRect(const LayoutDeviceRect& aRect, const float aSize) {
   return std::min(aRect.width, aRect.height) / aSize;
 }
 
 void nsNativeBasicTheme::PaintCheckMark(DrawTarget& aDrawTarget,
                                         const LayoutDeviceRect& aRect,
                                         const EventStates& aState,
-                                        const AccentColor& aAccent,
-                                        UseSystemColors aUseSystemColors) {
+                                        const Colors& aColors) {
   // Points come from the coordinates on a 14X14 (kCheckboxRadioBorderBoxSize)
   // unit box centered at 0,0
   const float checkPolygonX[] = {-4.5f, -1.5f, -0.5f, 5.0f, 4.75f,
                                  3.5f,  -0.5f, -1.5f, -3.5f};
   const float checkPolygonY[] = {0.5f,  4.0f, 4.0f,  -2.5f, -4.0f,
                                  -4.0f, 1.0f, 1.25f, -1.0f};
   const int32_t checkNumPoints = sizeof(checkPolygonX) / sizeof(float);
   const float scale = ScaleToFillRect(aRect, kCheckboxRadioBorderBoxSize);
@@ -1162,36 +1181,34 @@ void nsNativeBasicTheme::PaintCheckMark(
   Point p = center + Point(checkPolygonX[0] * scale, checkPolygonY[0] * scale);
   builder->MoveTo(p);
   for (int32_t i = 1; i < checkNumPoints; i++) {
     p = center + Point(checkPolygonX[i] * scale, checkPolygonY[i] * scale);
     builder->LineTo(p);
   }
   RefPtr<Path> path = builder->Finish();
 
-  sRGBColor fillColor =
-      ComputeCheckmarkColor(aState, aAccent, aUseSystemColors);
+  sRGBColor fillColor = ComputeCheckmarkColor(aState, aColors);
   aDrawTarget.Fill(path, ColorPattern(ToDeviceColor(fillColor)));
 }
 
-void nsNativeBasicTheme::PaintIndeterminateMark(
-    DrawTarget& aDrawTarget, const LayoutDeviceRect& aRect,
-    const EventStates& aState, const AccentColor& aAccent,
-    UseSystemColors aUseSystemColors) {
+void nsNativeBasicTheme::PaintIndeterminateMark(DrawTarget& aDrawTarget,
+                                                const LayoutDeviceRect& aRect,
+                                                const EventStates& aState,
+                                                const Colors& aColors) {
   const CSSCoord borderWidth = 2.0f;
   const float scale = ScaleToFillRect(aRect, kCheckboxRadioBorderBoxSize);
 
   Rect rect = aRect.ToUnknownRect();
   rect.y += (rect.height / 2) - (borderWidth * scale / 2);
   rect.height = borderWidth * scale;
   rect.x += (borderWidth * scale) + (borderWidth * scale / 8);
   rect.width -= ((borderWidth * scale) + (borderWidth * scale / 8)) * 2;
 
-  sRGBColor fillColor =
-      ComputeCheckmarkColor(aState, aAccent, aUseSystemColors);
+  sRGBColor fillColor = ComputeCheckmarkColor(aState, aColors);
   aDrawTarget.FillRect(rect, ColorPattern(ToDeviceColor(fillColor)));
 }
 
 template <typename PaintBackendData>
 void nsNativeBasicTheme::PaintStrokedCircle(PaintBackendData& aPaintData,
                                             const LayoutDeviceRect& aRect,
                                             const sRGBColor& aBackgroundColor,
                                             const sRGBColor& aBorderColor,
@@ -1275,106 +1292,96 @@ void nsNativeBasicTheme::PaintCircleShad
   aDrawTarget.DrawFilter(blurFilter, sourceRectInFilterSpace,
                          destinationPointOfSourceRect);
 }
 
 template <typename PaintBackendData>
 void nsNativeBasicTheme::PaintRadioControl(PaintBackendData& aPaintData,
                                            const LayoutDeviceRect& aRect,
                                            const EventStates& aState,
-                                           const AccentColor& aAccent,
-                                           UseSystemColors aUseSystemColors,
+                                           const Colors& aColors,
                                            DPIRatio aDpiRatio) {
-  auto [backgroundColor, borderColor] = ComputeCheckboxColors(
-      aState, StyleAppearance::Radio, aAccent, aUseSystemColors);
+  auto [backgroundColor, borderColor] =
+      ComputeCheckboxColors(aState, StyleAppearance::Radio, aColors);
   {
     CSSCoord borderWidth = kCheckboxRadioBorderWidth;
     if (backgroundColor == borderColor) {
       borderWidth = 0.0f;
     }
     PaintStrokedCircle(aPaintData, aRect, backgroundColor, borderColor,
                        borderWidth, aDpiRatio);
   }
 
   if (aState.HasState(NS_EVENT_STATE_CHECKED)) {
     LayoutDeviceRect rect(aRect);
     rect.Deflate(SnapBorderWidth(kCheckboxRadioBorderWidth, aDpiRatio));
 
-    auto checkColor = ComputeCheckmarkColor(aState, aAccent, aUseSystemColors);
+    auto checkColor = ComputeCheckmarkColor(aState, aColors);
     PaintStrokedCircle(aPaintData, rect, backgroundColor, checkColor,
                        kCheckboxRadioBorderWidth, aDpiRatio);
   }
 
   if (aState.HasState(NS_EVENT_STATE_FOCUSRING)) {
-    PaintRoundedFocusRect(aPaintData, aRect, aAccent, aUseSystemColors,
-                          aDpiRatio, 5.0f, 1.0f);
+    PaintRoundedFocusRect(aPaintData, aRect, aColors, aDpiRatio, 5.0f, 1.0f);
   }
 }
 
 template <typename PaintBackendData>
 void nsNativeBasicTheme::PaintTextField(PaintBackendData& aPaintData,
                                         const LayoutDeviceRect& aRect,
                                         const EventStates& aState,
-                                        const AccentColor& aAccent,
-                                        UseSystemColors aUseSystemColors,
+                                        const Colors& aColors,
                                         DPIRatio aDpiRatio) {
-  auto [backgroundColor, borderColor] =
-      ComputeTextfieldColors(aState, aUseSystemColors);
+  auto [backgroundColor, borderColor] = ComputeTextfieldColors(aState, aColors);
 
   const CSSCoord radius = 2.0f;
 
   PaintRoundedRectWithRadius(aPaintData, aRect, backgroundColor, borderColor,
                              kTextFieldBorderWidth, radius, aDpiRatio);
 
   if (aState.HasState(NS_EVENT_STATE_FOCUSRING)) {
-    PaintRoundedFocusRect(aPaintData, aRect, aAccent, aUseSystemColors,
-                          aDpiRatio, radius + kTextFieldBorderWidth,
+    PaintRoundedFocusRect(aPaintData, aRect, aColors, aDpiRatio,
+                          radius + kTextFieldBorderWidth,
                           -kTextFieldBorderWidth);
   }
 }
 
 template <typename PaintBackendData>
 void nsNativeBasicTheme::PaintListbox(PaintBackendData& aPaintData,
                                       const LayoutDeviceRect& aRect,
                                       const EventStates& aState,
-                                      const AccentColor& aAccent,
-                                      UseSystemColors aUseSystemColors,
+                                      const Colors& aColors,
                                       DPIRatio aDpiRatio) {
   const CSSCoord radius = 2.0f;
-  auto [backgroundColor, borderColor] =
-      ComputeTextfieldColors(aState, aUseSystemColors);
+  auto [backgroundColor, borderColor] = ComputeTextfieldColors(aState, aColors);
 
   PaintRoundedRectWithRadius(aPaintData, aRect, backgroundColor, borderColor,
                              kMenulistBorderWidth, radius, aDpiRatio);
 
   if (aState.HasState(NS_EVENT_STATE_FOCUSRING)) {
-    PaintRoundedFocusRect(aPaintData, aRect, aAccent, aUseSystemColors,
-                          aDpiRatio, radius + kMenulistBorderWidth,
-                          -kMenulistBorderWidth);
+    PaintRoundedFocusRect(aPaintData, aRect, aColors, aDpiRatio,
+                          radius + kMenulistBorderWidth, -kMenulistBorderWidth);
   }
 }
 
 template <typename PaintBackendData>
 void nsNativeBasicTheme::PaintMenulist(PaintBackendData& aDrawTarget,
                                        const LayoutDeviceRect& aRect,
                                        const EventStates& aState,
-                                       const AccentColor& aAccent,
-                                       UseSystemColors aUseSystemColors,
+                                       const Colors& aColors,
                                        DPIRatio aDpiRatio) {
   const CSSCoord radius = 4.0f;
-  auto [backgroundColor, borderColor] =
-      ComputeButtonColors(aState, aUseSystemColors);
+  auto [backgroundColor, borderColor] = ComputeButtonColors(aState, aColors);
 
   PaintRoundedRectWithRadius(aDrawTarget, aRect, backgroundColor, borderColor,
                              kMenulistBorderWidth, radius, aDpiRatio);
 
   if (aState.HasState(NS_EVENT_STATE_FOCUSRING)) {
-    PaintRoundedFocusRect(aDrawTarget, aRect, aAccent, aUseSystemColors,
-                          aDpiRatio, radius + kMenulistBorderWidth,
-                          -kMenulistBorderWidth);
+    PaintRoundedFocusRect(aDrawTarget, aRect, aColors, aDpiRatio,
+                          radius + kMenulistBorderWidth, -kMenulistBorderWidth);
   }
 }
 
 void nsNativeBasicTheme::PaintArrow(DrawTarget& aDrawTarget,
                                     const LayoutDeviceRect& aRect,
                                     const float aArrowPolygonX[],
                                     const float aArrowPolygonY[],
                                     const float aArrowPolygonSize,
@@ -1392,38 +1399,38 @@ void nsNativeBasicTheme::PaintArrow(Draw
     p = center + Point(aArrowPolygonX[i] * scale, aArrowPolygonY[i] * scale);
     builder->LineTo(p);
   }
   RefPtr<Path> path = builder->Finish();
 
   aDrawTarget.Fill(path, ColorPattern(ToDeviceColor(aFillColor)));
 }
 
-void nsNativeBasicTheme::PaintMenulistArrowButton(
-    nsIFrame* aFrame, DrawTarget& aDrawTarget, const LayoutDeviceRect& aRect,
-    const EventStates& aState, UseSystemColors aUseSystemColors) {
+void nsNativeBasicTheme::PaintMenulistArrowButton(nsIFrame* aFrame,
+                                                  DrawTarget& aDrawTarget,
+                                                  const LayoutDeviceRect& aRect,
+                                                  const EventStates& aState) {
   const float kPolygonX[] = {-4.0f, -0.5f, 0.5f, 4.0f,  4.0f,
                              3.0f,  0.0f,  0.0f, -3.0f, -4.0f};
   const float kPolygonY[] = {-1,    3.0f, 3.0f, -1.0f, -2.0f,
                              -2.0f, 1.5f, 1.5f, -2.0f, -2.0f};
 
   const float kPolygonSize = kMinimumDropdownArrowButtonWidth;
 
   const auto arrowColor = sRGBColor::FromABGR(
       nsLayoutUtils::GetColor(aFrame, &nsStyleText::mWebkitTextFillColor));
   PaintArrow(aDrawTarget, aRect, kPolygonX, kPolygonY, kPolygonSize,
              ArrayLength(kPolygonX), arrowColor);
 }
 
 void nsNativeBasicTheme::PaintSpinnerButton(
     nsIFrame* aFrame, DrawTarget& aDrawTarget, const LayoutDeviceRect& aRect,
     const EventStates& aState, StyleAppearance aAppearance,
-    UseSystemColors aUseSystemColors, DPIRatio aDpiRatio) {
-  auto [backgroundColor, borderColor] =
-      ComputeButtonColors(aState, aUseSystemColors);
+    const Colors& aColors, DPIRatio aDpiRatio) {
+  auto [backgroundColor, borderColor] = ComputeButtonColors(aState, aColors);
 
   aDrawTarget.FillRect(aRect.ToUnknownRect(),
                        ColorPattern(ToDeviceColor(backgroundColor)));
 
   const float kPolygonX[] = {-3.5f, -0.5f, 0.5f, 3.5f,  3.5f,
                              2.5f,  0.0f,  0.0f, -2.5f, -3.5f};
   float polygonY[] = {-1.5f, 1.5f, 1.5f, -1.5f, -2.5f,
                       -2.5f, 0.0f, 0.0f, -2.5f, -2.5f};
@@ -1439,19 +1446,18 @@ void nsNativeBasicTheme::PaintSpinnerBut
              ArrayLength(kPolygonX), borderColor);
 }
 
 template <typename PaintBackendData>
 void nsNativeBasicTheme::PaintRange(nsIFrame* aFrame,
                                     PaintBackendData& aPaintData,
                                     const LayoutDeviceRect& aRect,
                                     const EventStates& aState,
-                                    const AccentColor& aAccent,
-                                    UseSystemColors aUseSystemColors,
-                                    DPIRatio aDpiRatio, bool aHorizontal) {
+                                    const Colors& aColors, DPIRatio aDpiRatio,
+                                    bool aHorizontal) {
   nsRangeFrame* rangeFrame = do_QueryFrame(aFrame);
   if (!rangeFrame) {
     return;
   }
 
   double progress = rangeFrame->GetValueAsFractionOfRange();
   auto rect = aRect;
   LayoutDeviceRect thumbRect(0, 0, kMinimumRangeThumbSize * aDpiRatio,
@@ -1487,19 +1493,19 @@ void nsNativeBasicTheme::PaintRange(nsIF
     trackClipRect.SetBoxY(aRect.Y(), midPoint);
     progressClipRect.SetBoxY(midPoint, aRect.YMost());
   }
 
   const CSSCoord borderWidth = 1.0f;
   const CSSCoord radius = 3.0f;
 
   auto [progressColor, progressBorderColor] =
-      ComputeRangeProgressColors(aState, aAccent, aUseSystemColors);
+      ComputeRangeProgressColors(aState, aColors);
   auto [trackColor, trackBorderColor] =
-      ComputeRangeTrackColors(aState, aUseSystemColors);
+      ComputeRangeTrackColors(aState, aColors);
 
   PaintRoundedRectWithRadius(aPaintData, rect, progressClipRect, progressColor,
                              progressBorderColor, borderWidth, radius,
                              aDpiRatio);
 
   PaintRoundedRectWithRadius(aPaintData, rect, trackClipRect, trackColor,
                              trackBorderColor, borderWidth, radius, aDpiRatio);
 
@@ -1511,34 +1517,32 @@ void nsNativeBasicTheme::PaintRange(nsIF
     // Thumb shadow
     PaintCircleShadow(aPaintData, thumbRect, overflowRect, 0.3f,
                       CSSPoint(0.0f, 2.0f), 2.0f, aDpiRatio);
   }
 
   // Draw the thumb on top.
   const CSSCoord thumbBorderWidth = 2.0f;
   auto [thumbColor, thumbBorderColor] =
-      ComputeRangeThumbColors(aState, aAccent, aUseSystemColors);
+      ComputeRangeThumbColors(aState, aColors);
 
   PaintStrokedCircle(aPaintData, thumbRect, thumbColor, thumbBorderColor,
                      thumbBorderWidth, aDpiRatio);
 
   if (aState.HasState(NS_EVENT_STATE_FOCUSRING)) {
-    PaintRoundedFocusRect(aPaintData, aRect, aAccent, aUseSystemColors,
-                          aDpiRatio, radius, 1.0f);
+    PaintRoundedFocusRect(aPaintData, aRect, aColors, aDpiRatio, radius, 1.0f);
   }
 }
 
 template <typename PaintBackendData>
 void nsNativeBasicTheme::PaintProgress(nsIFrame* aFrame,
                                        PaintBackendData& aPaintData,
                                        const LayoutDeviceRect& aRect,
                                        const EventStates& aState,
-                                       const AccentColor& aAccent,
-                                       UseSystemColors aUseSystemColors,
+                                       const Colors& aColors,
                                        DPIRatio aDpiRatio, bool aIsMeter) {
   const CSSCoord borderWidth = 1.0f;
   const CSSCoord radius = aIsMeter ? 6.0f : 3.0f;
 
   LayoutDeviceRect rect(aRect);
   const LayoutDeviceCoord thickness =
       (aIsMeter ? kMeterHeight : kProgressbarHeight) * aDpiRatio;
 
@@ -1550,18 +1554,17 @@ void nsNativeBasicTheme::PaintProgress(n
   } else {
     // Center it horizontally.
     rect.x += (rect.width - thickness) / 2;
     rect.width = thickness;
   }
 
   {
     // Paint the track, unclipped.
-    auto [backgroundColor, borderColor] =
-        ComputeProgressTrackColors(aUseSystemColors);
+    auto [backgroundColor, borderColor] = ComputeProgressTrackColors(aColors);
     PaintRoundedRectWithRadius(aPaintData, rect, rect, backgroundColor,
                                borderColor, borderWidth, radius, aDpiRatio);
   }
 
   // Now paint the chunk, clipped as needed.
   LayoutDeviceRect clipRect = rect;
   if (aState.HasState(NS_EVENT_STATE_INDETERMINATE)) {
     // For indeterminate progress, we paint an animated chunk of 1/3 of the
@@ -1615,154 +1618,149 @@ void nsNativeBasicTheme::PaintProgress(n
     } else {
       double clipHeight = rect.height * position;
       clipRect.height = clipHeight;
       clipRect.y += rect.height - clipHeight;
     }
   }
 
   auto [backgroundColor, borderColor] =
-      aIsMeter ? ComputeMeterchunkColors(aState, aUseSystemColors)
-               : ComputeProgressColors(aAccent, aUseSystemColors);
+      aIsMeter ? ComputeMeterchunkColors(aState, aColors)
+               : ComputeProgressColors(aColors);
   PaintRoundedRectWithRadius(aPaintData, rect, clipRect, backgroundColor,
                              borderColor, borderWidth, radius, aDpiRatio);
 }
 
 template <typename PaintBackendData>
 void nsNativeBasicTheme::PaintButton(nsIFrame* aFrame,
                                      PaintBackendData& aPaintData,
                                      const LayoutDeviceRect& aRect,
                                      const EventStates& aState,
-                                     const AccentColor& aAccent,
-                                     UseSystemColors aUseSystemColors,
+                                     const Colors& aColors,
                                      DPIRatio aDpiRatio) {
   const CSSCoord radius = 4.0f;
   auto [backgroundColor, borderColor] =
-      ComputeButtonColors(aState, aUseSystemColors, aFrame);
+      ComputeButtonColors(aState, aColors, aFrame);
 
   PaintRoundedRectWithRadius(aPaintData, aRect, backgroundColor, borderColor,
                              kButtonBorderWidth, radius, aDpiRatio);
 
   if (aState.HasState(NS_EVENT_STATE_FOCUSRING)) {
-    PaintRoundedFocusRect(aPaintData, aRect, aAccent, aUseSystemColors,
-                          aDpiRatio, radius + kButtonBorderWidth,
-                          -kButtonBorderWidth);
+    PaintRoundedFocusRect(aPaintData, aRect, aColors, aDpiRatio,
+                          radius + kButtonBorderWidth, -kButtonBorderWidth);
   }
 }
 
 template <typename PaintBackendData>
 bool nsNativeBasicTheme::DoPaintDefaultScrollbarThumb(
     PaintBackendData& aPaintData, const LayoutDeviceRect& aRect,
     bool aHorizontal, nsIFrame* aFrame, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors aUseSystemColors, DPIRatio aDpiRatio) {
+    const Colors& aColors, DPIRatio aDpiRatio) {
   sRGBColor thumbColor = ComputeScrollbarThumbColor(
-      aFrame, aStyle, aElementState, aDocumentState, aUseSystemColors);
+      aFrame, aStyle, aElementState, aDocumentState, aColors);
   FillRect(aPaintData, aRect, thumbColor);
   return true;
 }
 
 bool nsNativeBasicTheme::PaintScrollbarThumb(
     DrawTarget& aDrawTarget, const LayoutDeviceRect& aRect, bool aHorizontal,
     nsIFrame* aFrame, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors aUseSystemColors, DPIRatio aDpiRatio) {
+    const Colors& aColors, DPIRatio aDpiRatio) {
   return DoPaintDefaultScrollbarThumb(aDrawTarget, aRect, aHorizontal, aFrame,
                                       aStyle, aElementState, aDocumentState,
-                                      aUseSystemColors, aDpiRatio);
+                                      aColors, aDpiRatio);
 }
 
 bool nsNativeBasicTheme::PaintScrollbarThumb(
     WebRenderBackendData& aWrData, const LayoutDeviceRect& aRect,
     bool aHorizontal, nsIFrame* aFrame, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors aUseSystemColors, DPIRatio aDpiRatio) {
+    const Colors& aColors, DPIRatio aDpiRatio) {
   return DoPaintDefaultScrollbarThumb(aWrData, aRect, aHorizontal, aFrame,
                                       aStyle, aElementState, aDocumentState,
-                                      aUseSystemColors, aDpiRatio);
+                                      aColors, aDpiRatio);
 }
 
 template <typename PaintBackendData>
 bool nsNativeBasicTheme::DoPaintDefaultScrollbar(
     PaintBackendData& aPaintData, const LayoutDeviceRect& aRect,
     bool aHorizontal, nsIFrame* aFrame, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors aUseSystemColors, DPIRatio aDpiRatio) {
+    const Colors& aColors, DPIRatio aDpiRatio) {
   if (sOverlayScrollbars && !aElementState.HasAtLeastOneOfStates(
                                 NS_EVENT_STATE_HOVER | NS_EVENT_STATE_ACTIVE)) {
     return true;
   }
-  auto scrollbarColor = ComputeScrollbarTrackColor(
-      aFrame, aStyle, aDocumentState, aUseSystemColors);
+  auto scrollbarColor =
+      ComputeScrollbarTrackColor(aFrame, aStyle, aDocumentState, aColors);
   FillRect(aPaintData, aRect, scrollbarColor);
   return true;
 }
 
 bool nsNativeBasicTheme::PaintScrollbar(
     DrawTarget& aDrawTarget, const LayoutDeviceRect& aRect, bool aHorizontal,
     nsIFrame* aFrame, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors aUseSystemColors, DPIRatio aDpiRatio) {
+    const Colors& aColors, DPIRatio aDpiRatio) {
   return DoPaintDefaultScrollbar(aDrawTarget, aRect, aHorizontal, aFrame,
-                                 aStyle, aElementState, aDocumentState,
-                                 aUseSystemColors, aDpiRatio);
+                                 aStyle, aElementState, aDocumentState, aColors,
+                                 aDpiRatio);
 }
 
 bool nsNativeBasicTheme::PaintScrollbar(
     WebRenderBackendData& aWrData, const LayoutDeviceRect& aRect,
     bool aHorizontal, nsIFrame* aFrame, const ComputedStyle& aStyle,
     const EventStates& aElementState, const EventStates& aDocumentState,
-    UseSystemColors aUseSystemColors, DPIRatio aDpiRatio) {
+    const Colors& aColors, DPIRatio aDpiRatio) {
   return DoPaintDefaultScrollbar(aWrData, aRect, aHorizontal, aFrame, aStyle,
-                                 aElementState, aDocumentState,
-                                 aUseSystemColors, aDpiRatio);
+                                 aElementState, aDocumentState, aColors,
+                                 aDpiRatio);
 }
 
 template <typename PaintBackendData>
 bool nsNativeBasicTheme::DoPaintDefaultScrollCorner(
     PaintBackendData& aPaintData, const LayoutDeviceRect& aRect,
     nsIFrame* aFrame, const ComputedStyle& aStyle,
-    const EventStates& aDocumentState, UseSystemColors aUseSystemColors,
+    const EventStates& aDocumentState, const Colors& aColors,
     DPIRatio aDpiRatio) {
-  auto scrollbarColor = ComputeScrollbarTrackColor(
-      aFrame, aStyle, aDocumentState, aUseSystemColors);
+  auto scrollbarColor =
+      ComputeScrollbarTrackColor(aFrame, aStyle, aDocumentState, aColors);
   FillRect(aPaintData, aRect, scrollbarColor);
   return true;
 }
 
 bool nsNativeBasicTheme::PaintScrollCorner(
     DrawTarget& aDrawTarget, const LayoutDeviceRect& aRect, nsIFrame* aFrame,
     const ComputedStyle& aStyle, const EventStates& aDocumentState,
-    UseSystemColors aUseSystemColors, DPIRatio aDpiRatio) {
+    const Colors& aColors, DPIRatio aDpiRatio) {
   return DoPaintDefaultScrollCorner(aDrawTarget, aRect, aFrame, aStyle,
-                                    aDocumentState, aUseSystemColors,
-                                    aDpiRatio);
+                                    aDocumentState, aColors, aDpiRatio);
 }
 
 bool nsNativeBasicTheme::PaintScrollCorner(WebRenderBackendData& aWrData,
                                            const LayoutDeviceRect& aRect,
                                            nsIFrame* aFrame,
                                            const ComputedStyle& aStyle,
                                            const EventStates& aDocumentState,
-                                           UseSystemColors aUseSystemColors,
+                                           const Colors& aColors,
                                            DPIRatio aDpiRatio) {
   return DoPaintDefaultScrollCorner(aWrData, aRect, aFrame, aStyle,
-                                    aDocumentState, aUseSystemColors,
-                                    aDpiRatio);
+                                    aDocumentState, aColors, aDpiRatio);
 }
 
 void nsNativeBasicTheme::PaintScrollbarButton(
     DrawTarget& aDrawTarget, StyleAppearance aAppearance,
     const LayoutDeviceRect& aRect, nsIFrame* aFrame,
     const ComputedStyle& aStyle, const EventStates& aElementState,
-    const EventStates& aDocumentState, UseSystemColors aUseSystemColors,
+    const EventStates& aDocumentState, const Colors& aColors,
     DPIRatio aDpiRatio) {
-  auto [buttonColor, arrowColor] =
-      ComputeScrollbarButtonColors(aFrame, aAppearance, aStyle, aElementState,
-                                   aDocumentState, aUseSystemColors);
+  auto [buttonColor, arrowColor] = ComputeScrollbarButtonColors(
+      aFrame, aAppearance, aStyle, aElementState, aDocumentState, aColors);
   aDrawTarget.FillRect(aRect.ToUnknownRect(),
                        ColorPattern(ToDeviceColor(buttonColor)));
 
   // Start with Up arrow.
   float arrowPolygonX[] = {-4.0f, 0.0f, 4.0f, 4.0f, 0.0f, -4.0f};
   float arrowPolygonY[] = {0.0f, -4.0f, 0.0f, 3.0f, -1.0f, 3.0f};
 
   const float kPolygonSize = 17;
@@ -1856,17 +1854,16 @@ bool nsNativeBasicTheme::DoDrawWidgetBac
   static_assert(std::is_same_v<PaintBackendData, DrawTarget> ||
                 std::is_same_v<PaintBackendData, WebRenderBackendData>);
 
   const nsPresContext* pc = aFrame->PresContext();
   const nscoord twipsPerPixel = pc->AppUnitsPerDevPixel();
   const auto devPxRect = ToSnappedRect(aRect, twipsPerPixel, aPaintData);
 
   const EventStates docState = pc->Document()->GetDocumentState();
-  const auto useSystemColors = ShouldUseSystemColors(*pc);
   EventStates eventState = GetContentState(aFrame, aAppearance);
   if (aAppearance == StyleAppearance::MozMenulistArrowButton) {
     bool isHTML = IsHTMLContent(aFrame);
     nsIFrame* parentFrame = aFrame->GetParent();
     bool isMenulist = !isHTML && parentFrame->IsMenuFrame();
     // HTML select and XUL menulist dropdown buttons get state from the
     // parent.
     if (isHTML || isMenulist) {
@@ -1888,145 +1885,134 @@ bool nsNativeBasicTheme::DoDrawWidgetBac
   if constexpr (std::is_same_v<PaintBackendData, DrawTarget>) {
     if (aAppearance != StyleAppearance::FocusOutline &&
         aAppearance != StyleAppearance::Range &&
         !eventState.HasState(NS_EVENT_STATE_FOCUSRING)) {
       maybeClipRect.emplace(aPaintData, devPxRect);
     }
   }
 
-  const AccentColor accent(*aFrame->Style());
-
+  const Colors colors(aFrame);
   DPIRatio dpiRatio = GetDPIRatio(aFrame, aAppearance);
 
   switch (aAppearance) {
     case StyleAppearance::Radio: {
       auto rect = CheckBoxRadioRect(devPxRect);
-      PaintRadioControl(aPaintData, rect, eventState, accent, useSystemColors,
-                        dpiRatio);
+      PaintRadioControl(aPaintData, rect, eventState, colors, dpiRatio);
       break;
     }
     case StyleAppearance::Checkbox: {
       if constexpr (std::is_same_v<PaintBackendData, WebRenderBackendData>) {
         // TODO: Need to figure out how to best draw this using WR.
         return false;
       } else {
         auto rect = CheckBoxRadioRect(devPxRect);
-        PaintCheckboxControl(aPaintData, rect, eventState, accent,
-                             useSystemColors, dpiRatio);
+        PaintCheckboxControl(aPaintData, rect, eventState, colors, dpiRatio);
       }
       break;
     }
     case StyleAppearance::Textarea:
     case StyleAppearance::Textfield:
     case StyleAppearance::NumberInput:
-      PaintTextField(aPaintData, devPxRect, eventState, accent, useSystemColors,
-                     dpiRatio);
+      PaintTextField(aPaintData, devPxRect, eventState, colors, dpiRatio);
       break;
     case StyleAppearance::Listbox:
-      PaintListbox(aPaintData, devPxRect, eventState, accent, useSystemColors,
-                   dpiRatio);
+      PaintListbox(aPaintData, devPxRect, eventState, colors, dpiRatio);
       break;
     case StyleAppearance::MenulistButton:
     case StyleAppearance::Menulist:
-      PaintMenulist(aPaintData, devPxRect, eventState, accent, useSystemColors,
-                    dpiRatio);
+      PaintMenulist(aPaintData, devPxRect, eventState, colors, dpiRatio);
       break;
     case StyleAppearance::MozMenulistArrowButton:
       if constexpr (std::is_same_v<PaintBackendData, WebRenderBackendData>) {
         // TODO: Need to figure out how to best draw this using WR.
         return false;
       } else {
-        PaintMenulistArrowButton(aFrame, aPaintData, devPxRect, eventState,
-                                 useSystemColors);
+        PaintMenulistArrowButton(aFrame, aPaintData, devPxRect, eventState);
       }
       break;
     case StyleAppearance::SpinnerUpbutton:
     case StyleAppearance::SpinnerDownbutton:
       if constexpr (std::is_same_v<PaintBackendData, WebRenderBackendData>) {
         // TODO: Need to figure out how to best draw this using WR.
         return false;
       } else {
         PaintSpinnerButton(aFrame, aPaintData, devPxRect, eventState,
-                           aAppearance, useSystemColors, dpiRatio);
+                           aAppearance, colors, dpiRatio);
       }
       break;
     case StyleAppearance::Range:
-      PaintRange(aFrame, aPaintData, devPxRect, eventState, accent,
-                 useSystemColors, dpiRatio, IsRangeHorizontal(aFrame));
+      PaintRange(aFrame, aPaintData, devPxRect, eventState, colors, dpiRatio,
+                 IsRangeHorizontal(aFrame));
       break;
     case StyleAppearance::RangeThumb:
       // Painted as part of StyleAppearance::Range.
       break;
     case StyleAppearance::ProgressBar:
-      PaintProgress(aFrame, aPaintData, devPxRect, eventState, accent,
-                    useSystemColors, dpiRatio,
+      PaintProgress(aFrame, aPaintData, devPxRect, eventState, colors, dpiRatio,
                     /* aIsMeter = */ false);
       break;
     case StyleAppearance::Progresschunk:
       /* Painted as part of the progress bar */
       break;
     case StyleAppearance::Meter:
-      PaintProgress(aFrame, aPaintData, devPxRect, eventState, accent,
-                    useSystemColors, dpiRatio, /* aIsMeter = */ true);
+      PaintProgress(aFrame, aPaintData, devPxRect, eventState, colors, dpiRatio,
+                    /* aIsMeter = */ true);
       break;
     case StyleAppearance::Meterchunk:
       /* Painted as part of the meter bar */
       break;
     case StyleAppearance::ScrollbarthumbHorizontal:
     case StyleAppearance::ScrollbarthumbVertical: {
       bool isHorizontal =
           aAppearance == StyleAppearance::ScrollbarthumbHorizontal;
       return PaintScrollbarThumb(aPaintData, devPxRect, isHorizontal, aFrame,
                                  *nsLayoutUtils::StyleForScrollbar(aFrame),
-                                 eventState, docState, useSystemColors,
-                                 dpiRatio);
+                                 eventState, docState, colors, dpiRatio);
     }
     case StyleAppearance::ScrollbartrackHorizontal:
     case StyleAppearance::ScrollbartrackVertical: {
       bool isHorizontal =
           aAppearance == StyleAppearance::ScrollbartrackHorizontal;
       return PaintScrollbarTrack(aPaintData, devPxRect, isHorizontal, aFrame,
                                  *nsLayoutUtils::StyleForScrollbar(aFrame),
-                                 docState, useSystemColors, dpiRatio);
+                                 docState, colors, dpiRatio);
     }
     case StyleAppearance::ScrollbarHorizontal:
     case StyleAppearance::ScrollbarVertical: {
       bool isHorizontal = aAppearance == StyleAppearance::ScrollbarHorizontal;
       return PaintScrollbar(aPaintData, devPxRect, isHorizontal, aFrame,
                             *nsLayoutUtils::StyleForScrollbar(aFrame),
-                            eventState, docState, useSystemColors, dpiRatio);
+                            eventState, docState, colors, dpiRatio);
     }
     case StyleAppearance::Scrollcorner:
       return PaintScrollCorner(aPaintData, devPxRect, aFrame,
                                *nsLayoutUtils::StyleForScrollbar(aFrame),
-                               docState, useSystemColors, dpiRatio);
+                               docState, colors, dpiRatio);
     case StyleAppearance::ScrollbarbuttonUp:
     case StyleAppearance::ScrollbarbuttonDown:
     case StyleAppearance::ScrollbarbuttonLeft:
     case StyleAppearance::ScrollbarbuttonRight:
       // For scrollbar-width:thin, we don't display the buttons.
       if (!IsScrollbarWidthThin(aFrame)) {
         if constexpr (std::is_same_v<PaintBackendData, WebRenderBackendData>) {
           // TODO: Need to figure out how to best draw this using WR.
           return false;
         } else {
           PaintScrollbarButton(aPaintData, aAppearance, devPxRect, aFrame,
                                *nsLayoutUtils::StyleForScrollbar(aFrame),
-                               eventState, docState, useSystemColors, dpiRatio);
+                               eventState, docState, colors, dpiRatio);
         }
       }
       break;
     case StyleAppearance::Button:
-      PaintButton(aFrame, aPaintData, devPxRect, eventState, accent,
-                  useSystemColors, dpiRatio);
+      PaintButton(aFrame, aPaintData, devPxRect, eventState, colors, dpiRatio);
       break;
     case StyleAppearance::FocusOutline:
-      PaintAutoStyleOutline(aFrame, aPaintData, devPxRect, accent,
-                            useSystemColors, dpiRatio);
+      PaintAutoStyleOutline(aFrame, aPaintData, devPxRect, colors, dpiRatio);
       break;
     default:
       // Various appearance values are used for XUL elements.  Normally these
       // will not be available in content documents (and thus in the content
       // processes where the native basic theme can be used), but tests are
       // run with the remote XUL pref enabled and so we can get in here.  So
       // we just return an error rather than assert.
       return false;
@@ -2034,21 +2020,19 @@ bool nsNativeBasicTheme::DoDrawWidgetBac
 
   return true;
 }
 
 template <typename PaintBackendData>
 void nsNativeBasicTheme::PaintAutoStyleOutline(nsIFrame* aFrame,
                                                PaintBackendData& aPaintData,
                                                const LayoutDeviceRect& aRect,
-                                               const AccentColor& aAccent,
-                                               UseSystemColors aUseSystemColors,
+                                               const Colors& aColors,
                                                DPIRatio aDpiRatio) {
-  auto [innerColor, middleColor, outerColor] =
-      ComputeFocusRectColors(aAccent, aUseSystemColors);
+  auto [innerColor, middleColor, outerColor] = ComputeFocusRectColors(aColors);
   Unused << middleColor;
   Unused << outerColor;
 
   LayoutDeviceRect rect(aRect);
   auto width =
       LayoutDeviceCoord(SnapBorderWidth(kInnerFocusOutlineWidth, aDpiRatio));
   rect.Inflate(width);
 
@@ -2272,17 +2256,17 @@ nsNativeBasicTheme::GetMinimumWidgetSize
     default:
       break;
   }
 
   return NS_OK;
 }
 
 nsITheme::Transparency nsNativeBasicTheme::GetWidgetTransparency(
-    nsIFrame* aFrame, StyleAppearance aAppearance) {
+    nsIFrame*, StyleAppearance) {
   return eUnknownTransparency;
 }
 
 NS_IMETHODIMP
 nsNativeBasicTheme::WidgetStateChanged(nsIFrame* aFrame,
                                        StyleAppearance aAppearance,
                                        nsAtom* aAttribute, bool* aShouldRepaint,
                                        const nsAttrValue* aOldValue) {
--- a/widget/nsNativeBasicTheme.h
+++ b/widget/nsNativeBasicTheme.h
@@ -100,16 +100,17 @@ class nsNativeBasicTheme : protected nsN
   using DrawTarget = mozilla::gfx::DrawTarget;
   using Path = mozilla::gfx::Path;
   using Rect = mozilla::gfx::Rect;
   using Point = mozilla::gfx::Point;
   using RectCornerRadii = mozilla::gfx::RectCornerRadii;
   using LayoutDeviceCoord = mozilla::LayoutDeviceCoord;
   using LayoutDeviceRect = mozilla::LayoutDeviceRect;
   class AccentColor;
+  class Colors;
 
  public:
   static void Init();
   static void Shutdown();
   static void LookAndFeelChanged();
 
   using DPIRatio = mozilla::CSSToLayoutDeviceScale;
 
@@ -188,65 +189,59 @@ class nsNativeBasicTheme : protected nsN
   static bool IsColorPickerButton(nsIFrame*);
 
   // Whether we should use system colors (for high contrast mode).
   enum class UseSystemColors : bool { No, Yes };
   static UseSystemColors ShouldUseSystemColors(const nsPresContext&);
 
   std::pair<sRGBColor, sRGBColor> ComputeCheckboxColors(const EventStates&,
                                                         StyleAppearance,
-                                                        const AccentColor&,
-                                                        UseSystemColors);
-  sRGBColor ComputeCheckmarkColor(const EventStates&, const AccentColor&,
-                                  UseSystemColors);
-  sRGBColor ComputeBorderColor(const EventStates&, UseSystemColors);
+                                                        const Colors&);
+  sRGBColor ComputeCheckmarkColor(const EventStates&, const Colors&);
+  sRGBColor ComputeBorderColor(const EventStates&, const Colors&);
 
   std::pair<sRGBColor, sRGBColor> ComputeButtonColors(const EventStates&,
-                                                      UseSystemColors,
+                                                      const Colors&,
                                                       nsIFrame* = nullptr);
   std::pair<sRGBColor, sRGBColor> ComputeTextfieldColors(const EventStates&,
-                                                         UseSystemColors);
+                                                         const Colors&);
   std::pair<sRGBColor, sRGBColor> ComputeRangeProgressColors(const EventStates&,
-                                                             const AccentColor&,
-                                                             UseSystemColors);
+                                                             const Colors&);
   std::pair<sRGBColor, sRGBColor> ComputeRangeTrackColors(const EventStates&,
-                                                          UseSystemColors);
+                                                          const Colors&);
   std::pair<sRGBColor, sRGBColor> ComputeRangeThumbColors(const EventStates&,
-                                                          const AccentColor&,
-                                                          UseSystemColors);
-  std::pair<sRGBColor, sRGBColor> ComputeProgressColors(const AccentColor&,
-                                                        UseSystemColors);
-  std::pair<sRGBColor, sRGBColor> ComputeProgressTrackColors(UseSystemColors);
+                                                          const Colors&);
+  std::pair<sRGBColor, sRGBColor> ComputeProgressColors(const Colors&);
+  std::pair<sRGBColor, sRGBColor> ComputeProgressTrackColors(const Colors&);
   std::pair<sRGBColor, sRGBColor> ComputeMeterchunkColors(
-      const EventStates& aMeterState, UseSystemColors);
-  std::array<sRGBColor, 3> ComputeFocusRectColors(const AccentColor&,
-                                                  UseSystemColors);
+      const EventStates& aMeterState, const Colors&);
+  std::array<sRGBColor, 3> ComputeFocusRectColors(const Colors&);
 
   static bool ShouldUseDarkScrollbar(nsIFrame*, const ComputedStyle&);
+  bool IsScrollbarTrackOpaque(nsIFrame*);
   sRGBColor ComputeScrollbarTrackColor(nsIFrame*, const ComputedStyle&,
                                        const EventStates& aDocumentState,
-                                       UseSystemColors);
+                                       const Colors&);
   sRGBColor ComputeScrollbarThumbColor(nsIFrame*, const ComputedStyle&,
                                        const EventStates& aElementState,
                                        const EventStates& aDocumentState,
-                                       UseSystemColors);
+                                       const Colors&);
   // Returned colors are button, arrow.
   std::pair<sRGBColor, sRGBColor> ComputeScrollbarButtonColors(
       nsIFrame*, StyleAppearance, const ComputedStyle&,
       const EventStates& aElementState, const EventStates& aDocumentState,
-      UseSystemColors);
+      const Colors&);
 
   template <typename PaintBackendData>
   void PaintRoundedFocusRect(PaintBackendData&, const LayoutDeviceRect&,
-                             const AccentColor&, UseSystemColors, DPIRatio,
-                             CSSCoord aRadius, CSSCoord aOffset);
+                             const Colors&, DPIRatio, CSSCoord aRadius,
+                             CSSCoord aOffset);
   template <typename PaintBackendData>
   void PaintAutoStyleOutline(nsIFrame*, PaintBackendData&,
-                             const LayoutDeviceRect&, const AccentColor&,
-                             UseSystemColors, DPIRatio);
+                             const LayoutDeviceRect&, const Colors&, DPIRatio);
 
   static void PaintRoundedRectWithRadius(DrawTarget&,
                                          const LayoutDeviceRect& aRect,
                                          const LayoutDeviceRect& aClipRect,
                                          const sRGBColor& aBackgroundColor,
                                          const sRGBColor& aBorderColor,
                                          CSSCoord aBorderWidth,
                                          CSSCoord aRadius, DPIRatio);
@@ -268,23 +263,21 @@ class nsNativeBasicTheme : protected nsN
                                aBorderColor, aBorderWidth, aRadius, aDpiRatio);
   }
 
   static void FillRect(DrawTarget&, const LayoutDeviceRect&, const sRGBColor&);
   static void FillRect(WebRenderBackendData&, const LayoutDeviceRect&,
                        const sRGBColor&);
 
   void PaintCheckboxControl(DrawTarget& aDrawTarget, const LayoutDeviceRect&,
-                            const EventStates&, const AccentColor&,
-                            UseSystemColors, DPIRatio);
+                            const EventStates&, const Colors&, DPIRatio);
   void PaintCheckMark(DrawTarget&, const LayoutDeviceRect&, const EventStates&,
-                      const AccentColor&, UseSystemColors);
+                      const Colors&);
   void PaintIndeterminateMark(DrawTarget&, const LayoutDeviceRect&,
-                              const EventStates&, const AccentColor&,
-                              UseSystemColors);
+                              const EventStates&, const Colors&);
 
   template <typename PaintBackendData>
   void PaintStrokedCircle(PaintBackendData&, const LayoutDeviceRect&,
                           const sRGBColor& aBackgroundColor,
                           const sRGBColor& aBorderColor,
                           const CSSCoord aBorderWidth, DPIRatio);
   void PaintCircleShadow(DrawTarget&, const LayoutDeviceRect& aBoxRect,
                          const LayoutDeviceRect& aClipRect, float aShadowAlpha,
@@ -292,130 +285,125 @@ class nsNativeBasicTheme : protected nsN
                          CSSCoord aShadowBlurStdDev, DPIRatio);
   void PaintCircleShadow(WebRenderBackendData&,
                          const LayoutDeviceRect& aBoxRect,
                          const LayoutDeviceRect& aClipRect, float aShadowAlpha,
                          const CSSPoint& aShadowOffset,
                          CSSCoord aShadowBlurStdDev, DPIRatio);
   template <typename PaintBackendData>
   void PaintRadioControl(PaintBackendData&, const LayoutDeviceRect&,
-                         const EventStates&, const AccentColor&,
-                         UseSystemColors, DPIRatio);
+                         const EventStates&, const Colors&, DPIRatio);
   template <typename PaintBackendData>
   void PaintRadioCheckmark(PaintBackendData&, const LayoutDeviceRect&,
                            const EventStates&, DPIRatio);
   template <typename PaintBackendData>
   void PaintTextField(PaintBackendData&, const LayoutDeviceRect&,
-                      const EventStates&, const AccentColor& aAccent,
-                      UseSystemColors, DPIRatio);
+                      const EventStates&, const Colors&, DPIRatio);
   template <typename PaintBackendData>
   void PaintListbox(PaintBackendData&, const LayoutDeviceRect&,
-                    const EventStates&, const AccentColor&, UseSystemColors,
-                    DPIRatio);
+                    const EventStates&, const Colors&, DPIRatio);
   template <typename PaintBackendData>
   void PaintMenulist(PaintBackendData&, const LayoutDeviceRect&,
-                     const EventStates&, const AccentColor&, UseSystemColors,
-                     DPIRatio);
+                     const EventStates&, const Colors&, DPIRatio);
   void PaintArrow(DrawTarget&, const LayoutDeviceRect&,
                   const float aArrowPolygonX[], const float aArrowPolygonY[],
                   const float aArrowPolygonSize, const int32_t aArrowNumPoints,
                   const sRGBColor aFillColor);
   void PaintMenulistArrowButton(nsIFrame*, DrawTarget&, const LayoutDeviceRect&,
-                                const EventStates&, UseSystemColors);
+                                const EventStates&);
   void PaintSpinnerButton(nsIFrame*, DrawTarget&, const LayoutDeviceRect&,
-                          const EventStates&, StyleAppearance, UseSystemColors,
+                          const EventStates&, StyleAppearance, const Colors&,
                           DPIRatio);
   template <typename PaintBackendData>
   void PaintRange(nsIFrame*, PaintBackendData&, const LayoutDeviceRect&,
-                  const EventStates&, const AccentColor&, UseSystemColors,
-                  DPIRatio, bool aHorizontal);
+                  const EventStates&, const Colors&, DPIRatio,
+                  bool aHorizontal);
   template <typename PaintBackendData>
   void PaintProgress(nsIFrame*, PaintBackendData&, const LayoutDeviceRect&,
-                     const EventStates&, const AccentColor&, UseSystemColors,
-                     DPIRatio, bool aIsMeter);
+                     const EventStates&, const Colors&, DPIRatio,
+                     bool aIsMeter);
   template <typename PaintBackendData>
   void PaintButton(nsIFrame*, PaintBackendData&, const LayoutDeviceRect&,
-                   const EventStates&, const AccentColor&, UseSystemColors,
-                   DPIRatio);
+                   const EventStates&, const Colors&, DPIRatio);
 
   void PaintScrollbarButton(DrawTarget&, StyleAppearance,
                             const LayoutDeviceRect&, nsIFrame*,
                             const ComputedStyle&,
                             const EventStates& aElementState,
-                            const EventStates& aDocumentState, UseSystemColors,
+                            const EventStates& aDocumentState, const Colors&,
                             DPIRatio);
 
   virtual bool PaintScrollbarThumb(DrawTarget&, const LayoutDeviceRect&,
                                    bool aHorizontal, nsIFrame*,
                                    const ComputedStyle&,
                                    const EventStates& aElementState,
                                    const EventStates& aDocumentState,
-                                   UseSystemColors, DPIRatio);
+                                   const Colors&, DPIRatio);
   virtual bool PaintScrollbarThumb(WebRenderBackendData&,
                                    const LayoutDeviceRect&, bool aHorizontal,
                                    nsIFrame*, const ComputedStyle&,
                                    const EventStates& aElementState,
                                    const EventStates& aDocumentState,
-                                   UseSystemColors, DPIRatio);
+                                   const Colors&, DPIRatio);
   template <typename PaintBackendData>
   bool DoPaintDefaultScrollbarThumb(PaintBackendData&, const LayoutDeviceRect&,
                                     bool aHorizontal, nsIFrame*,
                                     const ComputedStyle&,
                                     const EventStates& aElementState,
                                     const EventStates& aDocumentState,
-                                    UseSystemColors aUseSystemColors, DPIRatio);
+                                    const Colors&, DPIRatio);
 
   virtual bool PaintScrollbar(DrawTarget&, const LayoutDeviceRect&,
                               bool aHorizontal, nsIFrame*, const ComputedStyle&,
                               const EventStates& aElementState,
-                              const EventStates& aDocumentState,
-                              UseSystemColors, DPIRatio);
+                              const EventStates& aDocumentState, const Colors&,
+                              DPIRatio);
   virtual bool PaintScrollbar(WebRenderBackendData&, const LayoutDeviceRect&,
                               bool aHorizontal, nsIFrame*, const ComputedStyle&,
                               const EventStates& aElementState,
-                              const EventStates& aDocumentState,
-                              UseSystemColors, DPIRatio);
+                              const EventStates& aDocumentState, const Colors&,
+                              DPIRatio);
   template <typename PaintBackendData>
   bool DoPaintDefaultScrollbar(PaintBackendData&, const LayoutDeviceRect&,
                                bool aHorizontal, nsIFrame*,
                                const ComputedStyle&,
                                const EventStates& aElementState,
-                               const EventStates& aDocumentState,
-                               UseSystemColors aUseSystemColors, DPIRatio);
+                               const EventStates& aDocumentState, const Colors&,
+                               DPIRatio);
 
   virtual bool PaintScrollbarTrack(DrawTarget&, const LayoutDeviceRect&,
                                    bool aHorizontal, nsIFrame*,
                                    const ComputedStyle&,
                                    const EventStates& aDocumentState,
-                                   UseSystemColors, DPIRatio) {
+                                   const Colors&, DPIRatio) {
     // Draw nothing by default. Subclasses can override this.
     return true;
   }
   virtual bool PaintScrollbarTrack(WebRenderBackendData&,
                                    const LayoutDeviceRect&, bool aHorizontal,
                                    nsIFrame*, const ComputedStyle&,
                                    const EventStates& aDocumentState,
-                                   UseSystemColors, DPIRatio) {
+                                   const Colors&, DPIRatio) {
     // Draw nothing by default. Subclasses can override this.
     return true;
   }
 
   virtual bool PaintScrollCorner(DrawTarget&, const LayoutDeviceRect&,
                                  nsIFrame*, const ComputedStyle&,
                                  const EventStates& aDocumentState,
-                                 UseSystemColors, DPIRatio);
+                                 const Colors&, DPIRatio);
   virtual bool PaintScrollCorner(WebRenderBackendData&, const LayoutDeviceRect&,
                                  nsIFrame*, const ComputedStyle&,
                                  const EventStates& aDocumentState,
-                                 UseSystemColors, DPIRatio);
+                                 const Colors&, DPIRatio);
   template <typename PaintBackendData>
   bool DoPaintDefaultScrollCorner(PaintBackendData&, const LayoutDeviceRect&,
                                   nsIFrame*, const ComputedStyle&,
                                   const EventStates& aDocumentState,
-                                  UseSystemColors, DPIRatio);
+                                  const Colors&, DPIRatio);
 
   static CSSIntCoord sHorizontalScrollbarHeight;
   static CSSIntCoord sVerticalScrollbarWidth;
   static bool sOverlayScrollbars;
 
   static void PrefChangedCallback(const char*, void*) { LookAndFeelChanged(); }
   static void RecomputeAccentColors();
   static void RecomputeScrollbarParams();
--- a/widget/windows/nsNativeBasicThemeWin.h
+++ b/widget/windows/nsNativeBasicThemeWin.h
@@ -8,16 +8,15 @@
 #define nsNativeBasicThemeWin_h
 
 #include "nsNativeBasicTheme.h"
 
 class nsNativeBasicThemeWin : public nsNativeBasicTheme {
  public:
   nsNativeBasicThemeWin() = default;
 
-  Transparency GetWidgetTransparency(nsIFrame* aFrame,
-                                     StyleAppearance aAppearance) override;
+  Transparency GetWidgetTransparency(nsIFrame*, StyleAppearance) override;
 
  protected:
   virtual ~nsNativeBasicThemeWin() = default;
 };
 
 #endif