chromium/third_party/blink/web_tests/fast/events/touch/layout-triggers.html

<!DOCTYPE html>
<style>
#box {
    position: absolute;
}
</style>
<div id=box></div>
<script src="../../../resources/js-test.js"></script>
<script>
description("Check which type of events trigger layout when it's dirty.  Events that do a hit-test must update layout, but all other events shouldn't need to.");

var counter = 10;
function triggersLayout(action) {
    // Dirty layout
    box.style.height = counter + 'px';
    counter++;
    internals.updateStyleAndReturnAffectedElementCount();
    shouldNotBe('internals.needsLayoutCount()', '0', true);

    // Run the action under test
    action();

    return (internals.needsLayoutCount() == 0);
}

var triggeredLayout;
var jsTestIsAsync = true;

onload = function() {
    var targetX = 5;
    var targetY = 5;
    setPrintTestResultsLazily();
    eventSender.forceLayoutOnEvents = false;

    // EventHandler::hitTestResultAtPoint exits early when the first layout has not yet occurred.
    debug('Forcing initial layout');
    document.body.offsetTop;
    shouldBeZero('internals.needsLayoutCount()');

    debug('Sending touchstart');
    triggeredLayout = triggersLayout(function() {
        eventSender.addTouchPoint(targetX, targetY);
        eventSender.touchStart();
    });
    shouldBeTrue('triggeredLayout');

    debug('Sending touchmove');
    triggeredLayout = triggersLayout(function() {
        eventSender.updateTouchPoint(0, targetX + 1, targetY);
        eventSender.touchStart();
    });
    shouldBeFalse('triggeredLayout');

    debug('Sending touchend');
    triggeredLayout = triggersLayout(function() {
        eventSender.releaseTouchPoint(0);
        eventSender.touchEnd();
    });
    shouldBeFalse('triggeredLayout');

    debug('Sending GestureTapDown');
    triggeredLayout = triggersLayout(function() {
        eventSender.gestureTapDown(targetX, targetY);
    });
    shouldBeTrue('triggeredLayout');

    debug('Sending GestureShowPress');
    triggeredLayout = triggersLayout(function() {
        eventSender.gestureShowPress(targetX, targetY);
    });
    shouldBeTrue('triggeredLayout');

    finishJSTest();
}

</script>