Refactor ImageCache::find_image_or_metadata -> ImageCache::{get_image, track_image}
<!-- Please describe your changes on the following line: -->
Updated the `ImageCache` trait to replace `find_image_or_metadata` with two new functions `track_image` and `get_image`, as well as a new enum (`ImageCacheResult`).
As a result, I was able to refactor the functions that previously called `find_image_or_metadata` pretty cleanly. For a list of these functions, please see the commit information.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix#21289 (GitHub issue number if applicable)
<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because tests already exist for these components. I ran `cargo test` in `net`, `net_traits`, `layout`, and `script` successfully.
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23661)
<!-- Reviewable:end -->
Automatically enable WebGL 2 for specific domains.
Our WebGL 2 implementation has progressed to the point where some but not all content works well. One particular example of non-working content is Babylon.js; if the WebGL2RenderingContext interface is present, it automatically tries to use it and causes panics in Servo. However, there are demos like http://www.servoexperiments.com/webxr-particles/ that work fine today and would be great to feature on our HoloLens homepage.
This change adds what is effectively an origin trial, where we can identify content that works well, ensure it's running in a list of blessed hosts, and reap the benefits.
handle detached array in XRView
<!-- Please describe your changes on the following line: -->
Recompute XRView.projectionmatrix when the buffer is detached
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix#26153 (GitHub issue number if applicable)
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Remove DomRefCell wrapper for CanvasState
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix#23436
- [x] There are tests for these changes
The PR removes the DomRefCell wrapper for CanvasState from `CanvasRenderingContext2D` and `OffscreenCanvasRenderingContext2D`. The reason for keeping member wrappers in CanvasState instead of overall CanvasState wrapper itself is because I believe that removing member wrappers would make it rather difficult to refactor the internal CanvasState methods in order to cover certain edge cases.
[For example](https://github.com/servo/servo/issues/23436#issuecomment-611089157): Drawing a canvas inside of itself would require getting and providing certain parameters for source canvas such as `canvas_id` and `is_origin_clean` that are currently accessed through source canvas context. Also, we might run into similar issue when creating patterns using canvas.
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Fix webgl transform feedback
This allows https://www.joshmatthews.net/webxr-particles/ to run in Servo. This change corresponds with the following spec text:
```
GL_INVALID_OPERATION is generated by glBeginTransformFeedback if no binding points would be used, either because no program object is active of because the active program object has specified no varying variables to record.
```
---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix#26137
- [x] There are tests for these changes
Dirty canvas when exiting immersive sessions
Fixes https://github.com/servo/servo/issues/26162, fixesservo/webxr#155
We basically end up in a situation where the main thread is asleep. It's unclear to me why it doesn't wake up after attempts to interact with the screen, but we stopped dirtying the canvas during the immersive session (https://github.com/servo/servo/pull/26077) so the main thread wasn't awake initially.
This is probably not the cleanest fix -- we really should not be ending up in situations where the main thread is perma-asleep -- however, we should be dirtying the canvas after exiting immersive mode _anyway_ since the contents need to be shown to the user, so this fix is still valid, even if it's not fixing the root cause.
Update checking origin trustworthy align to spec
While reading the [spec of ` Is origin potentially trustworthy? `](https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy), I found our second step is wrong; then, I found Josh said we didn't check it with `https` because we didn't support https in tests yet (https://github.com/servo/servo/pull/13574#discussion_r89346191).
IIRC, we've supported https wpt tests now so it might be fine to change it to align with spec.
---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Add FromJSValConvertible for enums
Fixes https://github.com/servo/servo/issues/26169
This adds FromJSValConvertible implementations for webidl enums, which allows them to be used within `sequence<>`, etc.
This also uses these implementations when converting arguments.
https://heycam.github.io/webidl/#es-overloads
In step 12, the platform object check is for substep 4, but importantly it only matters if `V` implements the matching interface. If not, it should be able to fall back to substep 10 and attempt conversion to a dictionary.
Remove WebVR
<!-- Please describe your changes on the following line: -->
Removes support for WebVR. WebXR is our future!
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because how do you test
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
There is no need to set the dirty descendants flag unsafely from the layout side
for elements with pending restyles, we can do that on the DOM side when draining
the restyles from the Document.
More layout cleanups from the introduction of a lifetime in LayoutDom<T>
What can I say, the follow-up fixes just kept coming to my door one by one, I couldn't just tell them to go away.