Bug 1546362 - Avoid strange white border when switching focus to and from the Picture-in-Picture player window. r=dthayer
authorMike Conley <mconley@mozilla.com>
Mon, 06 May 2019 20:46:16 +0000
changeset 531601 818f9fcee08eafbce5f298634327da6f023ad11e
parent 531600 0762225c24094c033013ab87c6574c4a0f1a39bd
child 531602 93e59a14b907071d2059c66f8391ed6c0904ca3c
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdthayer
bugs1546362, 1549542
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1546362 - Avoid strange white border when switching focus to and from the Picture-in-Picture player window. r=dthayer I'm not 100% sure why this fixes the issue, but I suspect it's because we used to set chromemargin on the window _after_ it had had a chance to lay itself out. It seems we can sidestep the issue by putting the chromemargin on the <html> node directly. There's the remaining issue where due to rounding, sometimes a very thin (1px) white border will be displayed around one part of the player window. This has been split out to bug 1549542. Differential Revision: https://phabricator.services.mozilla.com/D30100
toolkit/components/pictureinpicture/content/player.js
toolkit/components/pictureinpicture/content/player.xhtml
--- a/toolkit/components/pictureinpicture/content/player.js
+++ b/toolkit/components/pictureinpicture/content/player.js
@@ -3,17 +3,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const {PictureInPicture} = ChromeUtils.import("resource://gre/modules/PictureInPicture.jsm");
 
 // Time to fade the Picture-in-Picture video controls after first opening.
 const CONTROLS_FADE_TIMEOUT = 3000;
 
 async function setupPlayer(originatingBrowser, videoData) {
-  window.windowUtils.setChromeMargin(0, 0, 0, 0);
   let holder = document.querySelector(".player-holder");
   let browser = document.getElementById("browser");
   browser.remove();
 
   browser.setAttribute("nodefaultsrc", "true");
   browser.sameProcessAsFrameLoader = originatingBrowser.frameLoader;
   holder.appendChild(browser);
 
--- a/toolkit/components/pictureinpicture/content/player.xhtml
+++ b/toolkit/components/pictureinpicture/content/player.xhtml
@@ -3,17 +3,18 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 <!DOCTYPE html [
   <!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
   %htmlDTD;
 ]>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-      windowtype="Toolkit:PictureInPicture">
+      windowtype="Toolkit:PictureInPicture"
+      chromemargin="0,0,0,0">
   <head>
     <meta charset="utf-8"/>
     <link rel="stylesheet" type="text/css"
           href="chrome://global/skin/pictureinpicture/player.css"/>
     <script src="chrome://global/content/pictureinpicture/player.js"></script>
   </head>
 
   <body>