Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions docs/validation/css-animation-fill-mode-661-242.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# CSS animation fill-mode source validation

Issue #661 completes the bounded `animation-fill-mode` behavior for WebScene's
existing single-animation opacity, `rotate()`, and foreground-filter keyframes
under #242. It accepts the first longhand list item and the first shorthand
animation for `none`, `forwards`, `backwards`, and `both`. The CSSOM
`animationFillMode` and `getPropertyValue("animation-fill-mode")` surfaces expose
the configured value without an ABI or AppScene change.

## Timing and fill contract

Fill is configuration around an animation timeline, not part of timeline
identity. A fill-only cascade or CSSOM change retains the original start time.
An already-completed supported animation requests at most one host sample to
apply or remove its static boundary value, then returns to zero frame demand.
The existing `animationend` latch is preserved, so this update cannot dispatch a
second terminal event.

For a positive delay, `backwards` and `both` sample the boundary that starts
iteration zero. `normal` and `alternate` use progress zero; `reverse` and
`alternate-reverse` use progress one. The positive-delay boundary is sampled
directly, without applying the between-keyframe timing function, so
`steps(..., start)` does not jump before the active interval. `none` and
`forwards` expose the underlying property before that interval. A negative delay
has no before phase and enters the active or after phase directly.

After a finite active interval, `forwards` and `both` use the existing
direction-aware integer or fractional terminal progress for opacity, rotation,
and compatible bounded filters. `none` and `backwards` restore the underlying
value. Rotation now retains an explicit filled override just like filters, while
filled overrides remain excluded from the active-animation frame-demand test.
Removing the animation, changing its identity, navigation, and node teardown
clear the override through the established runtime lifecycle.

## Bounds and deferred behavior

- The runtime still configures one animation and the first comma-separated
longhand value.
- Existing keyframe-stop and compatible filter-list limits are unchanged.
- No timer, queue, visual-tree node, selector pass, or per-frame allocation is
added. Host timestamps and visibility/clip frame-demand gates are preserved.
- `animation-play-state`, zero-duration and zero-iteration fill, multiple
animations, translate/scale keyframes, pseudo-element animation, and the Web
Animations API remain deferred.
- Unchanged Code OSS uses `both` for delayed Quick Input, action-widget, and Chat
entry animations. This slice prevents their supported opacity before-phase
flash. Their translate/scale keyframes remain outside the rotate-only bound.

## Evidence

- `test_animation_fill_maps_before_after_and_preserves_timeline` covers all four
values, longhand and shorthand metadata, direction and step timing in the
before phase, opacity/rotation/filter terminal paint, fill-only mutation,
exactly-once `animationend`, removal, detach, and settled frame demand.
- `tests/WebPlatformSubset/contracts/css-animation-fill-mode-boundaries.html`
is a bounded WPT-aligned browser contract with the same before, after, live
update, and cleanup boundaries. A dedicated profile selects only that test.
- Under the fast implementation policy, only `git diff --check` is executed in
this slice. Native, browser, package, and unchanged Code OSS acceptance remain
unexecuted.
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ bool apply_decoration_value(dom_node& node,const std::string& name,const std::st
return true;
} else if (name == "animation-fill-mode") {
node.style.mutable_animations().animation_fill_mode_value = value;
decision.classification = "partially-supported";
decision.semantic_slice =
"first animation; none, forwards, backwards, both";
return true;
} else if (property_mask(name) == inline_border
&& is_inline(inline_border)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ inline constexpr auto specified_property_samples = std::to_array<specified_prope
{"animation","fade 1s linear 100ms infinite"},{"animation-name","fade"},{"animation-duration","1s"},
{"animation-delay","100ms"},{"animation-timing-function","ease-in-out"},{"animation-iteration-count","infinite"},
{"animation-direction","alternate-reverse"},
{"animation-fill-mode","both"},
{"box-shadow","1px 2px 3px 4px rgba(0,0,0,.5)"},
{"background","#123456"},{"background-color","rgba(1,2,3,.5)"},
{"background-image","linear-gradient(90deg, red, blue)"},{"background-repeat","no-repeat"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ inline void apply_animation_shorthand(node_style& style, const std::string& valu
return std::isdigit(character) || character == '.';
})) {
iterations = lower;
} else if (lower == "forwards" || lower == "both") {
} else if (lower == "forwards" || lower == "backwards"
|| lower == "both") {
fill_mode = lower;
} else if (lower == "normal" || lower == "reverse"
|| lower == "alternate" || lower == "alternate-reverse") {
Expand Down Expand Up @@ -318,6 +319,8 @@ inline void configure_keyframes(node_style& style,
animations.animation_iteration_count_value, ',');
const auto directions = split_css_component_list(
animations.animation_direction_value, ',');
const auto fill_modes = split_css_component_list(
animations.animation_fill_mode_value, ',');
animations.opacity_keyframe_duration_ms = durations.empty()
? 0 : std::max(0.0F, parse_css_time_ms(durations.front()));
animations.opacity_keyframe_delay_ms = delays.empty()
Expand All @@ -336,9 +339,15 @@ inline void configure_keyframes(node_style& style,
: direction == "alternate-reverse"
? node_style::animation_data::direction_kind::alternate_reverse
: node_style::animation_data::direction_kind::normal;
const auto fill_mode = ascii_lower(trim_value(animations.animation_fill_mode_value));
animations.opacity_keyframe_fill_forwards =
fill_mode == "forwards" || fill_mode == "both";
const auto fill_mode = fill_modes.empty()
? std::string("none") : ascii_lower(trim_value(fill_modes.front()));
animations.keyframe_fill_mode = fill_mode == "forwards"
? node_style::animation_data::fill_kind::forwards
: fill_mode == "backwards"
? node_style::animation_data::fill_kind::backwards
: fill_mode == "both"
? node_style::animation_data::fill_kind::both
: node_style::animation_data::fill_kind::none;
node_style::transition_timing animation_timing;
if (!timings.empty()) parse_animation_timing(timings.front(), animation_timing);
animations.opacity_keyframe_x1 = animation_timing.x1;
Expand All @@ -361,7 +370,6 @@ inline void configure_keyframes(node_style& style,
<< animations.opacity_keyframe_delay_ms << '|'
<< animations.opacity_keyframe_iterations << '|'
<< static_cast<unsigned>(animations.keyframe_direction) << '|'
<< animations.opacity_keyframe_fill_forwards << '|'
<< static_cast<unsigned>(animations.opacity_keyframe_timing_kind) << ','
<< animations.opacity_keyframe_step_count << ','
<< static_cast<unsigned>(animations.opacity_keyframe_step_position) << '|'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ struct node_style final {
alternate,
alternate_reverse
};
enum class fill_kind : uint8_t {
none,
forwards,
backwards,
both
};
std::string transition_property_value{"all"};
std::string transition_duration_value{"0s"};
std::string transition_delay_value{"0s"};
Expand Down Expand Up @@ -233,7 +239,7 @@ struct node_style final {
float opacity_keyframe_delay_ms{0};
float opacity_keyframe_iterations{1};
direction_kind keyframe_direction{direction_kind::normal};
bool opacity_keyframe_fill_forwards{false};
fill_kind keyframe_fill_mode{fill_kind::none};
float opacity_keyframe_x1{0.25F};
float opacity_keyframe_y1{0.1F};
float opacity_keyframe_x2{0.25F};
Expand Down Expand Up @@ -1514,12 +1520,16 @@ struct dom_node final {
std::string rotation_keyframe_animation_signature;
double rotation_keyframe_animation_started_ms{0};
bool rotation_keyframe_animation_active{false};
bool rotation_keyframe_animation_filled{false};
std::string filter_keyframe_animation_signature;
std::vector<retained_filter_keyframe> filter_keyframes;
std::vector<retained_filter_function> filter_keyframe_underlying;
double filter_keyframe_animation_started_ms{0};
bool filter_keyframe_animation_active{false};
bool filter_keyframe_animation_valid{false};
bool filter_keyframe_animation_filled{false};
node_style::animation_data::fill_kind keyframe_fill_mode{
node_style::animation_data::fill_kind::none};
bool keyframe_animation_end_event_sent{false};
uint32_t painted_foreground_rgba{0};
uint32_t color_animation_from_rgba{0};
Expand Down Expand Up @@ -1865,10 +1875,11 @@ struct dom_node final {
: style.background_rgba;
}

bool rotation_keyframe_animation_active_value() const noexcept
bool has_painted_rotation_keyframe_override_value() const noexcept
{
return animation_runtime_state != nullptr
&& animation_runtime_state->rotation_keyframe_animation_active;
&& (animation_runtime_state->rotation_keyframe_animation_active
|| animation_runtime_state->rotation_keyframe_animation_filled);
}

bool has_painted_filter_override_value() const noexcept
Expand Down
Loading
Loading