Bug 937429 - Only resize the media element if isAudioOnly=true. r=dolske

This commit is contained in:
Jared Wein 2013-11-21 19:42:23 -05:00
parent be1ec20396
commit 40e1321353
3 changed files with 68 additions and 4 deletions

View File

@ -5,12 +5,13 @@
MOCHITEST_FILES = \
tree_shared.js \
test_audiocontrols_dimensions.html \
test_mousecapture_area.html \
test_videocontrols.html \
test_videocontrols_audio.html \
test_videocontrols_video_direction.html \
test_videocontrols_audio_direction.html \
test_audiocontrols_dimensions.html \
test_videocontrols_standalone.html \
test_videocontrols_video_direction.html \
videocontrols_direction-1-ref.html \
videocontrols_direction-1a.html \
videocontrols_direction-1b.html \

View File

@ -0,0 +1,58 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Video controls test</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<pre id="test">
<script class="testbody" type="text/javascript">
const videoWidth = 320;
const videoHeight = 240;
function getMediaElement(aWindow) {
return aWindow.document.getElementsByTagName("video")[0];
}
var popup = window.open("seek_with_sound.ogg");
popup.addEventListener("loadedmetadata", function onLoadedMetaData() {
popup.removeEventListener("loadedmetadata", onLoadedMetaData);
var video = getMediaElement(popup);
runTestVideo(video);
});
function runTestVideo(aVideo) {
var boundingRect = aVideo.getBoundingClientRect();
is(boundingRect.width, videoWidth, "Width of the video should match expectation");
is(boundingRect.height, videoHeight, "Height of video should match expectation");
popup.close();
runTestAudioPre();
}
function runTestAudioPre() {
popup = window.open("audio.ogg");
popup.addEventListener("loadedmetadata", function onLoadedMetaData() {
popup.removeEventListener("loadedmetadata", onLoadedMetaData);
var audio = getMediaElement(popup);
runTestAudio(audio);
});
}
function runTestAudio(aAudio) {
var boundingRect = aAudio.getBoundingClientRect();
is(boundingRect.height, 28, "Height of audio element should be 28, which is equal to the controls bar.");
popup.close();
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>

View File

@ -344,8 +344,13 @@
this._isAudioOnly = val;
if (!this.isTopLevelSyntheticDocument)
return;
this.video.style.height = this._controlBarHeight + "px";
this.video.style.width = "66%";
if (this._isAudioOnly) {
this.video.style.height = this._controlBarHeight + "px";
this.video.style.width = "66%";
} else {
this.video.style.removeProperty("height");
this.video.style.removeProperty("width");
}
},
suppressError : false,