summaryrefslogtreecommitdiffstats
path: root/toolkit/themes/windows/global/popup.css
blob: 54ffa2ec8ebebef1b73728e98e20ffb752ec12d8 (plain)
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
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml");

/* ::::: menupopup ::::: */

menupopup,
panel {
  min-width: 1px;
  --panel-background: Menu;
  --panel-color: MenuText;
  --panel-padding: 0;
  --panel-border-radius: 0;
  --panel-border-color: ThreeDShadow;
  --panel-width: initial;

  --panel-shadow: 0 0 var(--panel-shadow-margin) hsla(0,0%,0%,.2);
  --panel-shadow-margin: 4px;
  -moz-window-input-region-margin: var(--panel-shadow-margin);
  margin: calc(-1 * var(--panel-shadow-margin));
}

@media not (-moz-windows-non-native-menus) {
  menupopup {
    appearance: auto;
    -moz-default-appearance: menupopup;

    /* Native menus are always light */
    color-scheme: light !important;

    /* We set the background-color / border here so that it doesn't interfere with native styling. */
    background-color: Menu;
    border: 1px solid ThreeDShadow;
    --panel-background: transparent;
    --panel-border-color: transparent;
    --nested-margin: -3px;
    --panel-shadow-margin: 0px;
  }
}

@media (-moz-windows-non-native-menus) {
  menupopup {
    /* Disable the default appearance so we can override the native styling. */
    appearance: none;

    /* Prevent any background or border around the outside of the shadow. */
    background-color: transparent;
    border: none;

    --panel-border-radius: 4px;
    --panel-padding: 4px 0;
    --panel-border-color: ThreeDShadow;
    --panel-background: Menu;
    --nested-margin: -10px;
  }

  menupopup > menuitem,
  menupopup > menu {
    padding-block: 0.5em;
    padding-inline-start: 1em;
  }
}

menupopup > menu > menupopup {
 /* align submenus */
  margin-inline-start: var(--nested-margin);
  margin-top: var(--nested-margin);
}

:is(panel, menupopup)[type="arrow"] {
  appearance: none;
  background: transparent;
  border: none;
}

:is(panel, menupopup)::part(content) {
  display: flex;
  box-sizing: border-box;
  padding: var(--panel-padding);
  margin: var(--panel-shadow-margin);
  box-shadow: var(--panel-shadow);
  color: var(--panel-color);
  background: var(--panel-background);
  border-radius: var(--panel-border-radius);
  border: 1px solid var(--panel-border-color);
  width: var(--panel-width);
  min-width: 0;
  min-height: 0;

  /* Makes popup constraints work */
  max-height: calc(100% - 2 * var(--panel-shadow-margin));
  max-width: calc(100% - 2 * var(--panel-shadow-margin));
}

:is(panel, menupopup)[orient=vertical]::part(content) {
  flex-direction: column;
}

panel[type="arrow"].panel-no-padding::part(content) {
  padding: 0;
  overflow: hidden; /* Don't let panel content overflow the border-radius */
}

/* rules for popups associated with menulists */

menulist > menupopup {
  font: inherit;
  appearance: none;
  background-color: transparent;
  border: none;
  min-width: 0;
}

@media not (-moz-windows-non-native-menus) {
  /* For Win10, the popup itself needs to have a transparent background because
     otherwise the background color would appear behind the drop shadow. */
  menulist > menupopup {
    color: FieldText;
    --panel-background: Field;
    --panel-border-color: ThreeDShadow;
  }
}