Account for root element paint offset when painting backgrounds

The root background is painted from the coordinate space of the root
element, but expands to fill the viewport. The difference between these
spaces needs to be used as an offset when painting the background.

For the non-transform case, this patch removes the paint offset
adjustment made to the entire paint rect in ViewPainter, and only
applies the paint offset for positioning the background in
BackgroundImageGeometry::ComputePositioningArea. This way, painting
starts from the origin, without paint offset.

For the transform case, paint properties will apply the paint offset,
and the entire paint rect needs to be adjusted to remove the paint
offset. This patch specifies the transform state of the view and root
element, and uses GeometryMapper to map the background paint rect into
the coordinate space of the root element.

A TODO has been added to more clearly specify the non-transform
and transform cases.

Bug: 1071957
Change-Id: Iedc1834ef9c400340b668b3eec73a0f3f4506194
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2161350
Auto-Submit: Philip Rogers <pdr@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762543}
6 files changed
tree: 7d2a21ef6ff01236af7c953023714ecdbfaf8c87
  1. .github/
  2. .well-known/
  3. 2dcontext/
  4. accelerometer/
  5. accname/
  6. acid/
  7. ambient-light/
  8. animation-worklet/
  9. annotation-model/
  10. annotation-protocol/
  11. annotation-vocab/
  12. apng/
  13. appmanifest/
  14. audio-output/
  15. background-fetch/
  16. BackgroundSync/
  17. badging/
  18. battery-status/
  19. beacon/
  20. bluetooth/
  21. clear-site-data/
  22. client-hints/
  23. clipboard-apis/
  24. common/
  25. compat/
  26. compression/
  27. conformance-checkers/
  28. console/
  29. contacts/
  30. content-dpr/
  31. content-index/
  32. content-security-policy/
  33. contenteditable/
  34. cookie-store/
  35. cookies/
  36. core-aam/
  37. cors/
  38. credential-management/
  39. css/
  40. custom-elements/
  41. device-memory/
  42. docs/
  43. document-policy/
  44. dom/
  45. domparsing/
  46. domxpath/
  47. dpub-aam/
  48. dpub-aria/
  49. editing/
  50. element-timing/
  51. encoding/
  52. encoding-detection/
  53. encrypted-media/
  54. entries-api/
  55. event-timing/
  56. eventsource/
  57. feature-policy/
  58. fetch/
  59. FileAPI/
  60. fonts/
  61. forced-colors-mode/
  62. fullscreen/
  63. gamepad/
  64. generic-sensor/
  65. geolocation-API/
  66. geolocation-sensor/
  67. graphics-aam/
  68. gyroscope/
  69. hr-time/
  70. html/
  71. html-longdesc/
  72. html-media-capture/
  73. idle-detection/
  74. imagebitmap-renderingcontext/
  75. images/
  76. import-maps/
  77. IndexedDB/
  78. inert/
  79. infrastructure/
  80. input-device-capabilities/
  81. input-events/
  82. installedapp/
  83. interfaces/
  84. intersection-observer/
  85. js/
  86. js-self-profiling/
  87. keyboard-lock/
  88. keyboard-map/
  89. largest-contentful-paint/
  90. layout-instability/
  91. lifecycle/
  92. loading/
  93. longtask-timing/
  94. magnetometer/
  95. mathml/
  96. measure-memory/
  97. media/
  98. media-capabilities/
  99. media-playback-quality/
  100. media-source/
  101. mediacapture-depth/
  102. mediacapture-fromelement/
  103. mediacapture-image/
  104. mediacapture-record/
  105. mediacapture-streams/
  106. mediasession/
  107. mimesniff/
  108. mixed-content/
  109. mst-content-hint/
  110. native-file-system/
  111. native-io/
  112. navigation-timing/
  113. netinfo/
  114. network-error-logging/
  115. notifications/
  116. offscreen-canvas/
  117. old-tests/
  118. orientation-event/
  119. orientation-sensor/
  120. origin-isolation/
  121. origin-policy/
  122. page-lifecycle/
  123. page-visibility/
  124. paint-timing/
  125. payment-handler/
  126. payment-method-basic-card/
  127. payment-method-id/
  128. payment-request/
  129. performance-timeline/
  130. PeriodicBackgroundSync/
  131. permissions/
  132. permissions-request/
  133. permissions-revoke/
  134. picture-in-picture/
  135. pointerevents/
  136. pointerlock/
  137. portals/
  138. preload/
  139. presentation-api/
  140. printing/
  141. priority-hints/
  142. proximity/
  143. push-api/
  144. quirks/
  145. referrer-policy/
  146. remote-playback/
  147. reporting/
  148. requestidlecallback/
  149. resize-observer/
  150. resource-timing/
  151. resources/
  152. screen-capture/
  153. screen-orientation/
  154. screen-wake-lock/
  155. screen_enumeration/
  156. scroll-animations/
  157. scroll-to-text-fragment/
  158. secure-contexts/
  159. selection/
  160. serial/
  161. server-timing/
  162. service-workers/
  163. shadow-dom/
  164. shape-detection/
  165. signed-exchange/
  166. speech-api/
  167. storage/
  168. storage-access-api/
  169. streams/
  170. subresource-integrity/
  171. svg/
  172. svg-aam/
  173. timing-entrytypes-registry/
  174. tools/
  175. touch-events/
  176. trust-tokens/
  177. trusted-types/
  178. uievents/
  179. upgrade-insecure-requests/
  180. url/
  181. user-timing/
  182. vibration/
  183. video-rvfc/
  184. visual-viewport/
  185. wai-aria/
  186. wasm/
  187. web-animations/
  188. web-bundle/
  189. web-locks/
  190. web-nfc/
  191. web-share/
  192. webaudio/
  193. webauthn/
  194. WebCryptoAPI/
  195. webdriver/
  196. webgl/
  197. webgpu/
  198. WebIDL/
  199. webmessaging/
  200. webmidi/
  201. webrtc/
  202. webrtc-extensions/
  203. webrtc-identity/
  204. webrtc-insertable-streams/
  205. webrtc-quic/
  206. webrtc-stats/
  207. webrtc-svc/
  208. websockets/
  209. webstorage/
  210. webusb/
  211. webvr/
  212. webvtt/
  213. webxr/
  214. workers/
  215. worklets/
  216. x-frame-options/
  217. xhr/
  218. xslt/
  219. .azure-pipelines.yml
  220. .codecov.yml
  221. .gitattributes
  222. .gitignore
  223. .mailmap
  224. .pyup.yml
  225. .taskcluster.yml
  226. CODEOWNERS
  227. CONTRIBUTING.md
  228. LICENSE.md
  229. lint.whitelist
  230. README.md
  231. testharness_runner.html
  232. update-built-tests.sh
  233. wpt
  234. wpt.py
README.md

The web-platform-tests Project

Taskcluster CI Status

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 IRC chat room named #testing on irc.w3.org; includes participants located around the world, but busiest during the European working day; all discussion is archived here
  • 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.

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 http://w3c-test.org/.

Pull requests are automatically mirrored except those that modify sensitive resources (such as .py). The latter require someone with merge access to comment with “LGTM” or “w3c-test:mirror” to indicate the pull request has been checked.

Branches

In the vast majority of cases the only upstream branch that you should need to care about is master. If you see other branches in the repository, you can generally safely ignore them.

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!