Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / scroll-behavior / scroll-customization / scrollstate-distribute-to-scroll-chain-descendant.html
blobc1f726fa7c3c5e14001104bc820c4945421c4b9e
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>ScrollState constructor behaves correctly</title>
6 <script src="../../../resources/testharness.js"></script>
7 <script src="../../../resources/testharnessreport.js"></script>
8 </head>
9 <body>
10 <script>
11 test(function() {
12 assert_true('ScrollState' in window, "'ScrollState' in window");
13 // TODO(tdresser): Don't rely on window.internals. See crbug.com/483091 for details.
14 assert_true(window.internals !== null, "'ScrollState' in window");
15 }, "These tests only work with scroll customization enabled.");
17 var elementCount = 10;
18 var remainingNumberOfTimesToBeCalled = elementCount;
20 var distributeScroll = function(scrollState) {
21 this.calledOrder = elementCount - remainingNumberOfTimesToBeCalled;
22 remainingNumberOfTimesToBeCalled--;
23 scrollState.distributeToScrollChainDescendant();
26 var elements = [];
27 for (var i = 0; i < elementCount; ++i) {
28 var element = document.createElement("div");
29 element.creationOrder = i;
30 element.setDistributeScroll(distributeScroll.bind(element), "disable-native-scroll");
31 elements.push(element);
34 if ('ScrollState' in window && window.internals) {
35 test(function() {
36 var scrollState = new ScrollState(100, 0, 0, 0, 0, false, false);
37 window.internals.setScrollChain(scrollState, elements);
38 scrollState.distributeToScrollChainDescendant();
39 assert_equals(0, remainingNumberOfTimesToBeCalled);
40 for (var i = 0; i < elementCount; ++i) {
41 assert_equals(elements[i].creationOrder, elements[i].calledOrder);
43 }, "distributeToScrollChainDescendant propagates correctly.");
45 test(function() {
46 var scrollState = new ScrollState(100, 0, 0, 0, 0, false, false);
47 window.internals.setScrollChain(scrollState, []);
48 assert_equals(0, remainingNumberOfTimesToBeCalled);
49 scrollState.distributeToScrollChainDescendant();
50 assert_equals(0, remainingNumberOfTimesToBeCalled);
51 }, "distributeToScrollChainDescendant with empty scroll chain does nothing.");
53 </script>
54 </body>
55 </html>