Bug 1347673 - Visibility state of extra video control buttons should be recalculated each time the video controls are adjusted. r=jaws

MozReview-Commit-ID: Lj7kttJ9skU

--HG--
extra : rebase_source : 36c34c64c344b163f09290e656f24f0dd5cb75a0
This commit is contained in:
Ray Lin 2017-03-16 18:19:56 +08:00
Родитель 0dbe2590b3
Коммит 6658469733
4 изменённых файлов: 96 добавлений и 11 удалений

Просмотреть файл

@ -1,2 +1,3 @@
random-if(cocoaWidget) == bug-442419-progressmeter-max.xul bug-442419-progressmeter-max-ref.xul # fails most of the time on Mac because progress meter animates
!= textbox-multiline-default-value.xul textbox-multiline-empty.xul
== videocontrols-dynamically-add-cc.html videocontrols-dynamically-add-cc-ref.html

Просмотреть файл

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<style>
html, body {
margin: 0;
padding: 0;
}
video {
width: 320px;
height: 240px;
}
#mask {
position: absolute;
z-index: 3;
width: 320px;
height: 200px;
background-color: green;
top: 0;
left: 0;
}
</style>
<script>
function addCCToVid(videoElem) {
videoElem.addTextTrack("subtitles", "English", "en");
}
</script>
</head>
<body>
<video id="vid" controls></video>
<div id="mask"></div>
<script>
var vid = document.getElementById("vid");
addCCToVid(vid);
</script>
</body>
</html>

Просмотреть файл

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<style>
html, body {
margin: 0;
padding: 0;
}
video {
width: 320px;
height:240px;
}
#mask {
position: absolute;
z-index: 3;
width: 320px;
height: 200px;
background-color: green;
top: 0;
left: 0;
}
</style>
<script>
function addCCToVid(videoElem) {
videoElem.addTextTrack("subtitles", "English", "en");
}
</script>
</head>
<body>
<video id="vid" controls></video>
<div id="mask"></div>
<script>
function doTest() {
var vid = document.getElementById("vid");
// Videocontrols binding's "addtrack" handler synchronously fires
// "adjustControlSize()" first, and then the layout is ready for
// the reftest snapshot.
vid.textTracks.addEventListener("addtrack", function() {
document.documentElement.removeAttribute("class");
});
addCCToVid(vid);
}
window.addEventListener("MozReftestInvalidate", doTest);
</script>
</body>
</html>

Просмотреть файл

@ -1499,8 +1499,6 @@
return;
}
this.closedCaptionButton.removeAttribute("hidden");
if (this.isClosedCaptionOn()) {
this.closedCaptionButton.setAttribute("enabled", "true");
} else {
@ -1710,15 +1708,9 @@
this.volumeStack
];
if (this.controlBar.hasAttribute("fullscreen-unavailable")) {
this.fullscreenButton.isWanted = false;
}
if (!this.isClosedCaptionAvailable) {
this.closedCaptionButton.isWanted = false;
}
if (this.muteButton.hasAttribute("noAudio")) {
this.volumeStack.isWanted = false;
}
this.fullscreenButton.isWanted = !this.controlBar.hasAttribute("fullscreen-unavailable");
this.closedCaptionButton.isWanted = this.isClosedCaptionAvailable;
this.volumeStack.isWanted = !this.muteButton.hasAttribute("noAudio");
let widthUsed = minControlBarPaddingWidth;
let preventAppendControl = false;