summaryrefslogtreecommitdiffstats
path: root/layout/base/tests/transformed_scrolling_repaints_3_window.html
blob: 26ea43eecddd84bc90271e42752dc750d0732956 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE HTML>
<html>
<head>
  <title>Test that scaled elements with scrolled contents don't repaint unnecessarily when we scroll inside them</title>
  <script type="text/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
</head>
<!-- Need a timeout here to allow paint unsuppression before we start the test -->
<body onload="setTimeout(startTest,0)" style="background:white;">
<iframe id="t" style="-moz-transform: scale(0.48979); -moz-transform-origin:top left; width:500px; height:600px;"
        src="data:text/html,
<body style='background:yellow;'>
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that 
there are some real dicks out there, and some of them happen to be 
scientists.
<p id='e'>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that 
there are some real dicks out there, and some of them happen to be 
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that 
there are some real dicks out there, and some of them happen to be 
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that 
there are some real dicks out there, and some of them happen to be 
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that 
there are some real dicks out there, and some of them happen to be 
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that 
there are some real dicks out there, and some of them happen to be 
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that 
there are some real dicks out there, and some of them happen to be 
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that 
there are some real dicks out there, and some of them happen to be 
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that 
there are some real dicks out there, and some of them happen to be 
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that 
there are some real dicks out there, and some of them happen to be 
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that 
there are some real dicks out there, and some of them happen to be 
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that 
there are some real dicks out there, and some of them happen to be 
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that 
there are some real dicks out there, and some of them happen to be 
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that 
there are some real dicks out there, and some of them happen to be 
scientists.
</body>"></iframe>
<pre id="test">
<script type="application/javascript">
var SimpleTest = window.opener.SimpleTest;
var SpecialPowers = window.opener.SpecialPowers;
var is = window.opener.is;
var t, e, utils, iterations;
var smoothScrollPref = "general.smoothScroll";

function startTest() {
  SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, runTest);
}
function runTest() {
    t = document.getElementById("t");
    e = t.contentDocument.getElementById("e");
    t.contentWindow.scrollTo(0,0);
    utils = SpecialPowers.getDOMWindowUtils(window);
    iterations = 0;

  // Do a couple of scrolls to ensure we've triggered activity heuristics.
    waitForAllPaintsFlushed(function () {
      t.contentWindow.scrollByLines(1);
      waitForAllPaintsFlushed(function () {
        t.contentWindow.scrollByLines(1);
        waitForAllPaintsFlushed(function () {
          // Clear paint state now and scroll again.
          utils.checkAndClearPaintedState(e);
          t.contentWindow.scrollByLines(1);
          waitForAllPaintsFlushed(nextIteration);
        });
      });
    });
}
function nextIteration() {
  var painted = utils.checkAndClearPaintedState(e);
  is(painted, false, "Fully-visible scrolled element should not have been painted");
  if (++iterations == 10) {
    SimpleTest.finish();
    window.close();
  } else {
    t.contentWindow.scrollByLines(1);
    waitForAllPaintsFlushed(nextIteration);
  }
}
</script>
</pre>
</body>
</html>