layout/base/tests/chrome/transformed_scrolling_repaints_3_window.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4   <title>Test that scaled elements with scrolled contents don't repaint unnecessarily when we scroll inside them</title>
     5   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
     6 </head>
     7 <!-- Need a timeout here to allow paint unsuppression before we start the test -->
     8 <body onload="setTimeout(startTest,0)" style="background:white;">
     9 <iframe id="t" style="-moz-transform: scale(0.48979); -moz-transform-origin:top left; width:500px; height:300px;"
    10         src="data:text/html,
    11 <body style='background:yellow;'>
    12 <p>My graduate adviser was the most patient, understanding, and helpful
    13 person I've ever had the joy of dealing with. That doesn't change that 
    14 there are some real dicks out there, and some of them happen to be 
    15 scientists.
    16 <p id='e'>My graduate adviser was the most patient, understanding, and helpful
    17 person I've ever had the joy of dealing with. That doesn't change that 
    18 there are some real dicks out there, and some of them happen to be 
    19 scientists.
    20 <p>My graduate adviser was the most patient, understanding, and helpful
    21 person I've ever had the joy of dealing with. That doesn't change that 
    22 there are some real dicks out there, and some of them happen to be 
    23 scientists.
    24 <p>My graduate adviser was the most patient, understanding, and helpful
    25 person I've ever had the joy of dealing with. That doesn't change that 
    26 there are some real dicks out there, and some of them happen to be 
    27 scientists.
    28 <p>My graduate adviser was the most patient, understanding, and helpful
    29 person I've ever had the joy of dealing with. That doesn't change that 
    30 there are some real dicks out there, and some of them happen to be 
    31 scientists.
    32 <p>My graduate adviser was the most patient, understanding, and helpful
    33 person I've ever had the joy of dealing with. That doesn't change that 
    34 there are some real dicks out there, and some of them happen to be 
    35 scientists.
    36 </body>"></iframe>
    37 <pre id="test">
    38 <script type="application/javascript">
    39 var SimpleTest = window.opener.wrappedJSObject.SimpleTest;
    40 var SpecialPowers = window.opener.wrappedJSObject.SpecialPowers;
    41 var is = window.opener.wrappedJSObject.is;
    43 var smoothScrollPref = "general.smoothScroll";
    44 SpecialPowers.setBoolPref(smoothScrollPref, false);
    46 function startTest() {
    47   var t = document.getElementById("t");
    48   var e = t.contentDocument.getElementById("e");
    49   t.contentWindow.scrollTo(0,0);
    50   var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
    51                  getInterface(Components.interfaces.nsIDOMWindowUtils);
    52   var iterations = 0;
    54   function nextIteration() {
    55     var painted = utils.checkAndClearPaintedState(e);
    56     is(painted, false, "Fully-visible scrolled element should not have been painted");
    57     if (++iterations == 10) {
    58       SpecialPowers.clearUserPref(smoothScrollPref);
    59       SimpleTest.finish();
    60       window.close();
    61     } else {
    62       t.contentWindow.scrollByLines(1);
    63       waitForAllPaintsFlushed(nextIteration);
    64     }
    65   }
    67   // Do a couple of scrolls to ensure we've triggered activity heuristics.
    68   waitForAllPaintsFlushed(function () {
    69     t.contentWindow.scrollByLines(1);
    70     waitForAllPaintsFlushed(function () {
    71       t.contentWindow.scrollByLines(1);
    72       waitForAllPaintsFlushed(function () {
    73         // Clear paint state now and scroll again.
    74         utils.checkAndClearPaintedState(e);
    75         t.contentWindow.scrollByLines(1);
    76         waitForAllPaintsFlushed(nextIteration);
    77       });
    78     });
    79   });
    80 }
    81 </script>
    82 </pre>
    83 </body>
    84 </html>

mercurial