OLD | NEW |
---|---|
1 // setMockScrollbarsEnabled doesn't actually invalidate scrollbars | 1 // setMockScrollbarsEnabled doesn't actually invalidate scrollbars |
2 // so if we don't set it immediately, they won't repaint/relayout | 2 // so if we don't set it immediately, they won't repaint/relayout |
3 // correctly! http://crbug.com/365509 | 3 // correctly! http://crbug.com/365509 |
4 if (window.internals) | 4 if (window.internals) |
5 window.internals.settings.setMockScrollbarsEnabled(true); | 5 window.internals.settings.setMockScrollbarsEnabled(true); |
6 | 6 |
7 // Draws green overlays for non-fast scrollable regions. This provides a visual | 7 // Draws green overlays for non-fast scrollable regions. This provides a visual |
8 // feedback that is useful when running the test interactively. | 8 // feedback that is useful when running the test interactively. |
9 function drawNonFastScrollableRegionOverlays() { | 9 function drawNonFastScrollableRegionOverlays() { |
10 var overlay = document.createElement("div"); | 10 var overlay = document.createElement("div"); |
(...skipping 16 matching lines...) Expand all Loading... | |
27 overlay.appendChild(patch); | 27 overlay.appendChild(patch); |
28 } | 28 } |
29 | 29 |
30 document.body.appendChild(overlay); | 30 document.body.appendChild(overlay); |
31 } | 31 } |
32 | 32 |
33 function rectToString(rect) { | 33 function rectToString(rect) { |
34 return '[' + [rect.left, rect.top, rect.width, rect.height].join(', ') + ']' ; | 34 return '[' + [rect.left, rect.top, rect.width, rect.height].join(', ') + ']' ; |
35 } | 35 } |
36 | 36 |
37 function sortRects(rects) { | |
38 Array.prototype.sort.call(rects, (a, b) => { | |
skobes
2017/01/28 02:00:04
I thought of an easier way :)
Array.prototype.sor
| |
39 return [ | |
40 a.height - b.height, a.width - b.width, a.top - b.top, a.left - b.left | |
41 ].reduce((acc, val) => val || acc, 0); | |
42 }); | |
43 return rects; | |
44 } | |
OLD | NEW |