Bug 1452342 - Toggle cursor visibility correctly in video fullscreen mode r=Gijs
authorTimothy Guan-tin Chien <timdream@gmail.com>
Mon, 09 Apr 2018 13:00:15 +0800
changeset 412400 ea27d33d3920029535a838bbfda2d5af7306c358
parent 412399 eebb8d4e91d11e48440a87cfd15e5d20fef304af
child 412401 c61caf7df6c7b6a780ba7ba6fcbc315187e29b54
push id33803
push userapavel@mozilla.com
push dateMon, 09 Apr 2018 21:54:49 +0000
treeherdermozilla-central@bbaa0e5f393c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1452342
milestone61.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 1452342 - Toggle cursor visibility correctly in video fullscreen mode r=Gijs MozReview-Commit-ID: K3a40Q4hgZb
toolkit/content/tests/widgets/test_videocontrols.html
toolkit/content/widgets/videocontrols.xml
--- a/toolkit/content/tests/widgets/test_videocontrols.html
+++ b/toolkit/content/tests/widgets/test_videocontrols.html
@@ -101,17 +101,24 @@ async function waitForEvent(...eventType
 
   await new Promise((resolve, reject) => expectingEventPromise = {resolve, reject}).catch(e => {
     // Throw error here to get the caller in error stack.
     ok(false, e);
   });
 }
 
 add_task(async function setup() {
-  await SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]});
+  await SpecialPowers.pushPrefEnv({
+      "set": [
+        ["media.cache_size", 40000],
+        ["full-screen-api.enabled", true],
+        ["full-screen-api.allow-trusted-requests-only", false],
+        ["full-screen-api.transition-duration.enter", "0 0"],
+        ["full-screen-api.transition-duration.leave", "0 0"]
+      ]});
   await new Promise(resolve => {
     video.addEventListener("canplaythrough", resolve, {once: true});
     video.src = "seek_with_sound.ogg";
   });
 
   video.addEventListener("play", verifyExpectedEvent);
   video.addEventListener("pause", verifyExpectedEvent);
   video.addEventListener("volumechange", verifyExpectedEvent);
@@ -373,12 +380,34 @@ add_task(async function click_event_disp
 // Bug 1367194: Always ensure video is paused before finishing the test.
 add_task(async function ensure_video_pause() {
   if (!video.paused) {
     video.pause();
     await waitForEvent("pause");
   }
 });
 
+// Bug 1452342: Make sure the cursor hides and shows on full screen mode.
+add_task(async function ensure_fullscreen_cursor() {
+  video.removeAttribute("mozNoDynamicControls");
+  video.play();
+  await waitForEvent("play");
+
+  video.mozRequestFullScreen();
+  await waitForEvent("mozfullscreenchange");
+
+  const controlsSpacer = getAnonElementWithinVideoByAttribute(video, "anonid", "controlsSpacer");
+  is(controlsSpacer.hasAttribute("hideCursor"), true, "Cursor is hidden");
+
+  // Wiggle the mouse a bit
+  synthesizeMouse(video, playButtonCenterX, playButtonCenterY, { type: "mousemove" });
+
+  is(controlsSpacer.hasAttribute("hideCursor"), false, "Cursor is shown");
+
+  // Restore
+  video.setAttribute("mozNoDynamicControls", "");
+  document.mozCancelFullScreen();
+});
+
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -1188,16 +1188,20 @@
             return;
           }
 
           // No need to fade in again if the element is visible and not fading out
           if (!element.hidden && !element.classList.contains("fadeout")) {
             return;
           }
 
+          if (element == this.controlBar) {
+            this.controlsSpacer.removeAttribute("hideCursor");
+          }
+
           // Unhide
           element.hidden = false;
         } else {
           // No need to fade out if the element is already no visible.
           if (element.hidden) {
             return;
           }