From 8c78350a930ae5e3db48308338f8717feb6c8964 Mon Sep 17 00:00:00 2001 From: Janvi Bajoria Date: Thu, 14 Apr 2022 19:49:28 +0000 Subject: [PATCH] Bug 1763717 - Updated PiP text-tracks bottom multiplier r=kpatenio Differential Revision: https://phabricator.services.mozilla.com/D143322 --- toolkit/actors/PictureInPictureChild.jsm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/toolkit/actors/PictureInPictureChild.jsm b/toolkit/actors/PictureInPictureChild.jsm index 1ce9e900f1ba..3646e77dd5aa 100644 --- a/toolkit/actors/PictureInPictureChild.jsm +++ b/toolkit/actors/PictureInPictureChild.jsm @@ -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) {