OLD | NEW |
1 function runNonFastScrollableRegionTest(scale) { | 1 function runNonFastScrollableRegionTest(scale) { |
2 var invScale; | 2 var invScale; |
3 window.internals.settings.setMockScrollbarsEnabled(true); | 3 window.internals.settings.setMockScrollbarsEnabled(true); |
4 if (scale != undefined) { | 4 if (scale != undefined) { |
5 window.internals.setPageScaleFactor(scale, 0, 0); | 5 if (window.eventSender) |
| 6 eventSender.setPageScaleFactor(scale, 0, 0); |
6 // FIXME: This is a hack for applyPageScaleFactorInCompositor() == false
. | 7 // FIXME: This is a hack for applyPageScaleFactorInCompositor() == false
. |
7 invScale = 1 / scale; | 8 invScale = 1 / scale; |
8 } else { | 9 } else { |
9 invScale = 1; | 10 invScale = 1; |
10 } | 11 } |
11 | 12 |
12 var overlay = document.createElement("div"); | 13 var overlay = document.createElement("div"); |
13 overlay.style.position = "absolute"; | 14 overlay.style.position = "absolute"; |
14 overlay.style.left = 0; | 15 overlay.style.left = 0; |
15 overlay.style.top = 0; | 16 overlay.style.top = 0; |
16 overlay.style.opacity = 0.5; | 17 overlay.style.opacity = 0.5; |
17 | 18 |
18 var rects = window.internals.nonFastScrollableRects(document); | 19 var rects = window.internals.nonFastScrollableRects(document); |
19 for (var i = 0; i < rects.length; i++) { | 20 for (var i = 0; i < rects.length; i++) { |
20 var rect = rects[i]; | 21 var rect = rects[i]; |
21 var patch = document.createElement("div"); | 22 var patch = document.createElement("div"); |
22 patch.style.position = "absolute"; | 23 patch.style.position = "absolute"; |
23 patch.style.backgroundColor = "#00ff00"; | 24 patch.style.backgroundColor = "#00ff00"; |
24 patch.style.left = rect.left * invScale + "px"; | 25 patch.style.left = rect.left * invScale + "px"; |
25 patch.style.top = rect.top * invScale + "px"; | 26 patch.style.top = rect.top * invScale + "px"; |
26 patch.style.width = rect.width * invScale + "px"; | 27 patch.style.width = rect.width * invScale + "px"; |
27 patch.style.height = rect.height * invScale + "px"; | 28 patch.style.height = rect.height * invScale + "px"; |
28 | 29 |
29 overlay.appendChild(patch); | 30 overlay.appendChild(patch); |
30 } | 31 } |
31 | 32 |
32 document.body.appendChild(overlay); | 33 document.body.appendChild(overlay); |
33 } | 34 } |
34 | 35 |
OLD | NEW |