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.

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

mercurial