Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(672)

Side by Side Diff: LayoutTests/scrollingcoordinator/resources/non-fast-scrollable-region-testing.js

Issue 878573004: Increase reliablity of scorllingcoordinator layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update test expectation Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/scrollingcoordinator/non-fast-scrollable-visibility-change.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 function runNonFastScrollableRegionTest(scale) { 7 // Draws green overlays for non-fast scrollable regions. This provides a visual
8 var invScale; 8 // feedback that is useful when running the test interactively.
9 if (scale != undefined) { 9 function drawNonFastScrollableRegionOverlays() {
10 if (window.eventSender)
11 eventSender.setPageScaleFactor(scale, 0, 0);
12 // FIXME: This is a hack for applyPageScaleFactorInCompositor() == false .
13 invScale = 1 / scale;
14 } else {
15 invScale = 1;
16 }
17
18 var overlay = document.createElement("div"); 10 var overlay = document.createElement("div");
19 overlay.style.position = "absolute"; 11 overlay.style.position = "absolute";
20 overlay.style.left = 0; 12 overlay.style.left = 0;
21 overlay.style.top = 0; 13 overlay.style.top = 0;
22 overlay.style.opacity = 0.5; 14 overlay.style.opacity = 0.5;
23 15
24 var rects = window.internals.nonFastScrollableRects(document); 16 var rects = window.internals.nonFastScrollableRects(document);
25 for (var i = 0; i < rects.length; i++) { 17 for (var i = 0; i < rects.length; i++) {
26 var rect = rects[i]; 18 var rect = rects[i];
27 var patch = document.createElement("div"); 19 var patch = document.createElement("div");
28 patch.style.position = "absolute"; 20 patch.style.position = "absolute";
29 patch.style.backgroundColor = "#00ff00"; 21 patch.style.backgroundColor = "#00ff00";
30 patch.style.left = rect.left * invScale + "px"; 22 patch.style.left = rect.left + "px";
31 patch.style.top = rect.top * invScale + "px"; 23 patch.style.top = rect.top + "px";
32 patch.style.width = rect.width * invScale + "px"; 24 patch.style.width = rect.width + "px";
33 patch.style.height = rect.height * invScale + "px"; 25 patch.style.height = rect.height + "px";
34 26
35 overlay.appendChild(patch); 27 overlay.appendChild(patch);
36 } 28 }
37 29
38 document.body.appendChild(overlay); 30 document.body.appendChild(overlay);
39 } 31 }
40 32
33 // Waits for one RAF call to ensure compositing update has occurred and invokes task.
34 function awaitCompsitingUpdate(task) {
35 window.requestAnimationFrame(task);
36 }
37
38 function rectToString(rect) {
39 return '[' + [rect.left, rect.top, rect.width, rect.height].join(', ') + ']' ;
40 }
41
OLDNEW
« no previous file with comments | « LayoutTests/scrollingcoordinator/non-fast-scrollable-visibility-change.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698