<!DOCTYPE html>
<html>
<head>
<script src="../../../../resources/js-test-pre.js"></script>
<script src="resources/gesture-helpers.js"></script>
<style type="text/css">
#touchtarget {
  width: 100px;
  height: 100px;
  background: white;
  overflow:scroll;
}

::-webkit-scrollbar {
    width: 0px;
    height: 0px;
}

#greenbox {
  width: 100px;
  height: 100px;
  background: green;
  padding: 0px;
  margin: 0px;
}

#redbox {
  width: 100px;
  height: 100px;
  background: red;
  padding: 0px;
  margin: 0px;
}

td {
  padding: 0px;
}
</style>
</head>
<body style="margin:0; overflow-y:hidden;" onload="runTest();">

<div id="touchtarget">
  <table border="0" cellspacing="0px" id="tablefoo">
    <tr>
      <td><div id="redbox"></div></td>
      <td><div id="greenbox"></div></td>
    </tr>
    <tr>
      <td><div id="greenbox"></div></td>
      <td><div id="greenbox"></div></td>
    </tr>
  </table>
</div>

<table id="table_to_fill">
    <tr><td><div id="greenbox"></div></td></tr>
    <tr><td><div id="redbox"></div></td></tr>
</table>

<p id="description"></p>
<div id="console"></div>
<script type="text/javascript">

var expectedGesturesTotal = 2;
var gesturesOccurred = 0;
var scrollAmountX = ['0', '0'];
var scrollAmountY = ['0', '0'];
var wheelEventsOccurred = 0;
var expectedWheelEventsOccurred = ['0', '0'];
var scrollEventsOccurred = 0;
var expectedScrollEventsOccurred = '0';
var scrolledElement = 'document.body'

// Always construct a page larger than the vertical height of the window.
function buildPage()
{
    var table = document.getElementById('table_to_fill');
    var targetHeight = document.body.offsetHeight;
    var cellPairHeight = table.offsetHeight;
    var numberOfReps = targetHeight / cellPairHeight * 2;
    var i;
    for (i = 0; i < numberOfReps; i++) {
        var p = document.createElement('tr');
        p.innerHTML = '<td><div id="greenbox"></div></td>';
        table.appendChild(p);
        var p = document.createElement('tr');
        p.innerHTML = '<td><div id="redbox"></div></td>';
        table.appendChild(p);
    }

    window.addEventListener("scroll", recordScroll);
    window.addEventListener("mousewheel", recordWheel);
}

function firstGestureScroll()
{
    debug("first gesture");
    eventSender.gestureScrollBegin(95, 12);
    eventSender.gestureScrollUpdate(0, -100);
    eventSender.gestureScrollUpdate(0, -10);
    eventSender.gestureScrollEnd(0, 0);

    // Wait for layout.
    checkScrollOffset();
}

function secondGestureScroll()
{
    debug("second gesture");
    eventSender.gestureScrollBegin(12, 97);
    eventSender.gestureScrollUpdate(0, -95);
    eventSender.gestureScrollUpdate(0, -200);
    eventSender.gestureScrollEnd(0, 0);

    // Wait for layout.
    checkScrollOffset();

    // In this test we do not expect any scroll events to
    // be received by the event listener, so we signal
    // the end of the test by calling this function instead
    // of relying on recordScroll() to do it.
    finishTest();
}

if (window.testRunner)
    testRunner.waitUntilDone();

function runTest()
{
    buildPage();
    if (window.eventSender) {
        description('This tests that a page cannot be scrolled vertically with touch if its body has style overflow-y:hidden ' +
                    'and the scroll event is propogated from a scrollable child div.');

        if (checkTestDependencies())
            firstGestureScroll();
        else
            exitIfNecessary();
    } else {
        debug("This test requires DumpRenderTree.  Touch scroll the red rect to log.");
    }
}

function finishTest()
{
    if (window.eventSender) {
        if (gesturesOccurred == expectedGesturesTotal) {
            shouldBe('scrollEventsOccurred', expectedScrollEventsOccurred);
            successfullyParsed = true;
            isSuccessfullyParsed();
            if (window.testRunner)
                testRunner.notifyDone();
        }
    }
}
</script>
</body>
</html>
