diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 4c70a17a070..c69011a08ff 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -760,6 +760,9 @@ static ErrorOr cascade_custom_properties(DOM::Element& element, Optional> interpolate_value(StyleValue const& from, StyleValue const& to, float delta) { + if (from.type() != to.type()) + return delta >= 0.5f ? to : from; + auto interpolate_raw = [delta = static_cast(delta)](auto from, auto to) { return static_cast>(static_cast(from) + static_cast(to - from) * delta); }; @@ -833,12 +836,6 @@ static ErrorOr> interpolate_value(StyleValue con static ErrorOr> interpolate_property(PropertyID property_id, StyleValue const& from, StyleValue const& to, float delta) { - if (from.type() != to.type()) { - if (delta > 0.999f) - return to; - return from; - } - auto animation_type = animation_type_from_longhand_property(property_id); switch (animation_type) { case AnimationType::ByComputedValue: