pointerevent_touch-action-inherit_highest-parent-none_touch-manual.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>touch-action: parent: none + two embedded children</title>
  5. <meta name="viewport" content="width=device-width">
  6. <link rel="stylesheet" type="text/css" href="pointerevent_styles.css">
  7. <script src="/resources/testharness.js"></script>
  8. <script src="/resources/testharnessreport.js"></script>
  9. <script src="pointerevent_support.js"></script>
  10. <style>
  11. #divParent {
  12. touch-action: none;
  13. }
  14. </style>
  15. </head>
  16. <body onload="run()">
  17. <h1>Pointer Events touch-action attribute support</h1>
  18. <h4 id="desc">Test Description: Try to scroll text DOWN. Wait for description update. Expected: pan enabled</h4>
  19. <p>Note: this test is for touch-devices only</p>
  20. <div id="divParent">
  21. <div class="scroller" id="target0">
  22. <div>
  23. <p>
  24. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem
  25. nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam erat volutpat.
  26. Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamcorper suscipit
  27. lobortis nisl ut aliquip ex ea commodo consequat.
  28. </p>
  29. <p>Lorem ipsum dolor sit amet...</p>
  30. <p>Lorem ipsum dolor sit amet...</p>
  31. <p>Lorem ipsum dolor sit amet...</p>
  32. <p>Lorem ipsum dolor sit amet...</p>
  33. <p>Lorem ipsum dolor sit amet...</p>
  34. <p>Lorem ipsum dolor sit amet...</p>
  35. <p>Lorem ipsum dolor sit amet...</p>
  36. <p>
  37. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem
  38. nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam erat volutpat.
  39. Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamcorper suscipit
  40. lobortis nisl ut aliquip ex ea commodo consequat.
  41. </p>
  42. <p>Lorem ipsum dolor sit amet...</p>
  43. <p>Lorem ipsum dolor sit amet...</p>
  44. <p>Lorem ipsum dolor sit amet...</p>
  45. <p>Lorem ipsum dolor sit amet...</p>
  46. <p>Lorem ipsum dolor sit amet...</p>
  47. <p>Lorem ipsum dolor sit amet...</p>
  48. <p>Lorem ipsum dolor sit amet...</p>
  49. <p>
  50. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem
  51. nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam erat volutpat.
  52. Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamcorper suscipit
  53. lobortis nisl ut aliquip ex ea commodo consequat.
  54. </p>
  55. <p>Lorem ipsum dolor sit amet...</p>
  56. <p>Lorem ipsum dolor sit amet...</p>
  57. <p>Lorem ipsum dolor sit amet...</p>
  58. <p>Lorem ipsum dolor sit amet...</p>
  59. <p>Lorem ipsum dolor sit amet...</p>
  60. <p>Lorem ipsum dolor sit amet...</p>
  61. <p>Lorem ipsum dolor sit amet...</p>
  62. <p>
  63. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem
  64. nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam erat volutpat.
  65. Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamcorper suscipit
  66. lobortis nisl ut aliquip ex ea commodo consequat.
  67. </p>
  68. <p>Lorem ipsum dolor sit amet...</p>
  69. <p>Lorem ipsum dolor sit amet...</p>
  70. <p>Lorem ipsum dolor sit amet...</p>
  71. <p>Lorem ipsum dolor sit amet...</p>
  72. <p>Lorem ipsum dolor sit amet...</p>
  73. <p>Lorem ipsum dolor sit amet...</p>
  74. <p>Lorem ipsum dolor sit amet...</p>
  75. </div>
  76. </div>
  77. </div>
  78. <script type='text/javascript'>
  79. var detected_pointertypes = {};
  80. var xScrollIsReceived = false;
  81. var yScrollIsReceived = false;
  82. var xScr0, yScr0, xScr1, yScr1;
  83. add_completion_callback(showPointerTypes);
  84. add_completion_callback(enableScrolling);
  85. function run() {
  86. var target0 = document.getElementById("target0");
  87. var test_touchaction = async_test("touch-action attribute test");
  88. xScr0 = target0.scrollLeft;
  89. yScr0 = target0.scrollTop;
  90. on_event(target0, 'pointerdown', function(event) {
  91. detected_pointertypes[event.pointerType] = true;
  92. });
  93. // Check if touch-action attribute works properly for embedded divs
  94. //
  95. // TA: 15.
  96. on_event(target0, 'scroll', function(event) {
  97. xScr1 = target0.scrollLeft;
  98. yScr1 = target0.scrollTop;
  99. if(xScr1 != xScr0) {
  100. xScrollIsReceived = true;
  101. }
  102. if(yScr1 != yScr0) {
  103. yScrollIsReceived = true;
  104. updateDescriptionNextStep();
  105. }
  106. if(xScrollIsReceived && yScrollIsReceived) {
  107. test_touchaction.done();
  108. updateDescriptionComplete();
  109. }
  110. });
  111. }
  112. function enableScrolling() {
  113. document.getElementById('divParent').setAttribute('style', 'touch-action: auto');
  114. }
  115. </script>
  116. <h1>behaviour: auto</h1>
  117. <div id="complete-notice">
  118. <p>The following pointer types were detected: <span id="pointertype-log"></span>.</p>
  119. </div>
  120. <div id="log"></div>
  121. </body>
  122. </html>