Improve interaction of pointer-events with scroll gesture hit testing, scrollability decisions, and overlay scrollbars

* First, this change stops considering pointer-events when deciding
  whether a paint layer is scrollable.  This avoids pointer-events
  having strange effects on decisions about whether to show overlay
  scrollbars.  These strange effects include the backdrop of a <dialog>
  causing the things behind it to become inert (and thus have
  pointer-events: none) and cause overlay scrollbars to spontaneously
  appear.

  This is done by changing a test of
  ComputedStyle::VisibleToHitTesting() to test only
  ComputedStyle::Visibility(), which is one of the two parts of
  VisibleToHitTesting().  This test dates back to
  https://chromium.googlesource.com/chromium/src/+/9de09a320e201ea651b23587850050a67654271f%5E%21/
  and I don't think the pointer-events part of the test makes sense.
  (I'm somewhat suspicious of the visibility part of the test as well,
  although the authors of the tests at
  web_tests/fast/scrolling/scrollable-area-{frame{,-scrolling-no}-visibility-hidden-child,overflow-auto-visibility-hidden{,-in-parent}}.html
  believed in that part at least enough to write 4 tests for it.)  It
  doesn't seem to me that pointer-events (or, really, visibility) should
  affect the result of ScrollsOverflow since it doesn't affect whether
  something can be scrolled programmatically (or, for pointer-events,
  via the keyboard).

  Additionally, this CL then undoes the effect that the above change
  would have on decisions about implicit promotion to the root scroller.

  On Mac (but not Linux), the two added tests show the bug without this
  change, when run in virtual/overlay-scrollbar/, but are fixed by this
  change.

* Second, in order to both fix regressions from the above change and
  fix existing bugs that exist prior to it, this change changes how
  gesture scrolls are targeted when some but not all elements have
  pointer-events: none, so that gesture scrolls are reliably hit tested
  based on the pointer-events values of the elements involved.  In
  particular, it forces a scrollable region that is not visible to hit
  testing to use the main thread hit testing codepath (since it may have
  arbitrary descendants, scrollable or not, that are visible to hit
  testing).  It also adjusts the hit testing of scrollbars themselves to
  match.

  This is needed to avoid regressing
  external/wpt/pointerevents/pointerevent_hit_test_scroll.html on Mac
  only, and to avoid
  pointerevent_hit_test_scroll_visible_descendant.html starting to fail
  again (after being fixed by the first part) on Linux and Windows.  (I
  don't fully understand why the regression in
  pointerevent_hit_test_scroll.html is Mac-only, but I know that on
  Linux, UpdateNonFastScrollableRegion fails to bail out early in some
  cases where on Mac it does bail out early because layer.element_id()
  == scroll_element_id; in these cases, on Linux, layer.element_id() is
  0 while scroll_element_id is not zero.)

* Third, this change also makes virtual/overlay-scrollbar/ and
  virtual/non-overlay-scrollbar/ never expire, because they test
  something that varies based on OS and settings rather than a feature
  being rolled out (e.g., virtual/overlay-scrollbar/ matches the default
  behavior on a Mac, whereas running outside that virtual suite does
  not), and renames the README.txt to README.md to satisfy
  https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/tools/blinkpy/web_tests/lint_test_expectations.py;l=345-348;drc=fdd1781f121a555a8f4b771b970147e1a7ec4876

Fixed: 1414142
Change-Id: Ic26cfb933948bca55e4042ed360ed07692d14a0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4237636
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: Steve Kobes <skobes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1121965}
3 files changed
tree: f88ceec0d606f70f535878c4e76683a37920284f
  1. .github/
  2. .well-known/
  3. accelerometer/
  4. accessibility/
  5. accname/
  6. acid/
  7. ambient-light/
  8. animation-worklet/
  9. annotation-model/
  10. annotation-protocol/
  11. annotation-vocab/
  12. apng/
  13. appmanifest/
  14. attribution-reporting/
  15. audio-output/
  16. autoplay-policy-detection/
  17. avif/
  18. background-fetch/
  19. background-sync/
  20. badging/
  21. battery-status/
  22. beacon/
  23. bluetooth/
  24. browsing-topics/
  25. clear-site-data/
  26. client-hints/
  27. clipboard-apis/
  28. close-watcher/
  29. common/
  30. compat/
  31. compression/
  32. compute-pressure/
  33. conformance-checkers/
  34. console/
  35. contacts/
  36. content-dpr/
  37. content-index/
  38. content-security-policy/
  39. contenteditable/
  40. cookie-store/
  41. cookies/
  42. core-aam/
  43. cors/
  44. credential-management/
  45. css/
  46. custom-elements/
  47. custom-state-pseudo-class/
  48. delegated-ink/
  49. density-size-correction/
  50. deprecation-reporting/
  51. device-memory/
  52. direct-sockets/
  53. docs/
  54. document-picture-in-picture/
  55. document-policy/
  56. dom/
  57. domparsing/
  58. domxpath/
  59. dpub-aam/
  60. dpub-aria/
  61. ecmascript/
  62. editing/
  63. element-timing/
  64. encoding/
  65. encoding-detection/
  66. encrypted-media/
  67. entries-api/
  68. event-timing/
  69. eventsource/
  70. eyedropper/
  71. feature-policy/
  72. fetch/
  73. file-system-access/
  74. FileAPI/
  75. fledge/
  76. focus/
  77. font-access/
  78. fonts/
  79. forced-colors-mode/
  80. fs/
  81. fullscreen/
  82. gamepad/
  83. generic-sensor/
  84. geolocation-API/
  85. geolocation-sensor/
  86. graphics-aam/
  87. gyroscope/
  88. hr-time/
  89. html/
  90. html-longdesc/
  91. html-media-capture/
  92. idle-detection/
  93. imagebitmap-renderingcontext/
  94. images/
  95. import-maps/
  96. IndexedDB/
  97. inert/
  98. infrastructure/
  99. input-device-capabilities/
  100. input-events/
  101. installedapp/
  102. interfaces/
  103. intersection-observer/
  104. intervention-reporting/
  105. is-input-pending/
  106. js/
  107. js-self-profiling/
  108. keyboard-lock/
  109. keyboard-map/
  110. largest-contentful-paint/
  111. layout-instability/
  112. lifecycle/
  113. loading/
  114. long-animation-frame/
  115. longtask-timing/
  116. magnetometer/
  117. managed/
  118. mathml/
  119. measure-memory/
  120. media/
  121. media-capabilities/
  122. media-playback-quality/
  123. media-source/
  124. mediacapture-extensions/
  125. mediacapture-fromelement/
  126. mediacapture-handle/
  127. mediacapture-image/
  128. mediacapture-insertable-streams/
  129. mediacapture-record/
  130. mediacapture-region/
  131. mediacapture-streams/
  132. mediasession/
  133. merchant-validation/
  134. mimesniff/
  135. mixed-content/
  136. mst-content-hint/
  137. navigation-api/
  138. navigation-timing/
  139. netinfo/
  140. network-error-logging/
  141. notifications/
  142. old-tests/
  143. orientation-event/
  144. orientation-sensor/
  145. page-lifecycle/
  146. page-visibility/
  147. paint-timing/
  148. parakeet/
  149. payment-handler/
  150. payment-method-basic-card/
  151. payment-method-id/
  152. payment-request/
  153. pending-beacon/
  154. performance-timeline/
  155. periodic-background-sync/
  156. permissions/
  157. permissions-policy/
  158. permissions-request/
  159. permissions-revoke/
  160. picture-in-picture/
  161. png/
  162. pointerevents/
  163. pointerlock/
  164. portals/
  165. preload/
  166. presentation-api/
  167. private-click-measurement/
  168. proximity/
  169. push-api/
  170. quirks/
  171. referrer-policy/
  172. remote-playback/
  173. reporting/
  174. requestidlecallback/
  175. resize-observer/
  176. resource-timing/
  177. resources/
  178. sanitizer-api/
  179. savedata/
  180. scheduler/
  181. screen-capture/
  182. screen-details/
  183. screen-orientation/
  184. screen-wake-lock/
  185. scroll-animations/
  186. scroll-to-text-fragment/
  187. secure-contexts/
  188. secure-payment-confirmation/
  189. selection/
  190. serial/
  191. server-timing/
  192. service-workers/
  193. shadow-dom/
  194. shape-detection/
  195. shared-storage/
  196. signed-exchange/
  197. soft-navigation-heuristics/
  198. speculation-rules/
  199. speech-api/
  200. storage/
  201. storage-access-api/
  202. streams/
  203. subapps/
  204. subresource-integrity/
  205. svg/
  206. svg-aam/
  207. timing-entrytypes-registry/
  208. tools/
  209. top-level-storage-access-api/
  210. touch-events/
  211. trust-tokens/
  212. trusted-types/
  213. ua-client-hints/
  214. uievents/
  215. upgrade-insecure-requests/
  216. url/
  217. urlpattern/
  218. user-timing/
  219. vibration/
  220. video-rvfc/
  221. virtual-keyboard/
  222. visual-viewport/
  223. wai-aria/
  224. wasm/
  225. web-animations/
  226. web-bundle/
  227. web-locks/
  228. web-nfc/
  229. web-otp/
  230. web-share/
  231. webaudio/
  232. webauthn/
  233. webcodecs/
  234. WebCryptoAPI/
  235. webdriver/
  236. webgl/
  237. webgpu/
  238. webhid/
  239. webidl/
  240. webmessaging/
  241. webmidi/
  242. webnn/
  243. webrtc/
  244. webrtc-encoded-transform/
  245. webrtc-extensions/
  246. webrtc-ice/
  247. webrtc-identity/
  248. webrtc-priority/
  249. webrtc-stats/
  250. webrtc-svc/
  251. websockets/
  252. webstorage/
  253. webtransport/
  254. webusb/
  255. webvr/
  256. webvtt/
  257. webxr/
  258. window-placement/
  259. workers/
  260. worklets/
  261. x-frame-options/
  262. xhr/
  263. .azure-pipelines.yml
  264. .gitattributes
  265. .gitignore
  266. .mailmap
  267. .taskcluster.yml
  268. CODE_OF_CONDUCT.md
  269. CODEOWNERS
  270. CONTRIBUTING.md
  271. LICENSE.md
  272. lint.ignore
  273. README.md
  274. wpt
  275. wpt.py
README.md

The web-platform-tests Project

Taskcluster CI Status documentation manifest Python 3

The web-platform-tests Project is a cross-browser test suite for the Web-platform stack. Writing tests in a way that allows them to be run in all browsers gives browser projects confidence that they are shipping software that is compatible with other implementations, and that later implementations will be compatible with their implementations. This in turn gives Web authors/developers confidence that they can actually rely on the Web platform to deliver on the promise of working across browsers and devices without needing extra layers of abstraction to paper over the gaps left by specification editors and implementors.

The most important sources of information and activity are:

  • github.com/web-platform-tests/wpt: the canonical location of the project's source code revision history and the discussion forum for changes to the code
  • web-platform-tests.org: the documentation website; details how to set up the project, how to write tests, how to give and receive peer review, how to serve as an administrator, and more
  • wpt.live: a public deployment of the test suite, allowing anyone to run the tests by visiting from an Internet-enabled browser of their choice
  • wpt.fyi: an archive of test results collected from an array of web browsers on a regular basis
  • Real-time chat room: the wpt:matrix.org matrix channel; includes participants located around the world, but busiest during the European working day.
  • Mailing list: a public and low-traffic discussion list
  • RFCs: a repo for requesting comments on substantial changes that would impact other stakeholders or users; people who work on WPT infra are encouraged to watch the repo.

If you'd like clarification about anything, don't hesitate to ask in the chat room or on the mailing list.

Setting Up the Repo

Clone or otherwise get https://github.com/web-platform-tests/wpt.

Note: because of the frequent creation and deletion of branches in this repo, it is recommended to “prune” stale branches when fetching updates, i.e. use git pull --prune (or git fetch -p && git merge).

Running the Tests

See the documentation website and in particular the system setup for running tests locally.

Command Line Tools

The wpt command provides a frontend to a variety of tools for working with and running web-platform-tests. Some of the most useful commands are:

  • wpt serve - For starting the wpt http server
  • wpt run - For running tests in a browser
  • wpt lint - For running the lint against all tests
  • wpt manifest - For updating or generating a MANIFEST.json test manifest
  • wpt install - For installing the latest release of a browser or webdriver server on the local machine.
  • wpt serve-wave - For starting the wpt http server and the WAVE test runner. For more details on how to use the WAVE test runner see the documentation.

Windows Notes

On Windows wpt commands must be prefixed with python or the path to the python binary (if python is not in your %PATH%).

python wpt [command]

Alternatively, you may also use Bash on Ubuntu on Windows in the Windows 10 Anniversary Update build, then access your windows partition from there to launch wpt commands.

Please make sure git and your text editor do not automatically convert line endings, as it will cause lint errors. For git, please set git config core.autocrlf false in your working tree.

Publication

The master branch is automatically synced to wpt.live and w3c-test.org.

Contributing

Save the Web, Write Some Tests!

Absolutely everyone is welcome to contribute to test development. No test is too small or too simple, especially if it corresponds to something for which you've noted an interoperability bug in a browser.

The way to contribute is just as usual:

  • Fork this repository (and make sure you're still relatively in sync with it if you forked a while ago).
  • Create a branch for your changes: git checkout -b topic.
  • Make your changes.
  • Run ./wpt lint as described above.
  • Commit locally and push that to your repo.
  • Create a pull request based on the above.

Issues with web-platform-tests

If you spot an issue with a test and are not comfortable providing a pull request per above to fix it, please file a new issue. Thank you!