diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h index eebb270642..dfa31ddb15 100644 --- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h +++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h @@ -87,6 +87,7 @@ public: static CSS::Size row_gap() { return CSS::Size::make_auto(); } static CSS::BorderCollapse border_collapse() { return CSS::BorderCollapse::Separate; } static Vector> grid_template_areas() { return {}; } + static CSS::Time transition_delay() { return CSS::Time::make_seconds(0); } }; enum class BackgroundSize { @@ -305,6 +306,7 @@ public: float font_size() const { return m_inherited.font_size; } int font_weight() const { return m_inherited.font_weight; } CSS::FontVariant font_variant() const { return m_inherited.font_variant; } + CSS::Time transition_delay() const { return m_noninherited.transition_delay; } ComputedValues clone_inherited_values() const { @@ -406,6 +408,7 @@ protected: Vector> grid_template_areas { InitialValues::grid_template_areas() }; Gfx::Color stop_color { InitialValues::stop_color() }; float stop_opacity { InitialValues::stop_opacity() }; + CSS::Time transition_delay { InitialValues::transition_delay() }; } m_noninherited; }; @@ -493,6 +496,7 @@ public: void set_row_gap(CSS::Size const& row_gap) { m_noninherited.row_gap = row_gap; } void set_border_collapse(CSS::BorderCollapse const& border_collapse) { m_noninherited.border_collapse = border_collapse; } void set_grid_template_areas(Vector> const& grid_template_areas) { m_noninherited.grid_template_areas = grid_template_areas; } + void set_transition_delay(CSS::Time const& transition_delay) { m_noninherited.transition_delay = transition_delay; } void set_fill(SVGPaint value) { m_inherited.fill = value; } void set_stroke(SVGPaint value) { m_inherited.stroke = value; } diff --git a/Userland/Libraries/LibWeb/CSS/Properties.json b/Userland/Libraries/LibWeb/CSS/Properties.json index 4ca89f0a2d..df791db845 100644 --- a/Userland/Libraries/LibWeb/CSS/Properties.json +++ b/Userland/Libraries/LibWeb/CSS/Properties.json @@ -1763,6 +1763,13 @@ "top" ] }, + "transition-delay": { + "inherited": false, + "initial": "0s", + "valid-types": [ + "time" + ] + }, "user-select": { "affects-layout": false, "inherited": false, diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index f576125969..ab666f0612 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -767,8 +768,10 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p StyleValueVector matrix_functions { matrix_function }; return StyleValueList::create(move(matrix_functions), StyleValueList::Separator::Space); } - case PropertyID::VerticalAlign: - if (auto const* length_percentage = layout_node.computed_values().vertical_align().get_pointer()) { + case CSS::PropertyID::TransitionDelay: + return TimeStyleValue::create(layout_node.computed_values().transition_delay()); + case CSS::PropertyID::VerticalAlign: + if (auto const* length_percentage = layout_node.computed_values().vertical_align().get_pointer()) { return style_value_for_length_percentage(*length_percentage); } return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().vertical_align().get())); diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index 69398f9ed7..57b63f0d08 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -609,6 +610,15 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style) computed_values.set_transformations(computed_style.transformations()); computed_values.set_transform_origin(computed_style.transform_origin()); + auto transition_delay_property = computed_style.property(CSS::PropertyID::TransitionDelay); + if (transition_delay_property->is_time()) { + auto& transition_delay = transition_delay_property->as_time(); + computed_values.set_transition_delay(transition_delay.time()); + } else if (transition_delay_property->is_calculated()) { + auto& transition_delay = transition_delay_property->as_calculated(); + computed_values.set_transition_delay(transition_delay.resolve_time().value()); + } + auto do_border_style = [&](CSS::BorderData& border, CSS::PropertyID width_property, CSS::PropertyID color_property, CSS::PropertyID style_property) { // FIXME: The default border color value is `currentcolor`, but since we can't resolve that easily, // we just manually grab the value from `color`. This makes it dependent on `color` being