LibWeb: Add and use CSSStyleProperties helpers in Algorithms code

This commit is contained in:
Sam Atkins 2025-09-26 12:24:51 +01:00
commit ce7a8418ed
Notes: github-actions[bot] 2025-10-02 12:47:44 +00:00
3 changed files with 22 additions and 11 deletions

View file

@ -385,6 +385,11 @@ bool CSSStyleProperties::has_property(PropertyNameAndID const& property) const
return get_property_internal(property).has_value();
}
bool CSSStyleProperties::has_property(PropertyID property_id) const
{
return has_property(PropertyNameAndID::from_id(property_id));
}
RefPtr<StyleValue const> CSSStyleProperties::get_property_style_value(PropertyNameAndID const& property) const
{
if (auto style_property = get_property_internal(property); style_property.has_value())
@ -392,6 +397,11 @@ RefPtr<StyleValue const> CSSStyleProperties::get_property_style_value(PropertyNa
return nullptr;
}
RefPtr<StyleValue const> CSSStyleProperties::get_property_style_value(PropertyID property_id) const
{
return get_property_style_value(PropertyNameAndID::from_id(property_id));
}
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertyvalue
Optional<StyleProperty> CSSStyleProperties::get_property_internal(PropertyNameAndID const& property) const
{