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

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

Issue 2371393002: DevTools: Add lightweight StaticViewportControl (Closed)
Patch Set: _indexSymbol Created 4 years, 2 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 | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-unit/static-viewport-control-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <base href="/inspector-debug/"></base>
4 <script src="/inspector-debug/Runtime.js"></script>
5 <script src="/inspector-unit/inspector-unit-test.js"></script>
6 <script>
7 function test() {
8 var items = [];
9 var heights = [];
10 for (var i = 0; i < 100; i++){
11 items[i] = document.createElement("div");
12 items[i].style.height = (heights[i] = (i % 4) ? 50 : 28) + "px";
13 items[i].textContent = i;
14 }
15 var viewport = new WebInspector.StaticViewportControl({
16 fastItemHeight: i => heights[i],
17 itemCount: _ => items.length,
18 itemElement: i => items[i]
19 });
20 viewport.element.style.height = "300px";
21 WebInspector.inspectorView.element.appendChild(viewport.element);
22
23 viewport.refresh();
24 dumpViewport();
25
26 viewport.forceScrollItemToBeFirst(26);
27 dumpViewport();
28
29 viewport.scrollItemIntoView(33);
30 dumpViewport();
31
32 viewport.scrollItemIntoView(30);
33 dumpViewport();
34
35 viewport.forceScrollItemToBeFirst(30);
36 dumpViewport();
37
38 viewport.forceScrollItemToBeLast(88);
39 dumpViewport();
40
41 for (var i = 0; i < 100; i++)
42 items[i].style.height = (heights[i] = (i % 2) ? 55 : 63) + "px";
43 viewport.refresh();
44 viewport.forceScrollItemToBeLast(88);
45 dumpViewport();
46
47 UnitTest.completeTest();
48
49 function dumpViewport()
50 {
51 UnitTest.addResult("First:" + viewport.firstVisibleIndex());
52 UnitTest.addResult("Last:" + viewport.lastVisibleIndex());
53 UnitTest.addResult("Active Items:" + viewport._innerElement.children.len gth);
54 UnitTest.addResult("");
55 }
56 }
57 </script>
58 </head>
59 <body>
60 This tests if the StaticViewportControl works properly.
61 </body>
62 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-unit/static-viewport-control-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698