Bug 1430380 - Wait for the next tick after sizemodechange event to apply media feature changes. r?xidorn draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Thu, 01 Feb 2018 10:20:51 +0900
changeset 749885 bcfdf4c957bc84e6664308ae87a5ce954a2feb2f
parent 749874 c783229694e5ed33b553b7825d753aa247844d7f
push id97501
push userhikezoe@mozilla.com
push dateThu, 01 Feb 2018 01:29:05 +0000
reviewersxidorn
bugs1430380
milestone60.0a1
Bug 1430380 - Wait for the next tick after sizemodechange event to apply media feature changes. r?xidorn On Linux, media feature changes is processed after dispatching sizemodechange event, so we need to wait for the next tick before checking style changes that caused by the media feature changes. MozReview-Commit-ID: 2kb0kToXA6e
layout/style/test/chrome/test_display_mode.html
layout/style/test/chrome/test_display_mode_reflow.html
--- a/layout/style/test/chrome/test_display_mode.html
+++ b/layout/style/test/chrome/test_display_mode.html
@@ -59,27 +59,27 @@ add_task(async function() {
 
   shouldApply("all and (display-mode: browser)");
   shouldNotApply("all and (display-mode: fullscreen)");
   shouldNotApply("all and (display-mode: standalone)");
   shouldNotApply("all and (display-mode: minimal-ui)");
 
   // Test entering the OS's fullscreen mode.
   var fullScreenEntered = waitOneEvent(win, "sizemodechange");
-  await promiseNextTick();
   synthesizeKey("VK_F11", {});
   await fullScreenEntered;
+  // Wait for the next tick to apply media feature changes. See bug 1430380.
+  await promiseNextTick();
   shouldApply("all and (display-mode: fullscreen)");
   shouldNotApply("all and (display-mode: browser)");
   var fullScreenExited = waitOneEvent(win, "sizemodechange");
-  // Need to wait for the next tick to to avoid nested fullscreen change
-  // in different direction. See bug 1415781.
-  await promiseNextTick();
   synthesizeKey("VK_F11", {});
   await fullScreenExited;
+  // Wait for the next tick to apply media feature changes. See bug 1430380.
+  await promiseNextTick();
   shouldNotApply("all and (display-mode: fullscreen)");
   shouldApply("all and (display-mode: browser)");
 
   // Test entering fullscreen through document requestFullScreen.
   fullScreenEntered = waitOneEvent(document, "mozfullscreenchange");
   document.body.mozRequestFullScreen();
   await fullScreenEntered
   ok(document.mozFullScreenElement, "window entered fullscreen");
--- a/layout/style/test/chrome/test_display_mode_reflow.html
+++ b/layout/style/test/chrome/test_display_mode_reflow.html
@@ -38,26 +38,28 @@ add_task(async function() {
   var bodyComputedStyled = subdoc.defaultView.getComputedStyle(subdoc.body);
   var win = Services.wm.getMostRecentWindow("navigator:browser");
 
   var secondDiv = subdoc.getElementById("b");
   var offsetTop = secondDiv.offsetTop;
 
   // Test entering the OS's fullscreen mode.
   var fullScreenEntered = waitOneEvent(win, "sizemodechange");
-  await promiseNextTick();
   synthesizeKey("VK_F11", {});
   await fullScreenEntered;
+
+  // Wait for the next tick to apply media feature changes. See bug 1430380.
+  await promiseNextTick();
   ok(offsetTop !== secondDiv.offsetTop, "offset top changes");
   var fullScreenExited = waitOneEvent(win, "sizemodechange");
-  // Need to wait for the next tick to to avoid nested fullscreen change
-  // in different direction. See bug 1415781.
-  await promiseNextTick();
   synthesizeKey("VK_F11", {});
   await fullScreenExited;
+
+  // Wait for the next tick to apply media feature changes. See bug 1430380.
+  await promiseNextTick();
   ok(offsetTop === secondDiv.offsetTop, "offset top returns to original value");
 
   offsetTop = secondDiv.offsetTop;
   // Test entering fullscreen through document requestFullScreen.
   fullScreenEntered = waitOneEvent(document, "mozfullscreenchange");
   document.body.mozRequestFullScreen();
   await fullScreenEntered
   ok(offsetTop !== secondDiv.offsetTop, "offset top changes");