mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
LibWeb: Resolve initial/inherit/unset before interpolating properties
This was preventing a number of WPT tests relating to CSS animation from running at all.
This commit is contained in:
parent
7ac3806a1d
commit
5bdbc34a63
Notes:
github-actions[bot]
2024-11-07 21:51:36 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/5bdbc34a63d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2213
1 changed files with 20 additions and 1 deletions
|
@ -39,8 +39,27 @@ static T interpolate_raw(T from, T to, float delta)
|
|||
}
|
||||
}
|
||||
|
||||
ValueComparingRefPtr<CSSStyleValue const> interpolate_property(DOM::Element& element, PropertyID property_id, CSSStyleValue const& from, CSSStyleValue const& to, float delta)
|
||||
static NonnullRefPtr<CSSStyleValue const> with_keyword_values_resolved(DOM::Element& element, PropertyID property_id, CSSStyleValue const& value)
|
||||
{
|
||||
if (!value.is_keyword())
|
||||
return value;
|
||||
switch (value.as_keyword().keyword()) {
|
||||
case CSS::Keyword::Initial:
|
||||
case CSS::Keyword::Unset:
|
||||
return property_initial_value(element.realm(), property_id);
|
||||
case CSS::Keyword::Inherit:
|
||||
return CSS::StyleComputer::get_inherit_value(element.realm(), property_id, &element);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
ValueComparingRefPtr<CSSStyleValue const> interpolate_property(DOM::Element& element, PropertyID property_id, CSSStyleValue const& a_from, CSSStyleValue const& a_to, float delta)
|
||||
{
|
||||
auto from = with_keyword_values_resolved(element, property_id, a_from);
|
||||
auto to = with_keyword_values_resolved(element, property_id, a_to);
|
||||
|
||||
auto animation_type = animation_type_from_longhand_property(property_id);
|
||||
switch (animation_type) {
|
||||
case AnimationType::ByComputedValue:
|
||||
|
|
Loading…
Reference in a new issue