style: Avoid quadratic time serialization of a declaration block.
At least when the longhands aren't custom properties.
We should also look into not serializing the style attribute eagerly when it's
not needed... But a lot of code currently rely on attribute values being
dereferenciables to &str, so that's harder to fix.
We should really look into all those vectors around too, but that's probably
less urgent.
<!-- 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/17315)
<!-- Reviewable:end -->
By looking at the shorthands, not the other way around, given a longhand uses to
not appear in multiple longhands.
This makes the testcase go to 430ms on my machine.
This could be even faster having a static LonghandIdSet per shorthand, I guess,
but this is not done in this PR.
Concretely we avoid allocating and scanning a temporary vector of longhands not
yet serialized for each shorthand.
This doesn't save a lot of time in Linux, but I bet it's somewhat important on
OSX.
At least when the longhands aren't custom properties.
We should also look into not serializing the style attribute eagerly when it's
not needed... But a lot of code currently rely on attribute values being
dereferenciables to &str, so that's harder to fix.
We should really look into all those vectors around too, but that's probably
less urgent.
We still count on Bug 1356124 to fix font-variant-alternates longhand, so we
can get font-variant shorthand work properly.
Some comments about Bug 1356124 have been removed, since this shorthand code
should just work once we fix Bug 1356124.
From gecko bug: Bug 1356134 (https://bugzilla.mozilla.org/show_bug.cgi?id=1356134)
Return zero when computing distance of Option with both value is none.
<!-- Please describe your changes on the following line: -->
This is a PR for https://bugzilla.mozilla.org/show_bug.cgi?id=1371480
---
<!-- 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
<!-- Either: -->
There are tests for these changes, a test case will be landed in reftests in https://bugzilla.mozilla.org/show_bug.cgi?id=1371480
<!-- 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/17288)
<!-- Reviewable:end -->
Avoid early returning Err() in parsers, so we could let the the caller
of the parsers to handle the rest of input, and return error if it requires
parsing entirely.
The point is let returning Err() stay inside input.try(), so we can count
on input.try() to restore the position when parsing invalid idents.
From gecko bug: Bug 1356134 (https://bugzilla.mozilla.org/show_bug.cgi?id=1356134)
Don't process RestyleKind::MatchAndCascade during animation-only rest…
…yle.
<!-- Please describe your changes on the following line: -->
https://bugzilla.mozilla.org/show_bug.cgi?id=1372335
---
- [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 it's for stylo
<!-- 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/17305)
<!-- Reviewable:end -->
style: Less refcount churn while inserting in the rule tree.
There's no need for it since we know no GC is happening while we're doing it.
<!-- 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/17294)
<!-- Reviewable:end -->
Added Debug implementations.
<!-- Please describe your changes on the following line: -->
Added enough `Debug` implementations to be able to debug script thread message processing.
---
<!-- 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 we don't test debugging
<!-- 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/17298)
<!-- Reviewable:end -->
Clear webrender image id when resizing a canvas.
<!-- Please describe your changes on the following line: -->
Webrender isn't very happy if images change size, so clear the webrender image key when resizing a canvas.
---
<!-- 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#17277
- [X] There are tests for these changes
<!-- 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/17278)
<!-- Reviewable:end -->
Otherwise, tests like the following fail, given we always match as unvisited,
and we'd never mark the link as needing invalidation.
<!doctype html>
<style>
a {
color: red !important;
}
.foo :visited {
color: green !important;
}
</style>
<div>
<a href="https://google.es">visit me</a>
<button onclick="this.parentNode.className = 'foo'">Then click me</button>
</div>
Bug: 1368240
MozReview-Commit-ID: LDv6S28c4ju
This is needed for the omta test to pass. This is pretty much the equivalent to
the old restyle hints code.
Bug: 1368240
MozReview-Commit-ID: BLUfw5Wxpxd
This commit also removes the old restyle_hints module and splits it into
multiple modules under components/style/invalidation/element/.
The basic approach is to walk down the tree using compound selectors as needed,
in order to do as little selector-matching as possible.
Bug: 1368240
MozReview-Commit-ID: 2YO8fKFygZI