Bug 1382218 - Cap the height of <audio> controlBar as well to get rid of endless reflow. r=jaws

MozReview-Commit-ID: A0wukWRE4fM

--HG--
extra : rebase_source : a789a7ee05ce19440421c0d20743f95e3f651985
This commit is contained in:
Ray Lin 2017-07-20 23:14:33 +08:00
Родитель c564ceceb5
Коммит 1154d19e13
4 изменённых файлов: 41 добавлений и 1 удалений

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

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<style>
html, body {
margin: 0;
padding: 0;
}
#wrapper {
padding-top: 20px;
}
</style>
</head>
<body>
<div id="wrapper">
<audio controls></audio>
<div>
</body>

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

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<style>
html, body {
margin: 0;
padding: 0;
}
audio {
padding-top: 20px;
}
</style>
</head>
<body>
<audio controls></audio>
</body>

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

@ -3,3 +3,4 @@ random-if(cocoaWidget||(/^Windows\x20NT\x206\.2/.test(http.oscpu)&&isDebugBuild)
fails-if(styloVsGecko) == videocontrols-dynamically-add-cc.html videocontrols-dynamically-add-cc-ref.html
fails-if(styloVsGecko) == audio-with-bogus-url.html audio-with-bogus-url-ref.html
fails-if(styloVsGecko) == audio-dynamically-change-small-width.html audio-dynamically-change-small-width-ref.html
fails-if(styloVsGecko) == audio-height-with-padding.html audio-height-with-padding-ref.html

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

@ -1680,7 +1680,10 @@
// should fix the dimensions in order not to recursively trigger reflow afterwards.
if (this.video instanceof HTMLAudioElement) {
if (givenHeight) {
this.controlBar.style.height = `${Math.max(givenHeight, this.controlBarMinVisibleHeight)}px`;
// The height of controlBar should be capped with the bounds between controlBarMinHeight
// and controlBarMinVisibleHeight.
let controlBarHeight = Math.max(Math.min(givenHeight, this.controlBarMinHeight), this.controlBarMinVisibleHeight);
this.controlBar.style.height = `${controlBarHeight}px`;
}
this.controlBar.style.width = `${videoWidth - minControlBarPaddingWidth}px`;
return;