diff --git a/Libraries/LibWeb/Animations/KeyframeEffect.cpp b/Libraries/LibWeb/Animations/KeyframeEffect.cpp index 8370ff47ac5..1dc16f06e32 100644 --- a/Libraries/LibWeb/Animations/KeyframeEffect.cpp +++ b/Libraries/LibWeb/Animations/KeyframeEffect.cpp @@ -864,7 +864,7 @@ WebIDL::ExceptionOr KeyframeEffect::set_keyframes(Optionalis_unresolved() && target) property_value = CSS::Parser::Parser::resolve_unresolved_style_value(CSS::Parser::ParsingParams { target->document() }, *target, pseudo_element_type(), property_id, property_value->as_unresolved()); - CSS::StyleComputer::for_each_property_expanding_shorthands(property_id, property_value, CSS::StyleComputer::AllowUnresolved::Yes, [&](CSS::PropertyID longhand_id, CSS::CSSStyleValue const& longhand_value) { + CSS::StyleComputer::for_each_property_expanding_shorthands(property_id, property_value, [&](CSS::PropertyID longhand_id, CSS::CSSStyleValue const& longhand_value) { m_target_properties.set(longhand_id); resolved_keyframe.properties.set(longhand_id, NonnullRefPtr { longhand_value }); }); diff --git a/Libraries/LibWeb/CSS/CSSStyleProperties.cpp b/Libraries/LibWeb/CSS/CSSStyleProperties.cpp index 19309dfd6cc..1a23f5da009 100644 --- a/Libraries/LibWeb/CSS/CSSStyleProperties.cpp +++ b/Libraries/LibWeb/CSS/CSSStyleProperties.cpp @@ -242,7 +242,7 @@ WebIDL::ExceptionOr CSSStyleProperties::set_property(StringView property_n // 8. If property is a shorthand property, if (property_is_shorthand(property_id)) { // then for each longhand property longhand that property maps to, in canonical order, follow these substeps: - StyleComputer::for_each_property_expanding_shorthands(property_id, *component_value_list, StyleComputer::AllowUnresolved::Yes, [this, &updated, priority](PropertyID longhand_property_id, CSSStyleValue const& longhand_value) { + StyleComputer::for_each_property_expanding_shorthands(property_id, *component_value_list, [this, &updated, priority](PropertyID longhand_property_id, CSSStyleValue const& longhand_value) { // 1. Let longhand result be the result of set the CSS declaration longhand with the appropriate value(s) from component value list, // with the important flag set if priority is not the empty string, and unset otherwise, and with the list of declarations being the declarations. // 2. If longhand result is true, let updated be true. diff --git a/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Libraries/LibWeb/CSS/Parser/Parser.cpp index 846954ab302..09d7cbb997b 100644 --- a/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -1328,7 +1328,7 @@ Parser::PropertiesAndCustomProperties Parser::parse_as_property_declaration_bloc Vector expanded_properties; for (auto& property : properties) { if (property_is_shorthand(property.property_id)) { - StyleComputer::for_each_property_expanding_shorthands(property.property_id, *property.value, StyleComputer::AllowUnresolved::Yes, [&](PropertyID longhand_property_id, CSSStyleValue const& longhand_value) { + StyleComputer::for_each_property_expanding_shorthands(property.property_id, *property.value, [&](PropertyID longhand_property_id, CSSStyleValue const& longhand_value) { expanded_properties.append(CSS::StyleProperty { .important = property.important, .property_id = longhand_property_id, diff --git a/Libraries/LibWeb/CSS/StyleComputer.cpp b/Libraries/LibWeb/CSS/StyleComputer.cpp index 09191d09823..938fd3cd1e3 100644 --- a/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -610,7 +610,7 @@ static void sort_matching_rules(Vector& matching_rules) }); } -void StyleComputer::for_each_property_expanding_shorthands(PropertyID property_id, CSSStyleValue const& value, AllowUnresolved allow_unresolved, Function const& set_longhand_property) +void StyleComputer::for_each_property_expanding_shorthands(PropertyID property_id, CSSStyleValue const& value, Function const& set_longhand_property) { if (property_is_shorthand(property_id) && (value.is_unresolved() || value.is_pending_substitution())) { // If a shorthand property contains an arbitrary substitution function in its value, the longhand properties @@ -622,7 +622,7 @@ void StyleComputer::for_each_property_expanding_shorthands(PropertyID property_i set_longhand_property(property_id, value); auto pending_substitution_value = PendingSubstitutionStyleValue::create(); for (auto longhand_id : longhands_for_shorthand(property_id)) { - for_each_property_expanding_shorthands(longhand_id, pending_substitution_value, allow_unresolved, set_longhand_property); + for_each_property_expanding_shorthands(longhand_id, pending_substitution_value, set_longhand_property); } return; } @@ -712,7 +712,7 @@ void StyleComputer::for_each_property_expanding_shorthands(PropertyID property_i }; if (auto real_property_id = map_logical_property_to_real_property(property_id); real_property_id.has_value()) { - for_each_property_expanding_shorthands(real_property_id.value(), value, allow_unresolved, set_longhand_property); + for_each_property_expanding_shorthands(real_property_id.value(), value, set_longhand_property); return; } @@ -720,12 +720,12 @@ void StyleComputer::for_each_property_expanding_shorthands(PropertyID property_i if (value.is_value_list() && value.as_value_list().size() == 2) { auto const& start = value.as_value_list().values()[0]; auto const& end = value.as_value_list().values()[1]; - for_each_property_expanding_shorthands(real_property_ids->start, start, allow_unresolved, set_longhand_property); - for_each_property_expanding_shorthands(real_property_ids->end, end, allow_unresolved, set_longhand_property); + for_each_property_expanding_shorthands(real_property_ids->start, start, set_longhand_property); + for_each_property_expanding_shorthands(real_property_ids->end, end, set_longhand_property); return; } - for_each_property_expanding_shorthands(real_property_ids->start, value, allow_unresolved, set_longhand_property); - for_each_property_expanding_shorthands(real_property_ids->end, value, allow_unresolved, set_longhand_property); + for_each_property_expanding_shorthands(real_property_ids->start, value, set_longhand_property); + for_each_property_expanding_shorthands(real_property_ids->end, value, set_longhand_property); return; } @@ -734,7 +734,7 @@ void StyleComputer::for_each_property_expanding_shorthands(PropertyID property_i auto& properties = shorthand_value.sub_properties(); auto& values = shorthand_value.values(); for (size_t i = 0; i < properties.size(); ++i) - for_each_property_expanding_shorthands(properties[i], values[i], allow_unresolved, set_longhand_property); + for_each_property_expanding_shorthands(properties[i], values[i], set_longhand_property); return; } @@ -763,10 +763,10 @@ void StyleComputer::for_each_property_expanding_shorthands(PropertyID property_i }; if (property_id == CSS::PropertyID::Border) { - for_each_property_expanding_shorthands(CSS::PropertyID::BorderTop, value, allow_unresolved, set_longhand_property); - for_each_property_expanding_shorthands(CSS::PropertyID::BorderRight, value, allow_unresolved, set_longhand_property); - for_each_property_expanding_shorthands(CSS::PropertyID::BorderBottom, value, allow_unresolved, set_longhand_property); - for_each_property_expanding_shorthands(CSS::PropertyID::BorderLeft, value, allow_unresolved, set_longhand_property); + for_each_property_expanding_shorthands(CSS::PropertyID::BorderTop, value, set_longhand_property); + for_each_property_expanding_shorthands(CSS::PropertyID::BorderRight, value, set_longhand_property); + for_each_property_expanding_shorthands(CSS::PropertyID::BorderBottom, value, set_longhand_property); + for_each_property_expanding_shorthands(CSS::PropertyID::BorderLeft, value, set_longhand_property); // FIXME: Also reset border-image, in line with the spec: https://www.w3.org/TR/css-backgrounds-3/#border-shorthands return; } @@ -989,7 +989,7 @@ void StyleComputer::for_each_property_expanding_shorthands(PropertyID property_i // (eg `grid` -> `grid-template` -> `grid-template-areas` & `grid-template-rows` & `grid-template-columns`) VERIFY(value.is_css_wide_keyword() || value.is_guaranteed_invalid()); for (auto longhand : longhands_for_shorthand(property_id)) - for_each_property_expanding_shorthands(longhand, value, allow_unresolved, set_longhand_property); + for_each_property_expanding_shorthands(longhand, value, set_longhand_property); return; } @@ -1005,7 +1005,7 @@ void StyleComputer::set_property_expanding_shorthands( Important important, Optional layer_name) { - for_each_property_expanding_shorthands(property_id, value, AllowUnresolved::No, [&](PropertyID longhand_id, CSSStyleValue const& longhand_value) { + for_each_property_expanding_shorthands(property_id, value, [&](PropertyID longhand_id, CSSStyleValue const& longhand_value) { if (longhand_value.is_revert()) { cascaded_properties.revert_property(longhand_id, important, cascade_origin); } else if (longhand_value.is_revert_layer()) { @@ -1097,7 +1097,7 @@ void StyleComputer::cascade_declarations( } // NOTE: This is a duplicate of set_property_expanding_shorthands() with some extra checks. - for_each_property_expanding_shorthands(property.property_id, property_value, AllowUnresolved::No, [&](PropertyID longhand_id, CSSStyleValue const& longhand_value) { + for_each_property_expanding_shorthands(property.property_id, property_value, [&](PropertyID longhand_id, CSSStyleValue const& longhand_value) { // If we're a PSV that's already been seen, that should mean that our shorthand already got // resolved and gave us a value, so we don't want to overwrite it with a PSV. if (seen_properties.get(to_underlying(longhand_id)) && property_value->is_pending_substitution()) @@ -1232,7 +1232,7 @@ void StyleComputer::collect_animation_into(DOM::Element& element, Optionalis_unresolved()) style_value = Parser::Parser::resolve_unresolved_style_value(Parser::ParsingParams { element.document() }, element, pseudo_element, property_id, style_value->as_unresolved()); - for_each_property_expanding_shorthands(property_id, *style_value, AllowUnresolved::No, [&result](PropertyID id, CSSStyleValue const& longhand_value) { + for_each_property_expanding_shorthands(property_id, *style_value, [&result](PropertyID id, CSSStyleValue const& longhand_value) { result.set(id, { longhand_value }); }); } @@ -2946,7 +2946,7 @@ void StyleComputer::make_rule_cache_for_cascade_origin(CascadeOrigin cascade_ori auto const& keyframe_style = *keyframe.style(); for (auto const& it : keyframe_style.properties()) { // Unresolved properties will be resolved in collect_animation_into() - for_each_property_expanding_shorthands(it.property_id, it.value, AllowUnresolved::Yes, [&](PropertyID shorthand_id, CSSStyleValue const& shorthand_value) { + for_each_property_expanding_shorthands(it.property_id, it.value, [&](PropertyID shorthand_id, CSSStyleValue const& shorthand_value) { animated_properties.set(shorthand_id); resolved_keyframe.properties.set(shorthand_id, NonnullRefPtr { shorthand_value }); }); diff --git a/Libraries/LibWeb/CSS/StyleComputer.h b/Libraries/LibWeb/CSS/StyleComputer.h index 05dd8fd0a66..9e290fbb12b 100644 --- a/Libraries/LibWeb/CSS/StyleComputer.h +++ b/Libraries/LibWeb/CSS/StyleComputer.h @@ -128,11 +128,7 @@ class FontLoader; class StyleComputer { public: - enum class AllowUnresolved { - Yes, - No, - }; - static void for_each_property_expanding_shorthands(PropertyID, CSSStyleValue const&, AllowUnresolved, Function const& set_longhand_property); + static void for_each_property_expanding_shorthands(PropertyID, CSSStyleValue const&, Function const& set_longhand_property); static void set_property_expanding_shorthands( CascadedProperties&, PropertyID,