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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector-unit/viewport-control.js

Issue 2592483002: [DevTools] Move console viewport to console, rename StaticViewportControl. (Closed)
Patch Set: Created 4 years 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
OLDNEW
1 TestRunner.addResult("This tests if the StaticViewportControl works properly."); 1 TestRunner.addResult("This tests if the ViewportControl works properly.");
2 2
3 var items = []; 3 var items = [];
4 var heights = []; 4 var heights = [];
5 for (var i = 0; i < 100; i++){ 5 for (var i = 0; i < 100; i++){
6 items[i] = document.createElement("div"); 6 items[i] = document.createElement("div");
7 items[i].style.height = (heights[i] = (i % 4) ? 50 : 28) + "px"; 7 items[i].style.height = (heights[i] = (i % 4) ? 50 : 28) + "px";
8 items[i].textContent = i; 8 items[i].textContent = i;
9 } 9 }
10 var viewport = new UI.StaticViewportControl({ 10 var viewport = new UI.ViewportControl({
11 fastItemHeight: i => heights[i], 11 fastItemHeight: i => heights[i],
12 itemCount: _ => items.length, 12 itemCount: _ => items.length,
13 itemElement: i => items[i] 13 itemElement: i => items[i]
14 }); 14 });
15 viewport.element.style.height = "300px"; 15 viewport.element.style.height = "300px";
16 UI.inspectorView.element.appendChild(viewport.element); 16 UI.inspectorView.element.appendChild(viewport.element);
17 17
18 viewport.refresh(); 18 viewport.refresh();
19 dumpViewport(); 19 dumpViewport();
20 20
(...skipping 20 matching lines...) Expand all
41 41
42 TestRunner.completeTest(); 42 TestRunner.completeTest();
43 43
44 function dumpViewport() 44 function dumpViewport()
45 { 45 {
46 TestRunner.addResult("First:" + viewport.firstVisibleIndex()); 46 TestRunner.addResult("First:" + viewport.firstVisibleIndex());
47 TestRunner.addResult("Last:" + viewport.lastVisibleIndex()); 47 TestRunner.addResult("Last:" + viewport.lastVisibleIndex());
48 TestRunner.addResult("Active Items:" + viewport._innerElement.children.lengt h); 48 TestRunner.addResult("Active Items:" + viewport._innerElement.children.lengt h);
49 TestRunner.addResult(""); 49 TestRunner.addResult("");
50 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698