summaryrefslogtreecommitdiffstats
path: root/toolkit/themes/linux/global/popup.css
blob: acd11c9359c5b345416631fa190dd31f20550677 (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
/* 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-padding-block: max(0px, var(--panel-border-radius) / 2 - 1px);
  --panel-padding: var(--panel-padding-block) 0;
  --panel-color: MenuText;
  --panel-background: Menu;
  --panel-border-radius: 8px;
  --panel-border-color: ThreeDShadow;
  --panel-width: initial;
  --panel-shadow: 0 0 var(--panel-shadow-margin) hsla(0,0%,0%,.2);
  /* To account for the box-shadow below */
  --panel-shadow-margin: 4px;
  margin: calc(-1 * var(--panel-shadow-margin));
  -moz-window-input-region-margin: var(--panel-shadow-margin);
}

menupopup {
  /* Also apply the padding in the inline axis for menus */
  --panel-padding: var(--panel-padding-block);
}

@media (prefers-contrast) {
  menupopup,
  panel {
    --panel-border-color: color-mix(in srgb, currentColor 60%, transparent);
  }
}

menupopup > menu > menupopup {
  /* Vertically align nested menupopups: the shadow plus the top padding */
  margin-top: calc(-1 * (var(--panel-shadow-margin) + var(--panel-padding-block)));
}

/* ::::: arrow panel ::::: */

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

:is(panel, menupopup)::part(content) {
  display: flex;
  box-sizing: border-box;
  padding: var(--panel-padding);
  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));

  box-shadow: var(--panel-shadow);
  margin: 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 */
}

/* rules for popups associated with menulists */

menulist > menupopup {
  padding: 0;
  min-width: 0;
}