This enum type used to contain the result of parsing
one CSS source declaration (`name: value;`) and expanding shorthands.
Enum types are as big as the biggest of their variant (plus discriminant),
which was quite big because some shorthands
expand to many longhand properties.
This type was returned through many functions and methods,
wrapped and rewrapped in `Result` with different error types.
This presumably caused significant `memmove` traffic.
Instead, we now allocate an `ArrayVec` on the stack
and pass `&mut` references to it for various functions to push into it.
This type is also very big, but we never move it.
We still use an intermediate data structure because we sometimes decide
after shorthand expansion that a declaration is invalid after all
and that we’re gonna drop it.
Only later do we push to a `PropertyDeclarationBlock`,
with an entire `ArrayVec` or nothing.
In future work we can try to avoid a large stack-allocated array,
and instead writing directly to the heap allocation
of the `Vec` inside `PropertyDeclarationBlock`.
However this is tricky:
we need to preserve this "all or nothing" aspect
of parsing one source declaration,
and at the same time we want to make it as little error-prone as possible
for the various call sites.
`PropertyDeclarationBlock` curently does property deduplication
incrementally: as each `PropertyDeclaration` is pushed,
we check if an existing declaration of the same property exists
and if so overwrite it.
To get rid of the stack allocated array we’d need to somehow
deduplicate separately after pushing multiple `PropertyDeclaration`.
We need another flag that represents allow-negative-number for SMIL, so
this enum will also comprise the another parsing mode that allows negative number.
1. We add a new arm to TransitionProperty, TransitionProperty::Unsupported,
which contains an Atom, so it's better to remove the Copy trait from
TransitionProperty.
2. TransitionProperty::Unsupported(Atom) represents any non-animatable, custom,
or unrecognized property, and we use Atom to store the ident string for
serialization.
If there are multiple prefixed/non-prefixed @keyframes with the same name;
* non-prefixed rule overrides earlier rules.
* prefixed rule overrides earlier prefixed rules.
Now that the `context` contains the `rule_type`, we can remove the `in_keyframe`
arg and check the `rule_type` to achieve the same thing.
MozReview-Commit-ID: oXrFBPuKMz
Extend Servo's @page parsing to match Gecko's CSS 2.2 behavior, where only
margin properties are allowed in an @page rule. Other properties are ignored.
MozReview-Commit-ID: IPYUlnkLYSb
From https://bugzilla.mozilla.org/show_bug.cgi?id=1347719
This effectively combines the discriminants of the two enums and reduces the
size of PropertyDeclaration by one word.
MozReview-Commit-ID: 9rCRiSVZTQT
@keyframes anim {
from { transform: none; }
to { opacity: 0; transform: none; }
}
In above case, we have to add opacity property and value in the 'from' keyframe.
We need to create CSS animations that have empty keyframe or keyframes
which have only invalid properties or non-animatable properties to fire
animation events for such animations.