[css-properties-values-api] Animated registered property in @keyframes without end state doesn't seem to interpolate properly
Categories
(Core :: CSS Parsing and Computation, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox125 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: zrhoffman)
References
(Blocks 3 open bugs, Regressed 1 open bug)
Details
Attachments
(2 files)
Steps to reproduce
- Navigate to
data:text/html,<meta charset=utf8><style>@property --bg { syntax: "<color>"; initial-value: cyan; inherits: true;}%20 div { display: inline-block; margin: 20px;background-color: var(--bg);width: 50px;height: 50px; animation: color 2s infinite;} .a {%20 animation-name: colora; } .b { animation-name: colorb;} @keyframes colora { 0% { --bg: gold; } 100% { --bg: tomato; } } @keyframes colorb { 0%,50% { --bg: tomato; } } </style><div class=a>A</div><div class=b>B</div>
Expected results
Both A
and B
squares background color is animated
Actual results
B
square background color is not animated, it jumps to cyan mid-animation
Here's the CSS in a more readable way:
@property --bg {
syntax: "<color>";
initial-value: cyan;
inherits: true;
}
div {
background-color: var(--bg);
animation: color 2s infinite;
}
.a {
animation-name: colora;
}
.b {
animation-name: colorb;
}
@keyframes colora {
0% {
--bg: gold;
}
100% {
--bg: tomato;
}
}
@keyframes colorb {
0%,
50% {
--bg: tomato;
}
}
The issue seems to be in colorb
keyframes, where we don't set an end state.
In Chrome and Safari, B
square is properly animated
Reporter | ||
Comment 1•1 year ago
|
||
zsun, is this a known limitation? If so feel free to close this bug if there's another one to cover this case
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Comment 2•1 year ago
|
||
In the case of colorb
, it looks like the color values for self
and other
are the same in Animate::CustomAnimatedValue
<https://searchfox.org/mozilla-central/rev/2c3d657cbba5484ccac44443c4417baed7b5fafb/servo/components/style/properties_and_values/value.rs#544>, which causes self.value.animate
to fail for most Procedure::Interpolate
progresses.
Probably Servo_StyleSet_GetKeyframesForName
<https://searchfox.org/mozilla-central/rev/2c3d657cbba5484ccac44443c4417baed7b5fafb/servo/ports/geckolib/glue.rs#6483> will need to be changed, since that's where the duplicate values are coming from, but I haven't pinpointed where yet.
Comment 4•1 year ago
|
||
Both squares should probably animate equally.
Comment 5•1 year ago
|
||
Updated•1 year ago
|
Assignee | ||
Comment 6•1 year ago
|
||
Sorry, I should have corrected myself when I realized that comment 2 was not correct.
Specifically, hasAdditiveValues
<https://searchfox.org/mozilla-central/rev/6b8a3f804789fb865f42af54e9d2fef9dd3ec74d/dom/animation/KeyframeEffect.cpp#571> is returning false
because aProperty.mToValue
is initially null, resulting in trying to use a ComputedValue::Universal
for the other value used for interpolation, since not yet having implemented bug 1864736 means that the computed style for registered custom properties is still untyped.
If the condition at <https://searchfox.org/mozilla-central/rev/6b8a3f804789fb865f42af54e9d2fef9dd3ec74d/dom/animation/KeyframeEffect.cpp#571> is instead changed to
(hasAdditiveValues(aProperty) && !aProperty.mProperty.IsCustom());
since mToValue
is computed later in the case of a custom property, value
will interpolate successfully in CustomAnimatedValue::Animate
<https://searchfox.org/mozilla-central/rev/2c3d657cbba5484ccac44443c4417baed7b5fafb/servo/components/style/properties_and_values/value.rs#548>, but child_restyle_requirement will still not be set to ChildRestyleRequirement::MustCascadeChildren
at <https://searchfox.org/mozilla-central/rev/6b8a3f804789fb865f42af54e9d2fef9dd3ec74d/servo/components/style/traversal.rs#427> for colorb
in the testcase like it does for colora
(though I have not yet tested carrying over or looking up that type information, as suggested in comment 5).
So if the type information is not looked up or carried over, a condition determining whether compute_style
returns ChildRestyleRequirement::MustCascadeChildren
should probably be changed.
Assignee | ||
Comment 7•11 months ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #5)
The issue is not comment 2. The problem is that when we get an animated value from the computed style (such as when omitting the start or end keyframe) we lose the type information here.
We should carry over that type information somehow or look it up.
You are right, carrying over the type animation does make the testcase behave as expected.
Assignee | ||
Updated•11 months ago
|
Assignee | ||
Comment 8•11 months ago
|
||
animation/custom-property-animation-transform-none.tentative.html now
fails for the first time since bug 1846516, and is tracked in bug
1861408.
Also add a TODO for bug 1883255, since this fixes bug 1870348.
Updated•11 months ago
|
Comment 10•11 months ago
|
||
Backed out for causing build bustages.
- Backout link
- Push with failures
- Failure Log
- Failure line: error[E0599]: no method named
is_parsed
found for reference&Value<GenericValueComponent<CSSPixelLength, f32, Percentage, ..., ..., ..., ..., ..., ..., ..., ..., ...>>
in the current scope
Assignee | ||
Comment 11•11 months ago
|
||
Had to add #[cfg(debug_assertions)]
to a debug_assert using a debug-only function.
Comment 12•11 months ago
|
||
Comment 13•11 months ago
|
||
bugherder |
Description
•