mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 12:18:25 +00:00
LibWeb: Make CSSStyleDeclaration a legacy platform object with indices
CSSStyleDeclaration has an indexed property getter, which returns properties associated with the object in the order they were specified in.
This commit is contained in:
committed by
Andreas Kling
parent
aacf9b08ed
commit
a94282e0e8
@@ -24,6 +24,9 @@ JS_DEFINE_ALLOCATOR(ElementInlineCSSStyleDeclaration);
|
||||
CSSStyleDeclaration::CSSStyleDeclaration(JS::Realm& realm)
|
||||
: PlatformObject(realm)
|
||||
{
|
||||
m_legacy_platform_object_flags = LegacyPlatformObjectFlags {
|
||||
.supports_indexed_properties = true,
|
||||
};
|
||||
}
|
||||
|
||||
void CSSStyleDeclaration::initialize(JS::Realm& realm)
|
||||
@@ -328,6 +331,15 @@ WebIDL::ExceptionOr<void> CSSStyleDeclaration::set_css_float(StringView value)
|
||||
return set_property("float"sv, value, ""sv);
|
||||
}
|
||||
|
||||
Optional<JS::Value> CSSStyleDeclaration::item_value(size_t index) const
|
||||
{
|
||||
auto value = item(index);
|
||||
if (value.is_empty())
|
||||
return {};
|
||||
|
||||
return JS::PrimitiveString::create(vm(), value);
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom/#serialize-a-css-declaration
|
||||
static String serialize_a_css_declaration(CSS::PropertyID property, StringView value, Important important)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user