components/net: Fix a double-lock in image_cache
<!-- Please describe your changes on the following line: -->
Add fn `add_listener_with_store` which requires `self.store.lock()` before calling.
Use this function instead of `add_listener` on L555 because `self.store.lock()` is called before.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [] `./mach build -d` does not report any errors
- [] `./mach test-tidy` does not report any errors
- [X] These changes fix#29003 (GitHub issue number if applicable)
<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because the fix is straightforward.
<!-- 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. -->
chore: upgrade the Rust toolchain to `nightly-2022-10-13`
---
- [x] `./mach build -d` does not report any errors (prerequisite: #29009)
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)
---
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they are not functional changes
Use SPDX license format
<!-- 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: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (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. -->
[rust-lang/rust#95562][1] renames the existing method `get_attrs` to
`get_attrs_unchecked` and introduces a new method in its former place.
The new method takes an attribute name and returns attributes of that
name. It also checks that, if the attribute name is marked as local-
only, the given `DefId` is local as well to prevent misuses. The old
method, now named `get_attrs_unchecked`, returns all attributes of a
given `DefId`; thus it's "unchecked" in the sense that it's up to the
callers to be certain whether the attributes they are looking for are
local-only.
The new `get_attrs` method lacks the support for attribute names with
more than one path component, which is why we can't just migrate to the
new `get_attrs` method here. Although `get_attrs_unchecked` is marked
for future removal in the compile source code, there's a discussion
about [supporting][2] this use case.
[1]: https://github.com/rust-lang/rust/pull/95562
[2]: https://github.com/rust-lang/rust/pull/95562/files#r915537557
Update to image 0.24.2, implement WebP support
<!-- Please describe your changes on the following line: -->
This PR updates image to 0.24.2 and implements WebP support. I've been watching the progress on image-rs's WebP implementation, and from what I've seen, the situation has changed from "can only decode the luma channel from lossy WebPs" to pretty much full support (with image 0.24.2 implementing support for the extended WebP format).
Here are screenshots of it viewing the WebP page's example:
<details>
<summary>Screenshots</summary>
Servo viewing the main WebP gallery:

Servo viewing a lossless example from WebP's Lossless and Alpha Demonstration:

Servo viewing a lossy-with-alpha example from WebP's Lossless and Alpha Demonstration

</details>
This also changes the package name from `piston_image` to simply `image`. It appeared to be a piece of legacy from ages ago which can be safely changed now.
(PS: I'm still pretty new at Rust, please let me know if I have done any mistakes in the process)
---
<!-- 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#20045 (GitHub issue number if applicable)
<!-- Either: -->
- [X] 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. -->
Ensure reflow damage is calculated when hypothetical box changes.
The layout traversal code has special handling for deciding whether to traverse text nodes or not. Specifically, unless the parent of a text node is restyled in a way that requires reconstructing the text fragment, we skip processing the text nodes as a performance optimization.
The optimization causes a problem in hypothetical-box-dynamic.html, which tests that the rendering doesn't change when an absolutely-positioned span has an explicit block display removed (because absolutely-positioned elements should have hypothetical block boxes, regardless). However, the code to decide what restyling damage occurs when the block display is removed did not consider the hypothetical display, only the internal display value that treats absolute positioning as block display.
By explicitly comparing the hypothetical display as well as the internal display, we ensure the element is restyled appropriately and the layout matches after the change.
---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] There are tests for these changes