8 <script src=
"../../../resources/js-test.js"></script>
10 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.");
13 function triggersLayout(action
) {
15 box
.style
.height
= counter
+ 'px';
17 window
.internals
.updateStyleAndReturnAffectedElementCount();
18 shouldNotBe('internals.needsLayoutCount()', '0', true);
20 // Run the action under test
23 return (internals
.needsLayoutCount() == 0);
27 var jsTestIsAsync
= true;
32 setPrintTestResultsLazily();
33 eventSender
.forceLayoutOnEvents
= false;
35 // EventHandler::hitTestResultAtPoint exits early when the first layout has not yet occurred.
36 debug('Forcing initial layout');
37 document
.body
.offsetTop
;
38 shouldBeZero('internals.needsLayoutCount()');
40 debug('Sending touchstart');
41 triggeredLayout
= triggersLayout(function() {
42 eventSender
.addTouchPoint(targetX
, targetY
);
43 eventSender
.touchStart();
45 shouldBeTrue('triggeredLayout');
47 debug('Sending touchmove');
48 triggeredLayout
= triggersLayout(function() {
49 eventSender
.updateTouchPoint(0, targetX
+ 1, targetY
);
50 eventSender
.touchStart();
52 shouldBeFalse('triggeredLayout');
54 debug('Sending touchend');
55 triggeredLayout
= triggersLayout(function() {
56 eventSender
.releaseTouchPoint(0);
57 eventSender
.touchEnd();
59 shouldBeFalse('triggeredLayout');
61 debug('Sending GestureTapDown');
62 triggeredLayout
= triggersLayout(function() {
63 eventSender
.gestureTapDown(targetX
, targetY
);
65 shouldBeTrue('triggeredLayout');
67 debug('Sending GestureShowPress');
68 triggeredLayout
= triggersLayout(function() {
69 eventSender
.gestureShowPress(targetX
, targetY
);
71 shouldBeTrue('triggeredLayout');
73 debug('Sending GestureScrollBegin');
74 triggeredLayout
= triggersLayout(function() {
75 eventSender
.gestureScrollBegin(targetX
, targetY
);
77 shouldBeTrue('triggeredLayout');
79 debug('Sending GestureScrollUpdate');
80 triggeredLayout
= triggersLayout(function() {
81 eventSender
.gestureScrollUpdate(0, 5);
83 shouldBeTrue('triggeredLayout');
85 debug('Sending GestureScrollEnd');
86 triggeredLayout
= triggersLayout(function() {
87 eventSender
.gestureScrollEnd(0, 5);
89 shouldBeFalse('triggeredLayout');