--- a/toolkit/content/widgets/videocontrols.js
+++ b/toolkit/content/widgets/videocontrols.js
@@ -2076,17 +2076,495 @@ this.VideoControlsImplPageWidget = class
* Remove it when migrate to Fluent.
*/
const parser = new this.window.DOMParser();
let parserDoc = parser.parseFromString(`<!DOCTYPE bindings [
<!ENTITY % videocontrolsDTD SYSTEM "chrome://global/locale/videocontrols.dtd">
%videocontrolsDTD;
]>
<div class="videocontrols" xmlns="http://www.w3.org/1999/xhtml">
- <link rel="stylesheet" type="text/css" href="chrome://global/skin/media/videocontrols.css" />
+ <style>
+.videocontrols {
+ writing-mode: horizontal-tb;
+ width: 100%;
+ height: 100%;
+ display: inline-block;
+ overflow: hidden;
+
+ direction: ltr;
+ /* Prevent unwanted style inheritance. See bug 554717. */
+ text-align: left;
+ list-style-image: none !important;
+ font: normal normal normal 100%/normal sans-serif !important;
+ text-decoration: none !important;
+}
+
+.controlsContainer {
+ --clickToPlay-size: 48px;
+ --button-size: 30px;
+ --timer-size: 40px;
+ --timer-long-size: 60px;
+ --track-size: 5px;
+ --thumb-size: 13px;
+ --label-font-size: 13px;
+}
+.controlsContainer.touch {
+ --clickToPlay-size: 64px;
+ --button-size: 40px;
+ --timer-size: 52px;
+ --timer-long-size: 78px;
+ --track-size: 7px;
+ --thumb-size: 16px;
+ --label-font-size: 16px;
+}
+
+/* Some CSS custom properties defined here are referenced by videocontrols.xml in JavaScript */
+.controlBar {
+ /* Do not delete: these variables are accessed by JavaScript directly.
+ see videocontrols.xml and search for |-width|. */
+ --clickToPlay-width: var(--clickToPlay-size);
+ --playButton-width: var(--button-size);
+ --scrubberStack-width: 64px;
+ --muteButton-width: var(--button-size);
+ --volumeStack-width: 48px;
+ --castingButton-width: var(--button-size);
+ --closedCaptionButton-width: var(--button-size);
+ --fullscreenButton-width: var(--button-size);
+ --positionDurationBox-width: var(--timer-size);
+ --durationSpan-width: var(--timer-size);
+ --positionDurationBox-width-long: var(--timer-long-size);
+ --durationSpan-width-long: var(--timer-long-size);
+}
+
+.touch .controlBar {
+ /* Do not delete: these variables are accessed by JavaScript directly.
+ see videocontrols.xml and search for |-width|. */
+ --scrubberStack-width: 84px;
+ --volumeStack-width: 64px;
+}
+
+/*
+ XXX this is needed because of bug 1354501.
+ Can be removed when the bug is fixed, or when we move away from
+ the finish event to the finished promise.
+ (currently behind dom.animations-api.core.enabled)
+*/
+.fadeout {
+ opacity: 0;
+}
+
+.controlsContainer [hidden],
+.controlBar[hidden] {
+ display: none;
+}
+
+.controlBar[size="hidden"] {
+ display: none;
+}
+
+.controlsSpacer[hideCursor] {
+ cursor: none;
+}
+
+.controlsContainer,
+.progressContainer {
+ position: relative;
+ height: 100%;
+}
+
+.stackItem {
+ position: absolute;
+ left: 0;
+ bottom: 0;
+ width: 100%;
+ height: 100%;
+}
+
+.statusOverlay {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ background-color: rgb(80,80,80, .85);
+}
+
+.controlsOverlay {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ position: relative;
+}
+
+.controlsSpacerStack {
+ display: flex;
+ flex-direction: column;
+ flex-grow: 1;
+ justify-content: center;
+ align-items: center;
+}
+
+.controlBar {
+ position: relative;
+ display: flex;
+ box-sizing: border-box;
+ justify-content: center;
+ align-items: center;
+ overflow: hidden;
+ height: 40px;
+ padding: 0 9px;
+ background-color: rgba(26,26,26,.8);
+}
+
+.touch .controlBar {
+ height: 52px;
+}
+
+.controlBar > .button {
+ height: 100%;
+ min-width: var(--button-size);
+ min-height: var(--button-size);
+ padding: 6px;
+ border: 0;
+ margin: 0;
+ background-color: transparent;
+ background-repeat: no-repeat;
+ background-position: center;
+ background-origin: content-box;
+ background-clip: content-box;
+ -moz-context-properties: fill;
+ fill: #ffffff;
+}
+
+.touch .controlBar > .button {
+ background-size: 24px 24px;
+}
+
+.controlBar > .button:hover {
+ fill: #48a0f7;
+}
+
+.controlBar > .button:hover:active {
+ fill: #2d89e6;
+}
+
+.playButton {
+ background-image: url(chrome://global/skin/media/pauseButton.svg);
+}
+.playButton[paused] {
+ background-image: url(chrome://global/skin/media/playButton.svg);
+}
+
+.muteButton {
+ background-image: url(chrome://global/skin/media/audioUnmutedButton.svg);
+}
+.muteButton[muted] {
+ background-image: url(chrome://global/skin/media/audioMutedButton.svg);
+}
+.muteButton[noAudio],
+.muteButton[noAudio]:hover,
+.muteButton[noAudio]:hover:active {
+ background-image: url(chrome://global/skin/media/audioNoAudioButton.svg);
+ fill: white;
+}
+.muteButton[noAudio] + .volumeStack {
+ display: none;
+}
+
+.castingButton {
+ background-image: url(chrome://global/skin/media/castingButton-ready.svg);
+}
+
+.castingButton[enabled] {
+ background-image: url(chrome://global/skin/media/castingButton-active.svg);
+}
+
+.closedCaptionButton {
+ background-image: url(chrome://global/skin/media/closedCaptionButton-cc-off.svg);
+}
+.closedCaptionButton[enabled] {
+ background-image: url(chrome://global/skin/media/closedCaptionButton-cc-on.svg);
+}
+
+.fullscreenButton {
+ background-image: url(chrome://global/skin/media/fullscreenEnterButton.svg);
+}
+.fullscreenButton[fullscreened] {
+ background-image: url(chrome://global/skin/media/fullscreenExitButton.svg);
+}
+
+.controlBarSpacer {
+ flex-grow: 1;
+}
+
+.volumeControl::-moz-range-thumb,
+.scrubber::-moz-range-thumb {
+ height: var(--thumb-size);
+ width: var(--thumb-size);
+ border: none;
+ border-radius: 50%;
+ background-color: #ffffff;
+ filter: drop-shadow(0px 0px 2px rgba(0,0,0,0.65));
+}
+
+.volumeControl::-moz-focus-outer,
+.scrubber::-moz-focus-outer {
+ border: 0;
+}
+
+.progressBackgroundBar {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.progressStack {
+ position: relative;
+ width: 100%;
+ height: var(--track-size);
+}
+
+.scrubberStack {
+ /* minus margin to get basis of required width */
+ min-width: calc(var(--scrubberStack-width) - 18px);
+ flex-basis: calc(var(--scrubberStack-width) - 18px);
+ flex-grow: 2;
+ flex-shrink: 0;
+ margin: 0 9px;
+}
+
+.volumeStack {
+ max-width: 60px;
+ min-width: var(--volumeStack-width);
+ flex-grow: 1;
+ flex-shrink: 0;
+ margin-right: 6px;
+ margin-left: 4px;
+}
+
+.bufferBar,
+.progressBar,
+.scrubber,
+.volumeBackground,
+.volumeControl {
+ bottom: 0;
+ left: 0;
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ padding: 0;
+ border: 0;
+ border-radius: calc(var(--track-size) / 2);
+ margin: 0;
+ background: none;
+ background-color: transparent;
+}
+
+.bufferBar,
+.volumeBackground {
+ background-color: rgba(0,0,0,0.7);
+}
+
+.bufferBar::-moz-progress-bar,
+.progressBar::-moz-progress-bar,
+.volumeBackground::-moz-meter-bar {
+ height: 100%;
+ padding: 0;
+ margin: 0;
+ border: 0;
+ border-radius: calc(var(--track-size) / 2);
+ background: none;
+}
+
+.scrubber:hover::-moz-range-thumb,
+.volumeControl:hover::-moz-range-thumb {
+ background-color: #48a0f7;
+}
+
+.scrubber:active::-moz-range-thumb,
+.volumeControl:active::-moz-range-thumb {
+ background-color: #2d89e6;
+}
+
+.scrubber::-moz-range-track,
+.scrubber::-moz-range-progress {
+ background-color: transparent;
+}
+
+.volumeControl::-moz-range-progress,
+.volumeControl::-moz-range-track {
+ height: var(--track-size);
+ border-radius: calc(var(--track-size) / 2);
+}
+
+.volumeControl::-moz-range-progress {
+ background-color: #ffffff;
+}
+
+.volumeControl::-moz-range-track {
+ background-color: rgba(0,0,0,0.7);
+}
+
+
+.bufferBar::-moz-progress-bar {
+ background-color: rgba(255,255,255,0.3);
+ border-radius: calc(var(--track-size) / 2);
+}
+
+.progressBar::-moz-progress-bar {
+ background-color: #00b6f0;
+}
+
+.textTrackList {
+ position: absolute;
+ right: 5px;
+ bottom: 45px;
+ max-width: 80%;
+ border: 1px solid #000000;
+ border-radius: 2.5px;
+ padding: 5px 0;
+ vertical-align: middle;
+ background-color: #000000;
+ opacity: 0.7;
+}
+
+.touch .textTrackList {
+ bottom: 58px;
+}
+
+.textTrackList > .textTrackItem {
+ display: block;
+ width: 100%;
+ height: var(--button-size);
+ font-size: var(--label-font-size);
+ padding: 2px 10px;
+ border: none;
+ margin: 0;
+ white-space: nowrap;
+ overflow: hidden;
+ text-align: left;
+ text-overflow: ellipsis;
+ color: #ffffff;
+ background-color: transparent;
+}
+
+.textTrackList > .textTrackItem:hover {
+ background-color: #444444;
+}
+
+.textTrackList > .textTrackItem[on] {
+ color: #48a0f7;
+}
+
+.positionLabel,
+.durationLabel {
+ display: none;
+}
+
+.positionDurationBox {
+ text-align: center;
+ padding-inline-start: 1px;
+ padding-inline-end: 9px;
+ white-space: nowrap;
+ font: message-box;
+ font-size: var(--label-font-size);
+ font-size-adjust: 0.55;
+ color: #ffffff;
+}
+
+.positionDurationBox {
+ font-size-adjust: unset;
+ font-family: "Helvetica Neue", "Helvetica", sans-serif;
+}
+
+.duration {
+ display: inline-block;
+ white-space: pre;
+ color: #929292;
+}
+
+.statusIcon {
+ width: 36px;
+ height: 36px;
+ margin-bottom: 20px;
+}
+
+/* Not showing the throbber on mobile because of conflict with m.youtube.com (see bug 1289412) */
+.controlsContainer:not(.mobile) .statusIcon[type="throbber"] {
+ background: url(chrome://global/skin/media/throbber.png) no-repeat center;
+}
+
+.controlsContainer:not(.mobile) .statusIcon[type="throbber"][stalled] {
+ background: url(chrome://global/skin/media/stalled.png) no-repeat center;
+}
+
+.statusIcon[type="error"] {
+ min-width: 70px;
+ min-height: 60px;
+ background: url(chrome://global/skin/media/error.png) no-repeat center;
+ background-size: contain;
+}
+
+/* Overlay Play button */
+.clickToPlay {
+ min-width: var(--clickToPlay-size);
+ min-height: var(--clickToPlay-size);
+ border-radius: 50%;
+ background-image: url(chrome://global/skin/media/playButton.svg);
+ background-repeat: no-repeat;
+ background-position: 54% 50%;
+ background-size: 40% 40%;
+ background-color: #1a1a1a;
+ -moz-context-properties: fill;
+ fill: #ffffff;
+ opacity: 0.8;
+ position: relative;
+ top: 20px;
+}
+
+.controlsSpacerStack:hover > .clickToPlay,
+.clickToPlay:hover {
+ opacity: 0.55;
+}
+
+.controlsSpacerStack:hover > .clickToPlay[fadeout] {
+ opacity: 0;
+}
+
+.controlBar[fullscreen-unavailable] .fullscreenButton {
+ display: none;
+}
+
+.statusOverlay[fadeout],
+.statusOverlay[error] + .controlsOverlay > .controlsSpacerStack {
+ opacity: 0;
+}
+
+/* Error description formatting */
+.errorLabel {
+ padding: 0 10px;
+ text-align: center;
+ font: message-box;
+ font-size: 14px;
+ color: #ffffff;
+}
+
+.errorLabel {
+ display: none;
+}
+
+[error="errorAborted"] > [anonid="errorAborted"],
+[error="errorNetwork"] > [anonid="errorNetwork"],
+[error="errorDecode"] > [anonid="errorDecode"],
+[error="errorSrcNotSupported"] > [anonid="errorSrcNotSupported"],
+[error="errorNoSource"] > [anonid="errorNoSource"],
+[error="errorGeneric"] > [anonid="errorGeneric"] {
+ display: inline;
+}
+ </style>
<div anonid="controlsContainer" class="controlsContainer" role="none">
<div anonid="statusOverlay" class="statusOverlay stackItem" hidden="true">
<div anonid="statusIcon" class="statusIcon"></div>
<span class="errorLabel" anonid="errorAborted">&error.aborted;</span>
<span class="errorLabel" anonid="errorNetwork">&error.network;</span>
<span class="errorLabel" anonid="errorDecode">&error.decode;</span>
<span class="errorLabel" anonid="errorSrcNotSupported">&error.srcNotSupported;</span>
<span class="errorLabel" anonid="errorNoSource">&error.noSource2;</span>