summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-interrupted-scroll.html
blob: 74e78d30b15abe3bf707e63ad28793a43b0986f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html>
<head>
  <style>
    #subframe {
      width: 200px;
      height: 200px;
    }
  </style>
  <script src="../../resources/testharness.js"></script>
  <script src="../../resources/testharnessreport.js"></script>
  <script src="resources/scroll-interruption-test.js"></script>
  <script type="text/javascript">
    function jsScroll(y) {
      var subframe = document.getElementById('subframe');
      subframe.contentWindow.scrollTo({top: y, behavior: 'smooth'});
    }

    function doTest()
    {
      const targets = {y_min: 40, y_mid: 3500, y_max: 7000};
      const innerPoint = {x: 100, y: 100}
      var subframeScrollingElement = document.getElementById('subframe').contentDocument.scrollingElement;
      var scrollInterruptionTest = new SmoothScrollInterruptionTest(subframeScrollingElement,
                                                                    innerPoint,
                                                                    targets,
                                                                    jsScroll);
      scrollInterruptionTest.run();
    }

    window.addEventListener('load', doTest, false);
  </script>
</head>

<body>
  <p>Test that interrupting a smooth scroll on a subframe works with both scroll behaviors and with input</p>
  <iframe id="subframe" src="resources/large-subframe.html"></iframe>
</body>
</html>