diff options
Diffstat (limited to 'toolkit/themes/shared/pictureinpicture/texttracks.css')
-rw-r--r-- | toolkit/themes/shared/pictureinpicture/texttracks.css | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/toolkit/themes/shared/pictureinpicture/texttracks.css b/toolkit/themes/shared/pictureinpicture/texttracks.css new file mode 100644 index 0000000000..ec7af4a7b4 --- /dev/null +++ b/toolkit/themes/shared/pictureinpicture/texttracks.css @@ -0,0 +1,74 @@ +/* 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/. */ + +:root { + --min-font-size: 14px; + --max-font-size: 40px; + --font-scale: 0.06; + --texttracks-bottom: calc(var(--font-scale) * 100vh); + + /* + * Move text tracks if they visually overlap with pip player controls + * New text tracks position is determined by adding together: + * 1) bottom distance of #controls + * 2) height of #controls-bottom, + * 3) border size of player controls buttons + * 4) hardcoded px value (to ensure consistent distance, regardless of pip window size) + * NOTE: if changing player.css values, change values here too. + */ + --resize-margin: 5px; + --player-controls-height: calc(100vh - 2 * var(--resize-margin)); + --player-controls-bottom-distance: calc(100vh - var(--player-controls-height)); + --player-controls-button-height: 10vmax; + --player-controls-button-max-height: 32px; + --player-controls-button-min-height: 16px; + --player-controls-button-outline-width: 2px; + --player-controls-scrubber-height: 0px; + --player-bottom-controls-height: calc(var(--player-controls-scrubber-height) + clamp(var(--player-controls-button-min-height), var(--player-controls-button-height), var(--player-controls-button-max-height))); + --distance-from-player-controls: 20px; + --texttracks-bottom-overlapped: calc(var(--player-controls-button-outline-width) + var(--player-controls-bottom-distance) + var(--player-bottom-controls-height) + var(--distance-from-player-controls)); +} + +#texttracks { + background-color: black; + opacity: 80%; + position: absolute; + text-align: center; + box-sizing: border-box; + color: white; + margin: 0; + display: block; + left: 50%; + transform: translateX(-50%); + padding: 8px; + max-width: calc(0.88 * 100vw); + bottom: var(--texttracks-bottom); + font-size: clamp(var(--min-font-size), calc(var(--font-scale) * 100vh), var(--max-font-size)); + line-height: clamp(14.4px, calc(var(--font-scale) * 1.2 * 100vh), 48px); + white-space: pre-line; + width: max-content; + font-family: sans-serif; + transition: bottom 0.3s; + transition-delay: 0.1s; +} + +#texttracks[overlap-video-controls] { + bottom: var(--texttracks-bottom-overlapped) +} + +#texttracks:empty { + visibility: hidden; +} + +@media (prefers-reduced-motion) { + #texttracks { + transition: none; + } +} + +@media screen and (max-width: 319px) { + #texttracks { + display: none; + } +} |