LibWeb: Remove "resolved" from the name of Keyframe's property map

These will need to store unresolved styles as well, since they may be
built during parsing of a @keyframes rule. In that case there is no
target element or pseudo-element, and thus the value cannot be resolved.
This commit is contained in:
Matthew Olsson 2024-03-17 17:22:12 -07:00 committed by Andreas Kling
parent c92f556aa5
commit ebfc6c33a6
Notes: sideshowbarker 2024-07-16 16:23:32 +09:00
3 changed files with 13 additions and 11 deletions

View file

@ -1337,11 +1337,11 @@ void StyleComputer::collect_animation_into(JS::NonnullGCPtr<Animations::Keyframe
}();
if constexpr (LIBWEB_CSS_ANIMATION_DEBUG) {
auto valid_properties = keyframe_values.resolved_properties.size();
auto valid_properties = keyframe_values.properties.size();
dbgln("Animation {} contains {} properties to interpolate, progress = {}%", animation->id(), valid_properties, progress_in_keyframe * 100);
}
for (auto const& it : keyframe_values.resolved_properties) {
for (auto const& it : keyframe_values.properties) {
auto resolve_property = [&](auto& property) {
return property.visit(
[&](Animations::KeyframeEffect::KeyFrameSet::UseInitial) -> RefPtr<StyleValue const> {
@ -1354,7 +1354,7 @@ void StyleComputer::collect_animation_into(JS::NonnullGCPtr<Animations::Keyframe
auto resolved_start_property = resolve_property(it.value);
auto const& end_property = keyframe_end_values.resolved_properties.get(it.key);
auto const& end_property = keyframe_end_values.properties.get(it.key);
if (!end_property.has_value()) {
if (resolved_start_property) {
style_properties.set_animated_property(it.key, *resolved_start_property);
@ -2423,7 +2423,7 @@ NonnullOwnPtr<StyleComputer::RuleCache> StyleComputer::make_rule_cache_for_casca
for (auto const& it : keyframe_style.properties()) {
for_each_property_expanding_shorthands(it.property_id, it.value, [&](PropertyID shorthand_id, StyleValue const& shorthand_value) {
animated_properties.set(shorthand_id);
resolved_keyframe.resolved_properties.set(shorthand_id, NonnullRefPtr<StyleValue const> { shorthand_value });
resolved_keyframe.properties.set(shorthand_id, NonnullRefPtr<StyleValue const> { shorthand_value });
});
}
@ -2435,7 +2435,7 @@ NonnullOwnPtr<StyleComputer::RuleCache> StyleComputer::make_rule_cache_for_casca
if constexpr (LIBWEB_CSS_DEBUG) {
dbgln("Resolved keyframe set '{}' into {} keyframes:", rule.name(), keyframe_set->keyframes_by_key.size());
for (auto it = keyframe_set->keyframes_by_key.begin(); it != keyframe_set->keyframes_by_key.end(); ++it)
dbgln(" - keyframe {}: {} properties", it.key(), it->resolved_properties.size());
dbgln(" - keyframe {}: {} properties", it.key(), it->properties.size());
}
rule_cache->rules_by_animation_keyframes.set(rule.name(), move(keyframe_set));