Bug 1763717 - Updated PiP text-tracks bottom multiplier r=kpatenio

Differential Revision: https://phabricator.services.mozilla.com/D143322
This commit is contained in:
Janvi Bajoria 2022-04-14 19:49:28 +00:00
Родитель c51e09a803
Коммит 8c78350a93
1 изменённых файлов: 4 добавлений и 5 удалений

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

@ -80,9 +80,6 @@ const TOGGLE_HIDING_TIMEOUT_MS = 2000;
const SEEK_TIME_SECS = 5;
const EMPTIED_TIMEOUT_MS = 1000;
// If you change bottom position in texttracks.css, also change this
const TEXT_TRACKS_STYLE_BOTTOM_MULTIPLIER = 0.066;
// The ToggleChild does not want to capture events from the PiP
// windows themselves. This set contains all currently open PiP
// players' content windows
@ -1415,6 +1412,9 @@ class PictureInPictureChild extends JSWindowActorChild {
const isReducedMotionEnabled = originatingWindow.matchMedia(
"(prefers-reduced-motion: reduce)"
).matches;
const textTracksFontScale = this.document
.querySelector(":root")
.style.getPropertyValue("--font-scale");
if (isFullscreen || isReducedMotionEnabled) {
textTracks.removeAttribute("overlap-video-controls");
@ -1424,8 +1424,7 @@ class PictureInPictureChild extends JSWindowActorChild {
if (isVideoControlsShowing) {
let playerVideoRect = textTracks.parentElement.getBoundingClientRect();
let isOverlap =
playerVideoRect.bottom -
TEXT_TRACKS_STYLE_BOTTOM_MULTIPLIER * playerVideoRect.height >
playerVideoRect.bottom - textTracksFontScale * playerVideoRect.height >
playerBottomControlsDOMRect.top;
if (isOverlap) {