forked from ImSwordQueen/firefox-native-controls
-
Notifications
You must be signed in to change notification settings - Fork 1
/
native-controls-esr-115.6.0-r2.diff
1391 lines (1333 loc) · 55.3 KB
/
native-controls-esr-115.6.0-r2.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# HG changeset patch
# User daylin <[email protected]>
# Date 1706142439 25200
# Wed Jan 24 17:27:19 2024 -0700
# Node ID bdeeeb89ae88ade9acd44f59a785e5d374905528
# Parent aa9f02961b2bbb92e17fea5d6b8fd14c097baf72
Native controls for ESR 115.6.0 (R2 squashed)
***
Native controls for ESR 115.6.0 (rev 2)
diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -33,6 +33,10 @@
# include "mozilla/WindowsVersion.h"
#endif
+// -- native controls patch includes --
+#include "mozilla/StaticPrefs_widget.h"
+// -- end native controls patch includes --
+
using namespace mozilla;
using mozilla::dom::DisplayMode;
using mozilla::dom::Document;
@@ -251,10 +255,14 @@ bool Gecko_MediaFeatures_MatchesPlatform
case StylePlatform::WindowsWin10:
case StylePlatform::WindowsWin7:
case StylePlatform::WindowsWin8: {
- if (IsWin10OrLater()) {
+ int overridePref =
+ StaticPrefs::widget_ev_native_controls_patch_override_win_version();
+ bool doesOverride = overridePref > 0;
+
+ if ((!doesOverride && IsWin10OrLater()) || overridePref == 10) {
return aPlatform == StylePlatform::WindowsWin10;
}
- if (IsWin8OrLater()) {
+ if ((!doesOverride && IsWin8OrLater()) || overridePref == 8) {
return aPlatform == StylePlatform::WindowsWin8;
}
return aPlatform == StylePlatform::WindowsWin7;
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -15278,13 +15278,39 @@
# Prefs starting with "widget."
#---------------------------------------------------------------------------
+- name: widget.ev-native-controls-patch.override-win-version
+ type: int32_t
+ value: 0
+ mirror: always
+
+- name: widget.ev-native-controls-patch.force-dwm-report-off
+ type: bool
+ value: false
+ mirror: always
+
+- name: widget.ev-native-controls-patch.force-glass-reporting
+ type: int32_t
+ value: 0
+ mirror: always
+
+- name: widget.ev-native-controls-patch.override-aero-caption-buttons-mask-width
+ type: int32_t
+ value: 0
+ mirror: always
+
+- name: widget.ev-native-controls-patch.override-aero-caption-buttons-mask-height
+ type: int32_t
+ value: 0
+ mirror: always
+
# Global user preference for disabling native theme in content processes.
#
# NOTE(emilio): When changing this make sure to update the non_native_theme
# entry in python/mozbuild/mozbuild/mozinfo.py and test_fission_autostart.py
+# ^^^ no ~ev
- name: widget.non-native-theme.enabled
type: RelaxedAtomicBool
- value: true
+ value: false
mirror: always
# Whether the non-native theme should always use system colors. Useful mostly
diff --git a/servo/components/style/gecko/media_features.rs b/servo/components/style/gecko/media_features.rs
--- a/servo/components/style/gecko/media_features.rs
+++ b/servo/components/style/gecko/media_features.rs
@@ -614,6 +614,10 @@ fn eval_scripting(context: &Context, que
}
}
+fn eval_moz_ev_native_controls_patch(context: &Context) -> bool {
+ true
+}
+
fn eval_moz_windows_non_native_menus(context: &Context) -> bool {
unsafe { bindings::Gecko_MediaFeatures_WindowsNonNativeMenus(context.device().document()) }
}
@@ -694,7 +698,7 @@ macro_rules! bool_pref_feature {
/// to support new types in these entries and (2) ensuring that either
/// nsPresContext::MediaFeatureValuesChanged is called when the value that
/// would be returned by the evaluator function could change.
-pub static MEDIA_FEATURES: [QueryFeatureDescription; 67] = [
+pub static MEDIA_FEATURES: [QueryFeatureDescription; 68] = [
feature!(
atom!("width"),
AllowsRanges::Yes,
@@ -970,6 +974,13 @@ pub static MEDIA_FEATURES: [QueryFeature
Evaluator::BoolInteger(eval_moz_overlay_scrollbars),
FeatureFlags::CHROME_AND_UA_ONLY,
),
+ // Custom feature for native controls patch for userstyles to detect it:
+ feature!(
+ atom!("-moz-ev-native-controls-patch"),
+ AllowsRanges::No,
+ Evaluator::BoolInteger(eval_moz_ev_native_controls_patch),
+ FeatureFlags::CHROME_AND_UA_ONLY,
+ ),
lnf_int_feature!(
atom!("-moz-scrollbar-start-backward"),
ScrollArrowStyle,
diff --git a/servo/components/style/values/specified/box.rs b/servo/components/style/values/specified/box.rs
--- a/servo/components/style/values/specified/box.rs
+++ b/servo/components/style/values/specified/box.rs
@@ -1516,6 +1516,13 @@ pub enum Appearance {
Range,
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
RangeThumb,
+ /// The resizer background area in a status bar for the resizer widget in
+ /// the corner of a window.
+ #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
+ Resizerpanel,
+ /// The resizer itself.
+ #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
+ Resizer,
/// The scrollbar slider
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
ScrollbarHorizontal,
@@ -1566,6 +1573,9 @@ pub enum Appearance {
/// A status bar in a main application window.
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
Statusbar,
+ /// A single pane of a status bar.
+ #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
+ Statusbarpanel,
/// A single tab in a tab widget.
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
Tab,
diff --git a/widget/ScrollbarDrawingWin.cpp b/widget/ScrollbarDrawingWin.cpp
--- a/widget/ScrollbarDrawingWin.cpp
+++ b/widget/ScrollbarDrawingWin.cpp
@@ -109,6 +109,7 @@ Maybe<nsITheme::Transparency> ScrollbarD
case StyleAppearance::ScrollbarHorizontal:
case StyleAppearance::ScrollbarVertical:
case StyleAppearance::Scrollcorner:
+ case StyleAppearance::Statusbar:
// Knowing that scrollbars and statusbars are opaque improves
// performance, because we create layers for them. This better be
// true across all Windows themes! If it's not true, we should
diff --git a/widget/nsNativeTheme.cpp b/widget/nsNativeTheme.cpp
--- a/widget/nsNativeTheme.cpp
+++ b/widget/nsNativeTheme.cpp
@@ -209,6 +209,31 @@ bool nsNativeTheme::IsWidgetStyled(nsPre
return false;
}
+ // Resizers have some special handling, dependent on whether in a scrollable
+ // container or not. If so, use the scrollable container's to determine
+ // whether the style is overriden instead of the resizer. This allows a
+ // non-native transparent resizer to be used instead. Otherwise, we just
+ // fall through and return false.
+ if (aAppearance == StyleAppearance::Resizer) {
+ nsIFrame* parentFrame = aFrame->GetParent();
+ if (parentFrame && parentFrame->IsScrollFrame()) {
+ // if the parent is a scrollframe, the resizer should be native themed
+ // only if the scrollable area doesn't override the widget style.
+ //
+ // note that the condition below looks a bit suspect but it's the right
+ // one. If there's no valid appearance, then we should return true, it's
+ // effectively the same as if it had overridden the appearance.
+ parentFrame = parentFrame->GetParent();
+ if (!parentFrame) {
+ return false;
+ }
+ auto parentAppearance =
+ parentFrame->StyleDisplay()->EffectiveAppearance();
+ return parentAppearance == StyleAppearance::None ||
+ IsWidgetStyled(aPresContext, parentFrame, parentAppearance);
+ }
+ }
+
/**
* Progress bar appearance should be the same for the bar and the container
* frame. nsProgressFrame owns the logic and will tell us what we should do.
diff --git a/widget/windows/nsLookAndFeel.cpp b/widget/windows/nsLookAndFeel.cpp
--- a/widget/windows/nsLookAndFeel.cpp
+++ b/widget/windows/nsLookAndFeel.cpp
@@ -19,6 +19,10 @@
#include "gfxFontConstants.h"
#include "gfxWindowsPlatform.h"
+// -- native controls patch includes --
+#include "mozilla/StaticPrefs_widget.h"
+// -- end native controls patch includes --
+
using namespace mozilla;
using namespace mozilla::widget;
@@ -519,6 +523,11 @@ nsresult nsLookAndFeel::NativeGetInt(Int
aResult = nsUXThemeData::IsDefaultWindowTheme();
break;
case IntID::DWMCompositor:
+ if (StaticPrefs::widget_ev_native_controls_patch_force_dwm_report_off()) {
+ aResult = 0;
+ break;
+ }
+
aResult = gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled();
break;
case IntID::WindowsAccentColorInTitlebar: {
@@ -552,11 +561,24 @@ nsresult nsLookAndFeel::NativeGetInt(Int
mDwmKey->Close();
} break;
- case IntID::WindowsGlass:
+ case IntID::WindowsGlass: {
+ int reportingPref =
+ StaticPrefs::widget_ev_native_controls_patch_force_glass_reporting();
+ if (reportingPref != 0) {
+ aResult = (reportingPref == 1) ? 1 : 0;
+ break;
+ }
+
+ int overrideWinVer =
+ StaticPrefs::widget_ev_native_controls_patch_override_win_version();
+ bool isWin8OrLater =
+ (overrideWinVer == 0 && IsWin8OrLater()) || overrideWinVer >= 8;
+
// Aero Glass is only available prior to Windows 8 when DWM is used.
aResult = (gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled() &&
- !IsWin8OrLater());
+ isWin8OrLater);
break;
+ }
case IntID::AlertNotificationOrigin:
aResult = 0;
{
diff --git a/widget/windows/nsNativeThemeWin.cpp b/widget/windows/nsNativeThemeWin.cpp
--- a/widget/windows/nsNativeThemeWin.cpp
+++ b/widget/windows/nsNativeThemeWin.cpp
@@ -40,6 +40,7 @@
#include "nsWindow.h"
#include "prinrval.h"
#include "WinUtils.h"
+#include "ScrollbarDrawingWin.h"
using namespace mozilla;
using namespace mozilla::gfx;
@@ -68,8 +69,11 @@ nsNativeThemeWin::~nsNativeThemeWin() {
auto nsNativeThemeWin::IsWidgetNonNative(nsIFrame* aFrame,
StyleAppearance aAppearance)
-> NonNative {
- if (IsWidgetScrollbarPart(aAppearance) ||
- aAppearance == StyleAppearance::FocusOutline) {
+ if (IsWidgetScrollbarPart(aAppearance)) {
+ return NonNative::No;
+ }
+
+ if (aAppearance == StyleAppearance::FocusOutline) {
return NonNative::Always;
}
@@ -699,6 +703,8 @@ mozilla::Maybe<nsUXThemeClass> nsNativeT
case StyleAppearance::Textfield:
case StyleAppearance::Textarea:
return Some(eUXEdit);
+ case StyleAppearance::Tooltip:
+ return Some(eUXTooltip);
case StyleAppearance::Toolbox:
return Some(eUXRebar);
case StyleAppearance::MozWinMediaToolbox:
@@ -718,12 +724,27 @@ mozilla::Maybe<nsUXThemeClass> nsNativeT
case StyleAppearance::Tabpanel:
case StyleAppearance::Tabpanels:
return Some(eUXTab);
+ case StyleAppearance::ScrollbarVertical:
+ case StyleAppearance::ScrollbarHorizontal:
+ case StyleAppearance::ScrollbarbuttonUp:
+ case StyleAppearance::ScrollbarbuttonDown:
+ case StyleAppearance::ScrollbarbuttonLeft:
+ case StyleAppearance::ScrollbarbuttonRight:
+ case StyleAppearance::ScrollbarthumbVertical:
+ case StyleAppearance::ScrollbarthumbHorizontal:
+ case StyleAppearance::Scrollcorner:
+ return Some(eUXScrollbar);
case StyleAppearance::Range:
case StyleAppearance::RangeThumb:
return Some(eUXTrackbar);
case StyleAppearance::SpinnerUpbutton:
case StyleAppearance::SpinnerDownbutton:
return Some(eUXSpin);
+ case StyleAppearance::Statusbar:
+ case StyleAppearance::Statusbarpanel:
+ case StyleAppearance::Resizerpanel:
+ case StyleAppearance::Resizer:
+ return Some(eUXStatus);
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::MozMenulistArrowButton:
@@ -912,6 +933,11 @@ nsresult nsNativeThemeWin::GetThemePartA
return NS_OK;
}
+ case StyleAppearance::Tooltip: {
+ aPart = TTP_STANDARD;
+ aState = TS_NORMAL;
+ return NS_OK;
+ }
case StyleAppearance::ProgressBar: {
bool vertical = IsVerticalProgress(aFrame);
aPart = vertical ? PP_BARVERT : PP_BAR;
@@ -967,6 +993,66 @@ nsresult nsNativeThemeWin::GetThemePartA
aState = TS_NORMAL;
return NS_OK;
}
+ case StyleAppearance::ScrollbarbuttonUp:
+ case StyleAppearance::ScrollbarbuttonDown:
+ case StyleAppearance::ScrollbarbuttonLeft:
+ case StyleAppearance::ScrollbarbuttonRight: {
+ aPart = SP_BUTTON;
+ aState = (int(aAppearance) - int(StyleAppearance::ScrollbarbuttonUp)) * 4;
+ ElementState eventState = GetContentState(aFrame, aAppearance);
+ if (!aFrame)
+ aState += TS_NORMAL;
+ else if (eventState.HasState(ElementState::DISABLED))
+ aState += TS_DISABLED;
+ else {
+ nsIFrame* parent = aFrame->GetParent();
+ ElementState parentState = GetContentState(
+ parent, parent->StyleDisplay()->EffectiveAppearance());
+ if (eventState.HasAllStates(ElementState::HOVER | ElementState::ACTIVE))
+ aState += TS_ACTIVE;
+ else if (eventState.HasState(ElementState::HOVER))
+ aState += TS_HOVER;
+ else if (parentState.HasState(ElementState::HOVER))
+ aState =
+ (int(aAppearance) - int(StyleAppearance::ScrollbarbuttonUp)) +
+ SP_BUTTON_IMPLICIT_HOVER_BASE;
+ else
+ aState += TS_NORMAL;
+ }
+ return NS_OK;
+ }
+ case StyleAppearance::ScrollbarHorizontal:
+ case StyleAppearance::ScrollbarVertical: {
+ aPart = (aAppearance == StyleAppearance::ScrollbarHorizontal)
+ ? SP_TRACKSTARTHOR
+ : SP_TRACKSTARTVERT;
+ aState = TS_NORMAL;
+ return NS_OK;
+ }
+ case StyleAppearance::ScrollbarthumbHorizontal:
+ case StyleAppearance::ScrollbarthumbVertical: {
+ aPart = (aAppearance == StyleAppearance::ScrollbarthumbHorizontal)
+ ? SP_THUMBHOR
+ : SP_THUMBVERT;
+ ElementState eventState = GetContentState(aFrame, aAppearance);
+ if (!aFrame)
+ aState = TS_NORMAL;
+ else if (eventState.HasState(ElementState::DISABLED))
+ aState = TS_DISABLED;
+ else {
+ if (eventState.HasState(
+ ElementState::ACTIVE)) // Hover is not also a requirement for
+ // the thumb, since the drag is not
+ // canceled when you move outside the
+ // thumb.
+ aState = TS_ACTIVE;
+ else if (eventState.HasState(ElementState::HOVER))
+ aState = TS_HOVER;
+ else
+ aState = TS_NORMAL;
+ }
+ return NS_OK;
+ }
case StyleAppearance::Range: {
if (IsRangeHorizontal(aFrame)) {
aPart = TKP_TRACK;
@@ -1004,6 +1090,11 @@ nsresult nsNativeThemeWin::GetThemePartA
}
return NS_OK;
}
+ case StyleAppearance::Scrollcorner: {
+ aState = 0;
+ aPart = RP_BACKGROUND;
+ return NS_OK;
+ }
case StyleAppearance::SpinnerUpbutton:
case StyleAppearance::SpinnerDownbutton: {
aPart = (aAppearance == StyleAppearance::SpinnerUpbutton) ? SPNP_UP
@@ -1021,7 +1112,8 @@ nsresult nsNativeThemeWin::GetThemePartA
case StyleAppearance::Toolbox:
case StyleAppearance::MozWinMediaToolbox:
case StyleAppearance::MozWinCommunicationsToolbox:
- case StyleAppearance::MozWinBrowsertabbarToolbox: {
+ case StyleAppearance::MozWinBrowsertabbarToolbox:
+ case StyleAppearance::Statusbar: {
aState = 0;
aPart = RP_BACKGROUND;
return NS_OK;
@@ -1042,6 +1134,26 @@ nsresult nsNativeThemeWin::GetThemePartA
}
return NS_OK;
}
+ case StyleAppearance::Statusbarpanel:
+ case StyleAppearance::Resizerpanel:
+ case StyleAppearance::Resizer: {
+ switch (aAppearance) {
+ case StyleAppearance::Statusbarpanel:
+ aPart = 1;
+ break;
+ case StyleAppearance::Resizerpanel:
+ aPart = 2;
+ break;
+ case StyleAppearance::Resizer:
+ aPart = 3;
+ break;
+ default:
+ MOZ_ASSERT_UNREACHABLE("Oops, we're missing a case");
+ aPart = 1; // just something valid
+ }
+ aState = TS_NORMAL;
+ return NS_OK;
+ }
case StyleAppearance::Treeview:
case StyleAppearance::Listbox: {
aPart = TREEVIEW_BODY;
@@ -1355,6 +1467,11 @@ nsNativeThemeWin::DrawWidgetBackground(g
const nsRect& aRect,
const nsRect& aDirtyRect,
DrawOverflow aDrawOverflow) {
+ bool dwmCompositionEnabled =
+ StaticPrefs::widget_ev_native_controls_patch_force_dwm_report_off()
+ ? false
+ : gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled();
+
if (IsWidgetNonNative(aFrame, aAppearance) != NonNative::No) {
return Theme::DrawWidgetBackground(aContext, aFrame, aAppearance, aRect,
aDirtyRect, aDrawOverflow);
@@ -1366,7 +1483,7 @@ nsNativeThemeWin::DrawWidgetBackground(g
aDirtyRect);
// ^^ without the right sdk, assume xp theming and fall through.
- if (gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled()) {
+ if (dwmCompositionEnabled) {
switch (aAppearance) {
case StyleAppearance::MozWindowTitlebar:
case StyleAppearance::MozWindowTitlebarMaximized:
@@ -1631,7 +1748,8 @@ RENDER_AGAIN:
IsFrameRTL(aFrame));
}
// The following widgets need to be RTL-aware
- else if (aAppearance == StyleAppearance::MozMenulistArrowButton) {
+ else if (aAppearance == StyleAppearance::Resizer ||
+ aAppearance == StyleAppearance::MozMenulistArrowButton) {
DrawThemeBGRTLAware(theme, hdc, part, state, &widgetRect, &clipRect,
IsFrameRTL(aFrame));
} else if (aAppearance == StyleAppearance::NumberInput ||
@@ -1696,6 +1814,26 @@ RENDER_AGAIN:
widgetRect.bottom = widgetRect.top + TB_SEPARATOR_HEIGHT;
DrawThemeEdge(theme, hdc, RP_BAND, 0, &widgetRect, EDGE_ETCHED, BF_TOP,
nullptr);
+ } else if (aAppearance == StyleAppearance::ScrollbarthumbHorizontal ||
+ aAppearance == StyleAppearance::ScrollbarthumbVertical) {
+ // Draw the decorative gripper for the scrollbar thumb button, if it fits
+
+ SIZE gripSize;
+ MARGINS thumbMgns;
+ int gripPart = (aAppearance == StyleAppearance::ScrollbarthumbHorizontal)
+ ? SP_GRIPPERHOR
+ : SP_GRIPPERVERT;
+
+ if (GetThemePartSize(theme, hdc, gripPart, state, nullptr, TS_TRUE,
+ &gripSize) == S_OK &&
+ GetThemeMargins(theme, hdc, part, state, TMT_CONTENTMARGINS, nullptr,
+ &thumbMgns) == S_OK &&
+ gripSize.cx + thumbMgns.cxLeftWidth + thumbMgns.cxRightWidth <=
+ widgetRect.right - widgetRect.left &&
+ gripSize.cy + thumbMgns.cyTopHeight + thumbMgns.cyBottomHeight <=
+ widgetRect.bottom - widgetRect.top) {
+ DrawThemeBackground(theme, hdc, gripPart, state, &widgetRect, &clipRect);
+ }
}
nativeDrawing.EndNativeDrawing();
@@ -1745,7 +1883,11 @@ LayoutDeviceIntMargin nsNativeThemeWin::
if (!themeClass.isNothing()) {
theme = nsUXThemeData::GetTheme(themeClass.value());
}
- if (!theme) {
+
+ // Classic scrollbar thumbs require classic borders. The theme procedure will
+ // break horizontal scrollbar thumbs otherwise.
+ if (aAppearance == StyleAppearance::ScrollbarthumbVertical ||
+ aAppearance == StyleAppearance::ScrollbarthumbHorizontal || !theme) {
result = ClassicGetWidgetBorder(aContext, aFrame, aAppearance);
ScaleForFrameDPI(&result, aFrame);
return result;
@@ -1756,7 +1898,12 @@ LayoutDeviceIntMargin nsNativeThemeWin::
aAppearance == StyleAppearance::MozWinMediaToolbox ||
aAppearance == StyleAppearance::MozWinCommunicationsToolbox ||
aAppearance == StyleAppearance::MozWinBrowsertabbarToolbox ||
+ aAppearance == StyleAppearance::Statusbar ||
+ aAppearance == StyleAppearance::Resizer ||
aAppearance == StyleAppearance::Tabpanel ||
+ aAppearance == StyleAppearance::ScrollbarHorizontal ||
+ aAppearance == StyleAppearance::ScrollbarVertical ||
+ aAppearance == StyleAppearance::Scrollcorner ||
aAppearance == StyleAppearance::Menuitem ||
aAppearance == StyleAppearance::Checkmenuitem ||
aAppearance == StyleAppearance::Radiomenuitem ||
@@ -1814,6 +1961,16 @@ bool nsNativeThemeWin::GetWidgetPadding(
nsIFrame* aFrame,
StyleAppearance aAppearance,
LayoutDeviceIntMargin* aResult) {
+ bool dwmCompositionEnabled =
+ StaticPrefs::widget_ev_native_controls_patch_force_dwm_report_off()
+ ? false
+ : gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled();
+
+ int overrideWinVer =
+ StaticPrefs::widget_ev_native_controls_patch_override_win_version();
+ bool isWindows10OrLater =
+ (overrideWinVer == 0 && IsWin10OrLater()) || overrideWinVer >= 10;
+
switch (aAppearance) {
// Radios and checkboxes return a fixed size in GetMinimumWidgetSize
// and have a meaningful baseline, so they can't have
@@ -1833,7 +1990,7 @@ bool nsNativeThemeWin::GetWidgetPadding(
aResult->SizeTo(0, 0, 0, 0);
// aero glass doesn't display custom buttons
- if (gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled()) return true;
+ if (dwmCompositionEnabled) return true;
// button padding for standard windows
if (aAppearance == StyleAppearance::MozWindowButtonBox) {
@@ -1852,7 +2009,8 @@ bool nsNativeThemeWin::GetWidgetPadding(
// adding padding to the top of the window that is the size of the caption
// area and then "removing" it when calculating the client area for
// WM_NCCALCSIZE. See bug 618353,
- if (!IsWin10OrLater() &&
+
+ if (!isWindows10OrLater &&
aAppearance == StyleAppearance::MozWindowTitlebarMaximized) {
nsCOMPtr<nsIWidget> rootWidget;
if (WinUtils::HasSystemMetricsForDpi()) {
@@ -2006,6 +2164,11 @@ bool nsNativeThemeWin::GetWidgetOverflow
LayoutDeviceIntSize nsNativeThemeWin::GetMinimumWidgetSize(
nsPresContext* aPresContext, nsIFrame* aFrame,
StyleAppearance aAppearance) {
+ bool dwmCompositionEnabled =
+ StaticPrefs::widget_ev_native_controls_patch_force_dwm_report_off()
+ ? false
+ : gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled();
+
if (IsWidgetNonNative(aFrame, aAppearance) == NonNative::Always) {
return Theme::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance);
}
@@ -2030,6 +2193,7 @@ LayoutDeviceIntSize nsNativeThemeWin::Ge
case StyleAppearance::MozWinCommunicationsToolbox:
case StyleAppearance::MozWinBrowsertabbarToolbox:
case StyleAppearance::Toolbar:
+ case StyleAppearance::Statusbar:
case StyleAppearance::Progresschunk:
case StyleAppearance::Tabpanels:
case StyleAppearance::Tabpanel:
@@ -2051,6 +2215,14 @@ LayoutDeviceIntSize nsNativeThemeWin::Ge
// Windows appears to always use metrics when drawing standard scrollbars)
THEMESIZE sizeReq = TS_TRUE; // Best-fit size
switch (aAppearance) {
+ case StyleAppearance::ScrollbarthumbHorizontal:
+ case StyleAppearance::ScrollbarthumbVertical:
+ case StyleAppearance::ScrollbarbuttonUp:
+ case StyleAppearance::ScrollbarbuttonDown:
+ case StyleAppearance::ScrollbarbuttonLeft:
+ case StyleAppearance::ScrollbarbuttonRight:
+ case StyleAppearance::ScrollbarHorizontal:
+ case StyleAppearance::ScrollbarVertical:
case StyleAppearance::MozMenulistArrowButton: {
auto result = ClassicGetMinimumWidgetSize(aFrame, aAppearance);
ScaleForFrameDPI(&result, aFrame);
@@ -2086,6 +2258,9 @@ LayoutDeviceIntSize nsNativeThemeWin::Ge
sizeReq = TS_MIN;
break;
+ case StyleAppearance::Resizer:
+ break;
+
case StyleAppearance::RangeThumb: {
LayoutDeviceIntSize result(12, 20);
if (!IsRangeHorizontal(aFrame)) {
@@ -2095,6 +2270,17 @@ LayoutDeviceIntSize nsNativeThemeWin::Ge
return result;
}
+ case StyleAppearance::Scrollcorner: {
+ if (nsLookAndFeel::GetInt(nsLookAndFeel::IntID::UseOverlayScrollbars) !=
+ 0) {
+ LayoutDeviceIntSize result(::GetSystemMetrics(SM_CXHSCROLL),
+ ::GetSystemMetrics(SM_CYVSCROLL));
+ ScaleForFrameDPI(&result, aFrame);
+ return result;
+ }
+ break;
+ }
+
case StyleAppearance::Separator: {
// that's 2px left margin, 2px right margin and 2px separator
// (the margin is drawn as part of the separator, though)
@@ -2158,7 +2344,7 @@ LayoutDeviceIntSize nsNativeThemeWin::Ge
case StyleAppearance::MozWindowButtonBox:
case StyleAppearance::MozWindowButtonBoxMaximized: {
- if (gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled()) {
+ if (dwmCompositionEnabled) {
SIZE sz = nsUXThemeData::GetCommandButtonBoxMetrics();
LayoutDeviceIntSize result(sz.cx,
sz.cy - GetSystemMetrics(SM_CYFRAME) -
@@ -2200,7 +2386,11 @@ nsNativeThemeWin::WidgetStateChanged(nsI
aAppearance == StyleAppearance::MozWinCommunicationsToolbox ||
aAppearance == StyleAppearance::MozWinBrowsertabbarToolbox ||
aAppearance == StyleAppearance::Toolbar ||
+ aAppearance == StyleAppearance::Statusbar ||
+ aAppearance == StyleAppearance::Statusbarpanel ||
+ aAppearance == StyleAppearance::Resizerpanel ||
aAppearance == StyleAppearance::Progresschunk ||
+ aAppearance == StyleAppearance::Tooltip ||
aAppearance == StyleAppearance::ProgressBar ||
aAppearance == StyleAppearance::Tabpanels ||
aAppearance == StyleAppearance::Tabpanel ||
@@ -2278,6 +2468,8 @@ bool nsNativeThemeWin::ThemeSupportsWidg
else
theme = GetTheme(aAppearance);
+ if (theme && aAppearance == StyleAppearance::Resizer) return true;
+
if (theme || ClassicThemeSupportsWidget(aFrame, aAppearance))
// turn off theming for some HTML widgets styled by the page
return (!IsWidgetStyled(aPresContext, aFrame, aAppearance));
@@ -2346,6 +2538,14 @@ nsITheme::Transparency nsNativeThemeWin:
}
switch (aAppearance) {
+ case StyleAppearance::Resizer: {
+ // The classic native resizer has an opaque grey background which doesn't
+ // match the usually white background of the scrollable container, so
+ // only support the native resizer if not in a scrollframe.
+ nsIFrame* parentFrame = aFrame->GetParent();
+ return (!parentFrame || !parentFrame->IsScrollFrame()) ? eTransparent
+ : eOpaque;
+ }
case StyleAppearance::MozWinBorderlessGlass:
case StyleAppearance::ProgressBar:
case StyleAppearance::Progresschunk:
@@ -2359,7 +2559,8 @@ nsITheme::Transparency nsNativeThemeWin:
// For the classic theme we don't really have a way of knowing
if (!theme) {
// menu backgrounds which can't be themed are opaque
- if (aAppearance == StyleAppearance::Menupopup) {
+ if (aAppearance == StyleAppearance::Tooltip ||
+ aAppearance == StyleAppearance::Menupopup) {
return eOpaque;
}
return eUnknownTransparency;
@@ -2386,6 +2587,13 @@ nsITheme::Transparency nsNativeThemeWin:
bool nsNativeThemeWin::ClassicThemeSupportsWidget(nsIFrame* aFrame,
StyleAppearance aAppearance) {
switch (aAppearance) {
+ case StyleAppearance::Resizer: {
+ // The classic native resizer has an opaque grey background which doesn't
+ // match the usually white background of the scrollable container, so
+ // only support the native resizer if not in a scrollframe.
+ nsIFrame* parentFrame = aFrame->GetParent();
+ return !parentFrame || !parentFrame->IsScrollFrame();
+ }
case StyleAppearance::Menubar:
case StyleAppearance::Menupopup:
// Classic non-flat menus are handled almost entirely through CSS.
@@ -2400,6 +2608,15 @@ bool nsNativeThemeWin::ClassicThemeSuppo
case StyleAppearance::Range:
case StyleAppearance::RangeThumb:
case StyleAppearance::Groupbox:
+ case StyleAppearance::ScrollbarbuttonUp:
+ case StyleAppearance::ScrollbarbuttonDown:
+ case StyleAppearance::ScrollbarbuttonLeft:
+ case StyleAppearance::ScrollbarbuttonRight:
+ case StyleAppearance::ScrollbarthumbVertical:
+ case StyleAppearance::ScrollbarthumbHorizontal:
+ case StyleAppearance::ScrollbarVertical:
+ case StyleAppearance::ScrollbarHorizontal:
+ case StyleAppearance::Scrollcorner:
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::MozMenulistArrowButton:
@@ -2407,6 +2624,10 @@ bool nsNativeThemeWin::ClassicThemeSuppo
case StyleAppearance::SpinnerDownbutton:
case StyleAppearance::Listbox:
case StyleAppearance::Treeview:
+ case StyleAppearance::Tooltip:
+ case StyleAppearance::Statusbar:
+ case StyleAppearance::Statusbarpanel:
+ case StyleAppearance::Resizerpanel:
case StyleAppearance::ProgressBar:
case StyleAppearance::Progresschunk:
case StyleAppearance::Tab:
@@ -2442,6 +2663,10 @@ LayoutDeviceIntMargin nsNativeThemeWin::
case StyleAppearance::Button:
result.top = result.left = result.bottom = result.right = 2;
break;
+ case StyleAppearance::Statusbar:
+ result.bottom = result.left = result.right = 0;
+ result.top = 2;
+ break;
case StyleAppearance::Listbox:
case StyleAppearance::Treeview:
case StyleAppearance::Menulist:
@@ -2452,6 +2677,17 @@ LayoutDeviceIntMargin nsNativeThemeWin::
case StyleAppearance::Textarea:
result.top = result.left = result.bottom = result.right = 2;
break;
+ case StyleAppearance::Statusbarpanel:
+ case StyleAppearance::Resizerpanel: {
+ result.top = 1;
+ result.left = 1;
+ result.bottom = 1;
+ result.right = aFrame->GetNextSibling() ? 3 : 1;
+ break;
+ }
+ case StyleAppearance::Tooltip:
+ result.top = result.left = result.bottom = result.right = 1;
+ break;
case StyleAppearance::ProgressBar:
result.top = result.left = result.bottom = result.right = 1;
break;
@@ -2526,6 +2762,25 @@ LayoutDeviceIntSize nsNativeThemeWin::Cl
result.width = ::GetSystemMetrics(SM_CXVSCROLL);
result.height = 8; // No good metrics available for this
break;
+ case StyleAppearance::ScrollbarbuttonUp:
+ case StyleAppearance::ScrollbarbuttonDown:
+ result.width = ::GetSystemMetrics(SM_CXVSCROLL);
+ result.height = ::GetSystemMetrics(SM_CYVSCROLL);
+ break;
+ case StyleAppearance::ScrollbarbuttonLeft:
+ case StyleAppearance::ScrollbarbuttonRight:
+ // For scrollbar-width:thin, we don't display the buttons.
+ if (!ScrollbarDrawing::IsScrollbarWidthThin(aFrame)) {
+ result.width = ::GetSystemMetrics(SM_CXHSCROLL);
+ result.height = ::GetSystemMetrics(SM_CYHSCROLL);
+ }
+ break;
+ case StyleAppearance::ScrollbarVertical:
+ case StyleAppearance::ScrollbarHorizontal:
+ // Sizing code needed after removal of XUL layout (around ESR 115)
+ result.width = ::GetSystemMetrics(SM_CYHSCROLL);
+ result.height = ::GetSystemMetrics(SM_CYHSCROLL);
+ break;
case StyleAppearance::RangeThumb: {
if (IsRangeHorizontal(aFrame)) {
result.width = 12;
@@ -2536,6 +2791,35 @@ LayoutDeviceIntSize nsNativeThemeWin::Cl
}
break;
}
+ case StyleAppearance::ScrollbarthumbVertical:
+ result.width = ::GetSystemMetrics(SM_CXVSCROLL);
+ result.height = ::GetSystemMetrics(SM_CYVTHUMB);
+ // Without theming, divide the thumb size by two in order to look more
+ // native
+ if (!GetTheme(aAppearance)) {
+ result.height >>= 1;
+ }
+ // If scrollbar-width is thin, divide the thickness by two to make
+ // it look more compact.
+ if (ScrollbarDrawing::IsScrollbarWidthThin(aFrame)) {
+ result.width >>= 1;
+ }
+ break;
+ case StyleAppearance::ScrollbarthumbHorizontal:
+ result.width = ::GetSystemMetrics(SM_CXHTHUMB);
+ result.height = ::GetSystemMetrics(SM_CYHSCROLL);
+ // Without theming, divide the thumb size by two in order to look more
+ // native
+ if (TRUE || !GetTheme(aAppearance)) {
+ result.width >>= 1;
+ }
+ // If scrollbar-width is thin, divide the thickness by two to make
+ // it look more compact.
+ if (ScrollbarDrawing::IsScrollbarWidthThin(aFrame)) {
+ result.height >>= 1;
+ }
+
+ break;
case StyleAppearance::MozMenulistArrowButton:
result.width = ::GetSystemMetrics(SM_CXVSCROLL);
break;
@@ -2550,11 +2834,21 @@ LayoutDeviceIntSize nsNativeThemeWin::Cl
case StyleAppearance::Textarea:
case StyleAppearance::Progresschunk:
case StyleAppearance::ProgressBar:
+ case StyleAppearance::Tooltip:
case StyleAppearance::Tab:
case StyleAppearance::Tabpanel:
case StyleAppearance::Tabpanels:
// no minimum widget size
break;
+ case StyleAppearance::Resizer: {
+ NONCLIENTMETRICS nc;
+ nc.cbSize = sizeof(nc);
+ if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(nc), &nc, 0))
+ result.width = result.height = abs(nc.lfStatusFont.lfHeight) + 4;
+ else
+ result.width = result.height = 15;
+ break;
+ }
case StyleAppearance::Menuseparator: {
result.width = 0;
result.height = 10;
@@ -2732,7 +3026,16 @@ nsresult nsNativeThemeWin::ClassicGetThe
case StyleAppearance::MenulistButton:
case StyleAppearance::Range:
case StyleAppearance::RangeThumb:
+ case StyleAppearance::Statusbar:
+ case StyleAppearance::Statusbarpanel:
+ case StyleAppearance::Resizerpanel:
+ case StyleAppearance::ScrollbarthumbVertical:
+ case StyleAppearance::ScrollbarthumbHorizontal:
+ case StyleAppearance::ScrollbarVertical:
+ case StyleAppearance::ScrollbarHorizontal:
+ case StyleAppearance::Scrollcorner:
case StyleAppearance::Progresschunk:
+ case StyleAppearance::Tooltip:
case StyleAppearance::ProgressBar:
case StyleAppearance::Tab:
case StyleAppearance::Tabpanel:
@@ -2777,6 +3080,39 @@ nsresult nsNativeThemeWin::ClassicGetThe
return NS_OK;
}
+ case StyleAppearance::ScrollbarbuttonUp:
+ case StyleAppearance::ScrollbarbuttonDown:
+ case StyleAppearance::ScrollbarbuttonLeft:
+ case StyleAppearance::ScrollbarbuttonRight: {
+ ElementState contentState = GetContentState(aFrame, aAppearance);
+
+ aPart = DFC_SCROLL;
+ switch (aAppearance) {
+ case StyleAppearance::ScrollbarbuttonUp:
+ aState = DFCS_SCROLLUP;
+ break;
+ case StyleAppearance::ScrollbarbuttonDown:
+ aState = DFCS_SCROLLDOWN;
+ break;
+ case StyleAppearance::ScrollbarbuttonLeft:
+ aState = DFCS_SCROLLLEFT;
+ break;
+ case StyleAppearance::ScrollbarbuttonRight:
+ aState = DFCS_SCROLLRIGHT;
+ break;
+ default:
+ break;
+ }
+
+ if (contentState.HasState(ElementState::DISABLED)) {
+ aState |= DFCS_INACTIVE;
+ } else if (contentState.HasAllStates(ElementState::HOVER |
+ ElementState::ACTIVE)) {
+ aState |= DFCS_PUSHED | DFCS_FLAT;
+ }
+
+ return NS_OK;
+ }
case StyleAppearance::SpinnerUpbutton:
case StyleAppearance::SpinnerDownbutton: {
ElementState contentState = GetContentState(aFrame, aAppearance);
@@ -2803,6 +3139,11 @@ nsresult nsNativeThemeWin::ClassicGetThe
return NS_OK;
}
+ case StyleAppearance::Resizer:
+ aPart = DFC_SCROLL;
+ aState =
+ (IsFrameRTL(aFrame) ? DFCS_SCROLLSIZEGRIPRIGHT : DFCS_SCROLLSIZEGRIP);
+ return NS_OK;
case StyleAppearance::Menuseparator:
aPart = 0;
aState = 0;
@@ -3055,9 +3396,14 @@ RENDER_AGAIN:
// Draw controls supported by DrawFrameControl
case StyleAppearance::Checkbox:
case StyleAppearance::Radio:
+ case StyleAppearance::ScrollbarbuttonUp:
+ case StyleAppearance::ScrollbarbuttonDown:
+ case StyleAppearance::ScrollbarbuttonLeft:
+ case StyleAppearance::ScrollbarbuttonRight:
case StyleAppearance::SpinnerUpbutton:
case StyleAppearance::SpinnerDownbutton:
- case StyleAppearance::MozMenulistArrowButton: {
+ case StyleAppearance::MozMenulistArrowButton:
+ case StyleAppearance::Resizer: {
int32_t oldTA;
// setup DC to make DrawFrameControl draw correctly
oldTA = ::SetTextAlign(hdc, TA_TOP | TA_LEFT | TA_NOUPDATECP);
@@ -3096,6 +3442,13 @@ RENDER_AGAIN:
break;
}
+ // Draw ToolTip background
+ case StyleAppearance::Tooltip:
+ ::FrameRect(hdc, &widgetRect, ::GetSysColorBrush(COLOR_WINDOWFRAME));
+ InflateRect(&widgetRect, -1, -1);
+ ::FillRect(hdc, &widgetRect, ::GetSysColorBrush(COLOR_INFOBK));
+
+ break;
case StyleAppearance::Groupbox:
::DrawEdge(hdc, &widgetRect, EDGE_ETCHED, BF_RECT | BF_ADJUST);
::FillRect(hdc, &widgetRect, (HBRUSH)(COLOR_BTNFACE + 1));
@@ -3106,10 +3459,27 @@ RENDER_AGAIN:
::DrawEdge(hdc, &widgetRect, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE);
InflateRect(&widgetRect, -1, -1);
[[fallthrough]];
- case StyleAppearance::Tabpanel: {
+ case StyleAppearance::Tabpanel:
+ case StyleAppearance::Statusbar:
+ case StyleAppearance::Resizerpanel: {
::FillRect(hdc, &widgetRect, (HBRUSH)(COLOR_BTNFACE + 1));
break;
}
+ // Draw scrollbar thumb
+ case StyleAppearance::ScrollbarthumbVertical:
+ case StyleAppearance::ScrollbarthumbHorizontal:
+ ::DrawEdge(hdc, &widgetRect, EDGE_RAISED, BF_RECT | BF_MIDDLE);
+
+ break;
+ // Draw 3D inset statusbar panel
+ case StyleAppearance::Statusbarpanel: {
+ if (aFrame->GetNextSibling())
+ widgetRect.right -= 2; // space between sibling status panels
+
+ ::DrawEdge(hdc, &widgetRect, BDR_SUNKENOUTER, BF_RECT | BF_MIDDLE);
+
+ break;
+ }
case StyleAppearance::RangeThumb: {
ElementState elementState = GetContentState(aFrame, aAppearance);
@@ -3147,6 +3517,37 @@ RENDER_AGAIN:
break;
}
+ // Draw scrollbar track background
+ case StyleAppearance::ScrollbarVertical:
+ case StyleAppearance::ScrollbarHorizontal: {
+ // Windows fills in the scrollbar track differently
+ // depending on whether these are equal
+ DWORD color3D, colorScrollbar, colorWindow;
+
+ color3D = ::GetSysColor(COLOR_3DFACE);
+ colorWindow = ::GetSysColor(COLOR_WINDOW);
+ colorScrollbar = ::GetSysColor(COLOR_SCROLLBAR);
+
+ if ((color3D != colorScrollbar) && (colorWindow != colorScrollbar))
+ // Use solid brush
+ ::FillRect(hdc, &widgetRect, (HBRUSH)(COLOR_SCROLLBAR + 1));
+ else {
+ DrawCheckedRect(hdc, widgetRect, COLOR_3DHILIGHT, COLOR_3DFACE,
+ (HBRUSH)COLOR_SCROLLBAR + 1);
+ }
+ // XXX should invert the part of the track being clicked here
+ // but the track is never :active
+
+ break;
+ }
+ case StyleAppearance::Scrollcorner: {
+ ::FillRect(hdc, &widgetRect, (HBRUSH)(COLOR_SCROLLBAR + 1));
+
+ // Are Mozilla fucking retarded? They added this in 2018
+ // (https://github.com/mozilla/gecko-dev/blob/7038d5f94456dcb558f7c7f6fe66d913070001c5/widget/windows/nsNativeThemeWin.cpp#L3793-L3795)
+ // and never fixed this fallthrough.
+ break;
+ }
case StyleAppearance::Progresschunk: {
nsIFrame* stateFrame = aFrame->GetParent();
ElementState elementState = GetContentState(stateFrame, aAppearance);
diff --git a/widget/windows/nsUXThemeData.cpp b/widget/windows/nsUXThemeData.cpp
--- a/widget/windows/nsUXThemeData.cpp
+++ b/widget/windows/nsUXThemeData.cpp
@@ -14,6 +14,10 @@