mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
LibWeb: Expand transition longhand values
This commit is contained in:
parent
1e6ad075f3
commit
3160733c1a
Notes:
sideshowbarker
2024-07-17 21:16:31 +09:00
Author: https://github.com/mattco98 Commit: https://github.com/SerenityOS/serenity/commit/3160733c1a Pull-request: https://github.com/SerenityOS/serenity/pull/23762
1 changed files with 19 additions and 0 deletions
|
@ -59,6 +59,7 @@
|
|||
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
||||
#include <LibWeb/CSS/StyleValues/TimeStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/TransformationStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/TransitionStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/UnresolvedStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/UnsetStyleValue.h>
|
||||
#include <LibWeb/DOM/Attr.h>
|
||||
|
@ -682,6 +683,24 @@ void StyleComputer::for_each_property_expanding_shorthands(PropertyID property_i
|
|||
return;
|
||||
}
|
||||
|
||||
if (property_id == CSS::PropertyID::Transition) {
|
||||
auto const& transitions = value.as_transition().transitions();
|
||||
Array<Vector<ValueComparingNonnullRefPtr<StyleValue const>>, 4> transition_values;
|
||||
for (auto const& transition : transitions) {
|
||||
transition_values[0].append(*transition.property_name);
|
||||
transition_values[1].append(TimeStyleValue::create(transition.duration));
|
||||
transition_values[2].append(TimeStyleValue::create(transition.delay));
|
||||
if (transition.easing)
|
||||
transition_values[3].append(*transition.easing);
|
||||
}
|
||||
|
||||
set_longhand_property(CSS::PropertyID::TransitionProperty, StyleValueList::create(move(transition_values[0]), StyleValueList::Separator::Comma));
|
||||
set_longhand_property(CSS::PropertyID::TransitionDuration, StyleValueList::create(move(transition_values[1]), StyleValueList::Separator::Comma));
|
||||
set_longhand_property(CSS::PropertyID::TransitionDelay, StyleValueList::create(move(transition_values[2]), StyleValueList::Separator::Comma));
|
||||
set_longhand_property(CSS::PropertyID::TransitionTimingFunction, StyleValueList::create(move(transition_values[3]), StyleValueList::Separator::Comma));
|
||||
return;
|
||||
}
|
||||
|
||||
if (property_is_shorthand(property_id)) {
|
||||
// ShorthandStyleValue was handled already.
|
||||
// That means if we got here, that `value` must be a CSS-wide keyword, which we should apply to our longhand properties.
|
||||
|
|
Loading…
Add table
Reference in a new issue