From 8aa3164d53d65f835dc149532a26c7efcd9147f0 Mon Sep 17 00:00:00 2001 From: Jared Wein Date: Thu, 22 Sep 2011 16:19:52 -0700 Subject: [PATCH 1/2] Bug 462117 - Reducing the number of visible controls when the video is too small. r=dolske --- toolkit/content/widgets/videocontrols.css | 15 ++++++++ toolkit/content/widgets/videocontrols.xml | 45 ++++++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/toolkit/content/widgets/videocontrols.css b/toolkit/content/widgets/videocontrols.css index b3ef938fb82..3be9c0dfb26 100644 --- a/toolkit/content/widgets/videocontrols.css +++ b/toolkit/content/widgets/videocontrols.css @@ -53,3 +53,18 @@ .statusOverlay[fadeout] { opacity: 0; } + +.controlBar[size="hidden"], +.controlBar[size="small"] .durationBox, +.controlBar[size="small"] .durationLabel, +.controlBar[size="small"] .positionLabel { + visibility: collapse; +} + +.controlBar[size="small"] .scrubberStack { + visibility: hidden; +} + +.controlBar[size="small"] .scrubberStack > * { + visibility: hidden; +} diff --git a/toolkit/content/widgets/videocontrols.xml b/toolkit/content/widgets/videocontrols.xml index cbbb04ce169..df328670ced 100644 --- a/toolkit/content/widgets/videocontrols.xml +++ b/toolkit/content/widgets/videocontrols.xml @@ -343,6 +343,17 @@ this.statusIcon.setAttribute("type", "throbber"); this.setupStatusFader(); } + + // An event handler for |onresize| should be added when bug 227495 is fixed. + let controlBarWasHidden = this.controlBar.getAttribute("hidden") == "true"; + this.controlBar.removeAttribute("hidden"); + this._playButtonWidth = this.playButton.clientWidth; + this._durationLabelWidth = this.durationLabel.clientWidth; + this._muteButtonWidth = this.muteButton.clientWidth; + this._controlBarHeight = this.controlBar.clientHeight; + if (controlBarWasHidden) + this.controlBar.setAttribute("hidden", "true"); + this.adjustControlSize(); }, get dynamicControls() { @@ -400,6 +411,7 @@ this.volumeControl.value = volume; break; case "loadedmetadata": + this.adjustControlSize(); // If a