ladybird/Libraries/LibWeb/CSS/StylePropertyMap.h
Shannon Booth 637fd51595 LibWeb: Unify WebIDL C++ type generation
Represent WebIDL C++ types with a single CppType model that tracks
nullability, optional presence, and contained storage.

GC-like values now use GC::Ref/GC::Ptr directly, while containers choose
"plain", "Root", or "Conservative" container types depending on what
they contain. For example, sequence<Element> becomes a RootVector of
GC::Ref values, while sequence<SomeDictionary> becomes a
ConservativeVector only when the dictionary contains GC-like values.
This moves the generated bindings away from wrapping GC values in
GC::Root by default.

This has broad fallout as the types passed to interfaces for GC
objects changes almost fully across the board.
2026-05-23 18:26:12 +02:00

36 lines
1.1 KiB
C++

/*
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/CSS/StylePropertyMapReadOnly.h>
namespace Web::CSS {
// https://drafts.css-houdini.org/css-typed-om-1/#stylepropertymap
class StylePropertyMap : public StylePropertyMapReadOnly {
WEB_PLATFORM_OBJECT(StylePropertyMap, StylePropertyMapReadOnly);
GC_DECLARE_ALLOCATOR(StylePropertyMap);
public:
[[nodiscard]] static GC::Ref<StylePropertyMap> create(JS::Realm&, GC::Ref<CSSStyleDeclaration>);
virtual ~StylePropertyMap() override;
WebIDL::ExceptionOr<void> set(FlyString property, ReadonlySpan<Variant<GC::Ref<CSSStyleValue>, String>> values);
WebIDL::ExceptionOr<void> append(FlyString property, ReadonlySpan<Variant<GC::Ref<CSSStyleValue>, String>> values);
WebIDL::ExceptionOr<void> delete_(FlyString property);
WebIDL::ExceptionOr<void> clear();
private:
explicit StylePropertyMap(JS::Realm&, GC::Ref<CSSStyleDeclaration>);
CSSStyleDeclaration& declarations();
virtual void initialize(JS::Realm&) override;
};
}