1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-12 02:30:30 +09:00
ladybird/Libraries/LibWeb/CSS/StyleValues/TransitionStyleValue.cpp
Tim Ledbetter 542c3cbe51 LibWeb: Implement the transition-behavior CSS property
This specifies whether transitions should be started for transitions
whose animation behavior is discrete.
2025-05-02 11:07:19 +01:00

41 lines
1.2 KiB
C++

/*
* Copyright (c) 2024, Matthew Olsson <mattco@serenityos.org>.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/StyleValues/TransitionStyleValue.h>
namespace Web::CSS {
String TransitionStyleValue::to_string(SerializationMode mode) const
{
StringBuilder builder;
bool first = true;
for (auto const& transition : m_transitions) {
if (!first)
builder.append(", "sv);
first = false;
builder.appendff("{} {} {} {}", transition.property_name->to_string(mode), transition.duration, transition.easing->to_string(mode), transition.delay);
if (transition.transition_behavior != TransitionBehavior::Normal)
builder.appendff(" {}", CSS::to_string(transition.transition_behavior));
}
return MUST(builder.to_string());
}
bool TransitionStyleValue::properties_equal(TransitionStyleValue const& other) const
{
if (m_transitions.size() != other.m_transitions.size())
return false;
for (size_t i = 0; i < m_transitions.size(); i++) {
if (m_transitions[i] != other.m_transitions[i])
return false;
}
return true;
}
}