summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/resources/tab_strip/tab.html
blob: 85517760d2df9eff5eab2de739e5af4a30cd6133 (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
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
<style>
  :host {
    --tabstrip-tab-title-height: 40px;
    --tabstrip-tab-transition-duration: 250ms;

    cursor: pointer;
    height: var(--tabstrip-tab-height);
    position: relative;
    width: var(--tabstrip-tab-width);
  }

  #dragImage {
    background: var(--tabstrip-tab-background-color);
    border-radius: var(--tabstrip-tab-border-radius);
    box-shadow: 0 0 0 1px var(--tabstrip-tab-separator-color);
    color: var(--tabstrip-tab-text-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    width: 100%;
  }

  :host([active]) #dragImage {
    box-shadow: 0 0 0 2px var(--tabstrip-tab-active-border-color);
    outline: none;
  }

  #title {
    align-items: center;
    border-block-end: 1px solid var(--tabstrip-tab-separator-color);
    box-sizing: border-box;
    display: flex;
    height: var(--tabstrip-tab-title-height);
    justify-content: center;
    margin: 0;
    overflow: hidden;
  }

  #faviconContainer {
    --favicon-size: 16px;
    flex-shrink: 0;
    height: var(--favicon-size);
    margin-inline-end: 8px;
    margin-inline-start: 12px;
    max-width: var(--favicon-size);
    position: relative;
    /* When transitioning to the default visible state, the margin and max-width
     * transitions should finish first, then the opacity should be set to 1.
     * This prevents the favicon and loading spinners from looking cropped
     * while the element transitions. */
    transition: margin var(--tabstrip-tab-transition-duration),
                max-width var(--tabstrip-tab-transition-duration),
                opacity 0ms linear var(--tabstrip-tab-transition-duration);
    width: var(--favicon-size);
  }

  :host([hide-icon_]) #faviconContainer {
    margin-inline-end: 0;
    max-width: 0;
    opacity: 0;
    /* When transitioning to the hidden state, set opacity immediately to 0
     * while transitioning the other values normally. */
    transition: margin var(--tabstrip-tab-transition-duration),
                max-width var(--tabstrip-tab-transition-duration),
                opacity 0ms;
  }

  :host([pinned_]) #faviconContainer {
    margin: 0;
  }

  #progressSpinner,
  #favicon,
  #crashedIcon {
    height: var(--favicon-size);
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: var(--favicon-size);
  }

  #progressSpinner {
    -webkit-mask:
        url(chrome://resources/images/throbber_small.svg)
        center/contain no-repeat;
    display: none;
  }

  #favicon {
    background-size: contain;
    transition: border-radius var(--tabstrip-tab-transition-duration);
  }

  #crashedIcon {
    -webkit-mask:
        url(chrome://theme/IDR_CRASH_SAD_FAVICON@2x)
        center/contain no-repeat;
    background-color: currentColor;
    opacity: 0;
    transform: translate(-50%, 100%);
  }

  #blocked {
    background: var(--tabstrip-tab-blocked-color);
    border: solid 1px var(--tabstrip-tab-background-color);
    border-radius: 50%;
    bottom: 0;
    display: none;
    height: 6px;
    position: absolute;
    right: 0;
    transform: translate(50%, 50%);
    width: 6px;
  }

  :host([waiting_]) #progressSpinner,
  :host([loading_]) #progressSpinner {
    display: block;
  }

  :host([loading_]) #favicon {
    border-radius: 50%;
    height: calc(var(--favicon-size) - 6px);
    overflow: hidden;
    width: calc(var(--favicon-size) - 6px);
  }

  :host([waiting_]) #progressSpinner {
    background-color: var(--tabstrip-tab-waiting-spinning-color);
    transform: /* Center first, then flip horizontally. */
              translate(-50%, -50%) scaleX(-1);
  }

  :host([waiting_]) #favicon {
    display: none;
  }

  :host([loading_]) #progressSpinner {
    background-color: var(--tabstrip-tab-loading-spinning-color);
  }

  :host([crashed_]) #favicon {
    opacity: 0;
    transform: translate(-50%, 100%);
    transition:
        opacity var(--tabstrip-tab-transition-duration),
        transform var(--tabstrip-tab-transition-duration);
  }

  :host([crashed_]) #crashedIcon {
    opacity: 1;
    transform: translate(-50%, -50%);
    transition:
        opacity var(--tabstrip-tab-transition-duration),
        transform var(--tabstrip-tab-transition-duration);
    /* Wait until transition for #favicon finishes. */
    transition-delay: var(--tabstrip-tab-transition-duration);
  }

  :host([blocked_]) #blocked {
    display: block;
  }

  :host([active][blocked_]) #blocked {
    display: none;
  }

  #titleText {
    font-size: 100%;
    font-weight: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #close {
    -webkit-appearance: none;
    align-items: center;
    background-color: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    display: flex;
    flex-shrink: 0;
    height: 100%;
    justify-content: center;
    margin-inline-start: auto;
    padding: 0;
    position: relative;
    width: 36px;
  }

  #closeIcon {
    -webkit-mask:
        url(chrome://resources/images/icon_clear.svg)center/contain no-repeat;
    background-color: currentColor;
    display: block;
    height: 18px;
    position: relative;
    width: 18px;
  }

  #thumbnail {
    align-items: center;
    background: var(--tabstrip-tab-background-color);
    display: flex;
    flex: 1;
    justify-content: center;
  }

  #thumbnailImg {
    height: calc(var(--tabstrip-tab-height) - var(--tabstrip-tab-title-height));
    object-fit: cover;
    pointer-events: none;
    width: var(--tabstrip-tab-width);
  }

  #thumbnailImg:not([src]) {
    display: none;
    pointer-events: none;
    width: 100%;
  }

  /* Pinned tab styles */
  :host([pinned_]) {
    height: var(--tabstrip-pinned-tab-size);
    width: var(--tabstrip-pinned-tab-size);
  }

  :host([pinned_]) #title {
    border-block-end: 0;
    height: 100%;
  }

  :host([pinned_]) #titleText,
  :host([pinned_]) #close,
  :host([pinned_]) #thumbnail {
    display: none;
  }

  :host([dragging_]) #dragPlaceholder {
    background: var(--tabstrip-tab-background-color);
    border-radius: var(--tabstrip-tab-border-radius);
    height: 100%;
    opacity: 0.5;
    width: 100%;
  }

  /* When being dragged, the contents of the drag image needs to be off-screen
   * with nothing else on top or below obscuring it. */
  :host([dragging_]) #dragImage {
    box-shadow: none;
    position: absolute;
    top: -999px;
  }
</style>

<div id="dragPlaceholder"></div>

<div id="dragImage">
  <header id="title">
    <div id="faviconContainer">
      <div id="progressSpinner"></div>
      <div id="favicon"></div>
      <div id="crashedIcon"></div>
      <div id="blocked"></div>
    </div>
    <h2 id="titleText"></h2>
    <button id="close">
      <span id="closeIcon"></span>
    </button>
  </header>

  <div id="thumbnail">
    <img id="thumbnailImg">
  </div>
</div>