Now we have AnimatableLonghand (to do with animatability) and
TransitionProperty (to do with transitionability), we should move
nscssproperty_id_is_animatable to be part of the former group.
Currently properties that are discretely animated cannot be
transitioned. Now that TransitionProperty should only be used for
transitions, we can redefine it to treat non-transitionable properties
as unsupported. This should allow us to simplify the code and make it
more self-documenting (e.g. making TransitionProperty actually relate to
transitions).
In the next few patches we move all non-transition related code over to
using AnimatableLonghand instead of TransitionProperty. This will allow
us to re-purpose TransitionProperty to represent only properties that
can be transitioned (i.e. excluding discrete properties) as well as
simplifying the code by removing the need to deal with shorthands and
the "all" value in places that do not need to handle those values.
I saw this function appear in the profiles at #17329.
It was under set_device, which isn't a Stylo path, but probably worth there
anyway.
This reduces the reported overhead of RulesIterator::next in perf from ~8% to
0.46%
This type, which we will use in the next patch in this series, can
represent only longhands whose animation type is not "none". By
introducing this type, we can later restrict the meaning of
TransitionProperty to only cover properties whose animation type is not
"none" OR "discrete" (since currently CSS transitions should not animate
properties whose animation type is discrete). Doing so will also mean
that CSS transitions ignore the 'display' property by default.
Furthermore, introducing this type will allow the animation code to
clearly document when a property is allowed to be a shorthand or
unanimatable property and when it is expected to be an animatable
longhand. This, in turn, will allow us to remove a few
no-longer-necessary checks and simplify the code.
This allows simplifying the code somewhat and means we can ignore
unanimated shorthands a little sooner. Furthermore, it removes the odd
inconsistency where TransitionProperty only included animatable
longhands but allowed all shorthands regardless of whether or not they
were animatable.
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 -->