Bug 942411 - Force reflow to trigger MozAfterPaint. r=smaug, a=test-only
authorKan-Ru Chen (???) <kanru@kanru.info>
Fri, 21 Feb 2014 15:57:02 +0800
changeset 182969 70aded42520e99b33c9539b376ac330fb7939657
parent 182968 744c8107734f1624f962757186d1f64069a59d14
child 182970 638b67508a3e70764c4afc2e1c366ce6cf54729f
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, test-only
bugs942411
milestone29.0a2
Bug 942411 - Force reflow to trigger MozAfterPaint. r=smaug, a=test-only
content/html/content/test/test_ignoreuserfocus.html
--- a/content/html/content/test/test_ignoreuserfocus.html
+++ b/content/html/content/test/test_ignoreuserfocus.html
@@ -36,17 +36,17 @@
         var witness = document.createElement("input");
         witness.setAttribute("type", "text");
         var witness2 = document.createElement("input");
         witness2.setAttribute("type", "text");
 
         var iframe = document.createElement("iframe");
         iframe.setAttribute("mozbrowser", "true");
         iframe.setAttribute("ignoreuserfocus", "true");
-        iframe.setAttribute("height", "500px");
+        iframe.setAttribute("height", "300px");
         iframe.setAttribute("src", "file_ignoreuserfocus.html");
 
         iframe.addEventListener('load', function (e) {
           // Get privileged iframe because mozbrowser iframe is not same origin
           // with the parent. We need to access its content through the wrapper.
           var privilegedIframe = SpecialPowers.wrap(iframe);
           privilegedIframe.contentWindow.addEventListener("MozAfterPaint", function afterPaint(e) {
             privilegedIframe.contentWindow.removeEventListener("MozAfterPaint", afterPaint);
@@ -97,17 +97,16 @@
             isnot(document.activeElement, iframe, "[explicit innerIframe.focus()] iframe should not have the focus");
 
             witness.focus();
             synthesizeMouseAtCenter(innerIframe, {}, iframeWindow);
             is(document.activeElement, witness, "[synthesize mouse click inner iframe] witness should have the focus");
 
             // Test the case when iframe contains <area> and .focus()
             // is called and explicit focus using mouse
-            witness.focus();
 
             // Wait for paint to setup frame for area. Currently the area frame
             // map is reset for each paint. If we are in the middle of a paint
             // then the area will not be focusable.
             privilegedIframe.contentWindow.addEventListener("MozAfterPaint", function afterPaintArea(e) {
               privilegedIframe.contentWindow.removeEventListener("MozAfterPaint", afterPaintArea);
               var innerArea = privilegedIframe.contentDocument.getElementsByTagName("area")[0];
               innerArea.focus();
@@ -121,17 +120,22 @@
               witness.focus();
               is(document.activeElement, witness, "witness should have the focus");
               synthesizeKey("VK_TAB", {});
               isnot(document.activeElement, iframe, "[synthesize tab key] iframe should not have the focus");
               is(document.activeElement, witness2, "witness2 should have the focus");
 
               SimpleTest.finish();
             });
+            witness.focus();
+            // force reflow
+            var reflow = iframe.offsetLeft;
           });
+          // force reflow
+          var reflow = iframe.offsetLeft;
         });
 
         document.body.appendChild(witness);
         document.body.appendChild(iframe);
         document.body.appendChild(witness2);
       }
       addEventListener("load", function() {
         SpecialPowers.addPermission("browser", true, document);