mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 05:35:52 +03:00
LibWeb: Do not abort interpolation if the StyleValue types differ
This can be perfectly valid, and depends on the property being animated. For example, interpolating between the StyleValue "none" (an identifier) and a TransformationStyleValue is perfectly defined.
This commit is contained in:
parent
15942b4262
commit
892f407d75
Notes:
sideshowbarker
2024-07-17 02:59:43 +09:00
Author: https://github.com/mattco98 Commit: https://github.com/SerenityOS/serenity/commit/892f407d75 Pull-request: https://github.com/SerenityOS/serenity/pull/23400 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/kalenikaliaksandr Reviewed-by: https://github.com/nico
@ -760,6 +760,9 @@ static ErrorOr<void> cascade_custom_properties(DOM::Element& element, Optional<C
|
||||
|
||||
static ErrorOr<NonnullRefPtr<StyleValue const>> 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<double>(delta)](auto from, auto to) {
|
||||
return static_cast<RemoveCVReference<decltype(from)>>(static_cast<double>(from) + static_cast<double>(to - from) * delta);
|
||||
};
|
||||
@ -833,12 +836,6 @@ static ErrorOr<NonnullRefPtr<StyleValue const>> interpolate_value(StyleValue con
|
||||
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<StyleValue const>> 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:
|
||||
|
Loading…
Reference in New Issue
Block a user