Trim whitespace around CSS custom declarations.

There was a spec change a few years back, requiring us to
strip spaces and comments from the beginning and end of CSS
custom property declarations.

We take a slight performance hit:

Initial style (µs)     Before     After    Perf      95% CI (BCa)
=================== ========= ========= ======= =================
ECommerce               10041      9994   +0.5%  [ +0.1%,  +0.9%]
Encyclopedia           106735    106744   -0.0%  [ -0.6%,  +0.4%]
Extension              132830    133009   -0.1%  [ -0.6%,  +0.2%]
News                    42534     42653   -0.3%  [ -1.0%,  +0.1%]
Search                   2636      2662   -1.0%  [ -1.4%,  -0.6%]
Social1                 23298     23312   -0.1%  [ -0.3%,  +0.2%]
Social2                  1039      1042   -0.3%  [ -1.0%,  +0.4%]
Sports                  42680     42985   -0.7%  [ -1.0%,  -0.5%]
Video                   41971     42134   -0.4%  [ -0.6%,  -0.1%]
Geometric mean                            -0.3%  [ -0.5%,  -0.1%]

Parse (µs)             Before     After    Perf      95% CI (BCa)
=================== ========= ========= ======= =================
ECommerce                1360      1372   -0.9%  [ -1.2%,  -0.4%]
Encyclopedia             7349      7384   -0.5%  [ -0.7%,  -0.2%]
Extension                1349      1352   -0.2%  [ -1.2%,  +0.2%]
News                     7929      7982   -0.7%  [ -1.0%,  -0.3%]
Search                   4965      4997   -0.6%  [ -0.9%,  -0.4%]
Social1                 14752     14837   -0.6%  [ -0.8%,  -0.3%]
Social2                   617       620   -0.4%  [ -1.4%,  +0.7%]
Sports                  56182     56318   -0.2%  [ -0.6%,  +0.0%]
Video                   34720     35091   -1.1%  [ -1.3%,  -0.8%]
Geometric mean                            -0.6%  [ -0.9%,  -0.4%]

Recalc style (µs)      Before     After    Perf      95% CI (BCa)
=================== ========= ========= ======= =================
ECommerce               11417     11378   +0.3%  [ -0.2%,  +0.8%]
Encyclopedia            83808     84066   -0.3%  [ -1.4%,  +0.1%]
Extension              120362    120394   -0.0%  [ -0.7%,  +0.3%]
News                    31566     31549   +0.1%  [ -1.2%,  +0.5%]
Search                    242       242   -0.0%  [ -1.5%,  +0.7%]
Social1                 17242     17203   +0.2%  [ -0.1%,  +0.4%]
Social2                   602       593   +1.4%  [ +0.7%,  +2.1%]
Sports                  22817     22874   -0.3%  [ -0.5%,  +0.0%]
Video                   25931     25969   -0.1%  [ -0.4%,  +0.1%]
Geometric mean                            +0.1%  [ -0.5%,  +0.5%]

We save a little bit of RAM, obviously, but not much.

Fixed: 1211112
Fixed: 1220144
Change-Id: Ib7656de36d6a94d85ba25ecf60e9879b21c36468
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3341633
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Steinar H Gunderson <sesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1116326}
6 files changed
tree: 1b8f7d2923b314fc127816f7aeab4d9f0f25dc44
  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. focus/
  76. font-access/
  77. fonts/
  78. forced-colors-mode/
  79. fs/
  80. fullscreen/
  81. gamepad/
  82. generic-sensor/
  83. geolocation-API/
  84. geolocation-sensor/
  85. graphics-aam/
  86. gyroscope/
  87. hr-time/
  88. html/
  89. html-longdesc/
  90. html-media-capture/
  91. idle-detection/
  92. imagebitmap-renderingcontext/
  93. images/
  94. import-maps/
  95. IndexedDB/
  96. inert/
  97. infrastructure/
  98. input-device-capabilities/
  99. input-events/
  100. installedapp/
  101. interfaces/
  102. intersection-observer/
  103. intervention-reporting/
  104. is-input-pending/
  105. js/
  106. js-self-profiling/
  107. keyboard-lock/
  108. keyboard-map/
  109. largest-contentful-paint/
  110. layout-instability/
  111. lifecycle/
  112. loading/
  113. long-animation-frame/
  114. longtask-timing/
  115. magnetometer/
  116. managed/
  117. mathml/
  118. measure-memory/
  119. media/
  120. media-capabilities/
  121. media-playback-quality/
  122. media-source/
  123. mediacapture-extensions/
  124. mediacapture-fromelement/
  125. mediacapture-handle/
  126. mediacapture-image/
  127. mediacapture-insertable-streams/
  128. mediacapture-record/
  129. mediacapture-region/
  130. mediacapture-streams/
  131. mediasession/
  132. merchant-validation/
  133. mimesniff/
  134. mixed-content/
  135. mst-content-hint/
  136. navigation-api/
  137. navigation-timing/
  138. netinfo/
  139. network-error-logging/
  140. notifications/
  141. old-tests/
  142. orientation-event/
  143. orientation-sensor/
  144. page-lifecycle/
  145. page-visibility/
  146. paint-timing/
  147. parakeet/
  148. payment-handler/
  149. payment-method-basic-card/
  150. payment-method-id/
  151. payment-request/
  152. pending-beacon/
  153. performance-timeline/
  154. periodic-background-sync/
  155. permissions/
  156. permissions-policy/
  157. permissions-request/
  158. permissions-revoke/
  159. picture-in-picture/
  160. png/
  161. pointerevents/
  162. pointerlock/
  163. portals/
  164. preload/
  165. presentation-api/
  166. private-click-measurement/
  167. proximity/
  168. push-api/
  169. quirks/
  170. referrer-policy/
  171. remote-playback/
  172. reporting/
  173. requestidlecallback/
  174. resize-observer/
  175. resource-timing/
  176. resources/
  177. sanitizer-api/
  178. savedata/
  179. scheduler/
  180. screen-capture/
  181. screen-details/
  182. screen-orientation/
  183. screen-wake-lock/
  184. scroll-animations/
  185. scroll-to-text-fragment/
  186. secure-contexts/
  187. secure-payment-confirmation/
  188. selection/
  189. serial/
  190. server-timing/
  191. service-workers/
  192. shadow-dom/
  193. shape-detection/
  194. shared-storage/
  195. signed-exchange/
  196. soft-navigation-heuristics/
  197. speculation-rules/
  198. speech-api/
  199. storage/
  200. storage-access-api/
  201. streams/
  202. subapps/
  203. subresource-integrity/
  204. svg/
  205. svg-aam/
  206. timing-entrytypes-registry/
  207. tools/
  208. top-level-storage-access-api/
  209. touch-events/
  210. trust-tokens/
  211. trusted-types/
  212. ua-client-hints/
  213. uievents/
  214. upgrade-insecure-requests/
  215. url/
  216. urlpattern/
  217. user-timing/
  218. vibration/
  219. video-rvfc/
  220. virtual-keyboard/
  221. visual-viewport/
  222. wai-aria/
  223. wasm/
  224. web-animations/
  225. web-bundle/
  226. web-locks/
  227. web-nfc/
  228. web-otp/
  229. web-share/
  230. webaudio/
  231. webauthn/
  232. webcodecs/
  233. WebCryptoAPI/
  234. webdriver/
  235. webgl/
  236. webgpu/
  237. webhid/
  238. webidl/
  239. webmessaging/
  240. webmidi/
  241. webnn/
  242. webrtc/
  243. webrtc-encoded-transform/
  244. webrtc-extensions/
  245. webrtc-ice/
  246. webrtc-identity/
  247. webrtc-priority/
  248. webrtc-stats/
  249. webrtc-svc/
  250. websockets/
  251. webstorage/
  252. webtransport/
  253. webusb/
  254. webvr/
  255. webvtt/
  256. webxr/
  257. window-placement/
  258. workers/
  259. worklets/
  260. x-frame-options/
  261. xhr/
  262. .azure-pipelines.yml
  263. .gitattributes
  264. .gitignore
  265. .mailmap
  266. .taskcluster.yml
  267. CODE_OF_CONDUCT.md
  268. CODEOWNERS
  269. CONTRIBUTING.md
  270. LICENSE.md
  271. lint.ignore
  272. README.md
  273. wpt
  274. 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!