<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true AsyncFrameScrollingEnabled=true ] -->
<html>
<head>
    <script src="../../../resources/ui-helper.js"></script>
    <script src="../../../resources/js-test-pre.js"></script>
    <style>
        body {
            height: 2000px;
        }
        .scroller {
            width: 20%;
            height: 20%;
            overflow: scroll;
            border: 1px solid black;
            padding: 10px;
        }

        #innerDiv {
            height: 600px;
        }
    </style>
    <script>
        if (window.testRunner) {
            testRunner.dumpAsText();
            testRunner.waitUntilDone();
        }

        function documentScrolled()
        {
            debug("UNSUCCESSFUL: keyboard scroll skipped over overflow:scroll region to main document.");
            testRunner.notifyDone();
        }

        function overflowScrolled()
        {
            debug("SUCCESSFUL: keyboard scroll propagated from iframe to parent overflow:scroll region.");
            testRunner.notifyDone();
        }

        async function runTest()
        {
            if (!window.testRunner || !testRunner.runUIScript)
                return;

            var innerFrame = document.getElementById("iframe");
            var overflow = document.getElementById("overflow");

            document.addEventListener("scroll", documentScrolled);
            overflow.addEventListener("scroll", overflowScrolled);
            innerFrame.contentWindow.scrollTo(0,10000);

            // Click inside iframe
            await UIHelper.activateAt(20,20);
            await UIHelper.keyDown("downArrow");
        }
    </script>
</head>
<body onload="runTest()">
    <div class="scroller" id="overflow">
        <iframe class="scroller" id="iframe" srcdoc="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.">
        </iframe>
        <div id="innerDiv"></div>
    </div>
    <script src="../../../../resources/js-test-post.js"></script>
</body>
</html>
