chromium/third_party/blink/web_tests/touchadjustment/disabled-formelements.html

<!DOCTYPE html>
<html>
<head>
    <title>Touch Adjustment : Disabled form elements - bug 92093</title>
    <script src="../resources/js-test.js"></script>
    <script src="resources/touchadjustment.js"></script>
    <style type="text/css">
        #sandbox {
            position: absolute;
            left: 0px;
            top: 0px;
            width: 600px;
            height: 600px;
        }
    </style>
</head>

<body id="body">

<div id=sandbox>
    <form id="form">
        <label for="input1" id="label1">Label</label> <input type="text" id="input1" value="Disabled input" disabled></input><br>
        <label for="input2" id="label2">Label</label> <input type="text" id="input2" value="Enabled input"></input>
    </form>
</div>

<p id='description'></p>
<div id='console'></div>

<script>
    // Set up shortcut access to elements
    var e = {};
    ['sandbox', 'form,', 'label1', 'label2', 'input1', 'input2'].forEach(function(a) {
        e[a] = document.getElementById(a);
    });

    function testDirectTouches()
    {
        // Quick sanity check.
        debug('Test we can hit the form elements directly.');

        testTouchPoint(touchPoint(16, 8, 5), null);
        testTouchPoint(touchPoint(16, 38, 5), e.label2);
        testTouchPoint(touchPoint(60, 8, 5), null);
        testTouchPoint(touchPoint(60, 38, 5), e.input2, /* allowTextNodes */ false, /* disallowShadowDOM */ true);
    }

    function testAdjustedTouches()
    {
        debug('Test indirect touches are adjusted to the enabled form elements.');
        testTouchPoint(touchPoint(16, 25, 10), e.label2);
        testTouchPoint(touchPoint(16, 20, 15), e.label2);
        testTouchPoint(touchPoint(16, 16, 20), e.label2);

        testTouchPoint(touchPoint(60, 25, 10), e.input2, /* allowTextNodes */ false, /* disallowShadowDOM */ true);
        testTouchPoint(touchPoint(60, 20, 15), e.input2, /* allowTextNodes */ false, /* disallowShadowDOM */ true);
        testTouchPoint(touchPoint(60, 16, 20), e.input2, /* allowTextNodes */ false, /* disallowShadowDOM */ true);
    }

    function runTests()
    {
        if (window.testRunner && window.internals && internals.touchNodeAdjustedToBestClickableNode) {
            description(document.title);
            testDirectTouches();
            testAdjustedTouches();
            e.sandbox.style.display = 'none';
        }
    }

    runTests();
</script>


</body>
</html>