mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb/CSS: Add has_property() to CSSStyleDeclaration
This isn't part of the CSSOM API directly, but will be used by StylePropertyMapReadOnly.has() to avoid doing the work to serialize a string version of the property's value, just to throw it away again.
This commit is contained in:
Notes:
github-actions[bot]
2025-08-18 09:14:31 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/37ea9a4ce3f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5862 Reviewed-by: https://github.com/Calme1709
@@ -426,6 +426,14 @@ StringView CSSStyleProperties::get_property_priority(StringView property_name) c
|
||||
return maybe_property->important == Important::Yes ? "important"sv : ""sv;
|
||||
}
|
||||
|
||||
bool CSSStyleProperties::has_property(StringView property_name) const
|
||||
{
|
||||
auto property_id = property_id_from_string(property_name);
|
||||
if (!property_id.has_value())
|
||||
return false;
|
||||
return get_property_internal(*property_id).has_value();
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertyvalue
|
||||
Optional<StyleProperty> CSSStyleProperties::get_property_internal(PropertyID property_id) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user