LibWeb: Expand shorthand properties in KeyframeEffect

This commit is contained in:
Matthew Olsson 2024-02-24 08:37:02 -07:00 committed by Andreas Kling
parent 9e0ff9c140
commit ee63c729e5
Notes: sideshowbarker 2024-07-17 16:42:19 +09:00

View File

@ -9,6 +9,7 @@
#include <LibWeb/Animations/Animation.h>
#include <LibWeb/Animations/KeyframeEffect.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::Animations {
@ -825,8 +826,10 @@ WebIDL::ExceptionOr<void> KeyframeEffect::set_keyframes(Optional<JS::Handle<JS::
auto key = static_cast<u64>(keyframe.computed_offset.value() * 100 * AnimationKeyFrameKeyScaleFactor);
for (auto const& [property_id, property_value] : keyframe.parsed_properties()) {
m_target_properties.set(property_id);
resolved_keyframe.resolved_properties.set(property_id, property_value);
CSS::StyleComputer::for_each_property_expanding_shorthands(property_id, property_value, [&](CSS::PropertyID shorthand_id, CSS::StyleValue const& shorthand_value) {
m_target_properties.set(shorthand_id);
resolved_keyframe.resolved_properties.set(shorthand_id, NonnullRefPtr<CSS::StyleValue const> { shorthand_value });
});
}
keyframe_set->keyframes_by_key.insert(key, resolved_keyframe);