mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 14:19:48 +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:
parent
aacf9b08ed
commit
a94282e0e8
Notes:
github-actions[bot]
2024-11-14 18:51:15 +00:00
Author: https://github.com/Lubrsi
Commit: a94282e0e8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2346
3 changed files with 247 additions and 0 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue