summaryrefslogtreecommitdiffstats
path: root/toolkit/themes/shared/menu-shared.css
blob: 40b4fdd66cf54f9d16be2c78be1b003abbd91e60 (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
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
/* 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");

*|*:root {
  --menu-icon-opacity: 1;
  --menu-arrow-width: 1em;

  @media (-moz-platform: windows) {
    --menu-arrow-width: max(1em, 16px);

    @media (prefers-color-scheme: light) {
      --menu-icon-opacity: 0.7;
    }
  }
}

/* Menu separator */

menuseparator {
  /* Using padding instead of margin to increase the hit area, as some
     separators (e.g. in bookmarks menus) can be dragged or have a context
     menu. */
  padding-block: 4px;

  @media (-moz-platform: macos) {
    padding-block: 5px;
    margin-inline: 9px;
  }
}

menuseparator::before {
  border-top: 1px solid var(--panel-separator-color);
  content: "";
  display: block;
  flex: 1;
}

/* Accel text */

@media not (prefers-contrast) {
  menuitem:not([disabled]) > .menu-accel-container > :is(.menu-accel, .menu-iconic-accel) {
    color: var(--panel-disabled-color);
  }
}

/* Scroll buttons */

/* Hide arrow buttons when there's nothing to scroll in that direction */
.menupopup-arrowscrollbox[scrolledtostart="true"]::part(scrollbutton-up),
.menupopup-arrowscrollbox[scrolledtoend="true"]::part(scrollbutton-down) {
  display: none;
}

/* Prevent the scrolled contents of the menupopup from jumping vertically when
 * the arrow buttons appear / disappear, by positioning ::part(scrollbox) in
 * such a way that its edges are at the same position as the edges of
 * arrowscrollbox regardless of scroll button visibility.
 */
.menupopup-arrowscrollbox:not([scrolledtostart="true"])::part(scrollbox) {
  /* scrollbutton-up is visible; shift our top edge up by its height. */
  margin-top: -16px;
}

.menupopup-arrowscrollbox:not([scrolledtoend="true"])::part(scrollbox) {
  /* scrollbutton-down is visible; shift our bottom edge down by its height. */
  margin-bottom: -16px;
}

.menupopup-arrowscrollbox::part(scrollbox-clip) {
  /* In the space where the arrow buttons overlap the scrollbox, clip away the
   * scrollbox so that nothing is shown behind the arrow button even if the
   * button is transparent.
   */
  overflow: clip;
}

@media (-moz-platform: windows) or (-moz-platform: linux) {
  menupopup,
  menubar {
    font: menu;
  }
}

@media (-moz-platform: macos) {
  menupopup {
    /* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
    font: -moz-pull-down-menu;
  }
}

menu,
menuitem,
menucaption {
  border-radius: calc(var(--panel-border-radius) / 2);
  align-items: center;
  flex-shrink: 0;
  list-style-image: none;
  max-width: 42em;

  @media (-moz-platform: linux) {
    padding: 4px 6px;
  }

  @media (-moz-platform: macos) {
    padding: 3px 9px;
  }
}

menu,
menuitem {
  &:where([disabled="true"]) {
    color: var(--panel-disabled-color);
    text-shadow: none;
  }

  &:where([_moz-menuactive]:not([disabled="true"])) {
    color: -moz-menuhovertext;
    background-color: -moz-menuhover;
  }

  &:where([_moz-menuactive="true"][disabled="true"]) {
    background-color: -moz-menuhoverdisabled;
  }
}

menuitem:is([default="true"], .spell-suggestion),
menucaption {
  font-weight: bold;
}

/* ..... menu arrow box ..... */

.menu-right {
  list-style-image: url("chrome://global/skin/icons/arrow-right.svg");
  -moz-context-properties: fill, fill-opacity;
  fill: currentColor;
  fill-opacity: var(--menu-icon-opacity);

  &:-moz-locale-dir(rtl) {
    list-style-image: url("chrome://global/skin/icons/arrow-left.svg");
  }

  > image {
    width: var(--menu-arrow-width);
  }

  @media (-moz-platform: linux) {
    margin-block: 0;
    margin-inline: 6px 0;
  }

  @media (-moz-platform: macos) {
    margin-inline: 22px -3px;
  }

  @media (-moz-platform: windows) {
    margin-inline-end: 1em;
  }
}

@media (-moz-platform: macos) {
  :is(.menu-accel, .menu-iconic-accel)[value] {
    margin-inline-start: 25px;
  }
}