2025-08-08 12:57:23 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
|
|
|
// https://drafts.css-houdini.org/css-typed-om-1/#cssstylevalue
|
|
|
|
class CSSStyleValue : public Bindings::PlatformObject {
|
|
|
|
WEB_PLATFORM_OBJECT(CSSStyleValue, Bindings::PlatformObject);
|
|
|
|
GC_DECLARE_ALLOCATOR(CSSStyleValue);
|
|
|
|
|
|
|
|
public:
|
2025-08-13 14:46:21 +01:00
|
|
|
[[nodiscard]] static GC::Ref<CSSStyleValue> create(JS::Realm&, String associated_property, String constructed_from_string);
|
2025-08-08 12:57:23 +01:00
|
|
|
|
|
|
|
virtual ~CSSStyleValue() override = default;
|
|
|
|
|
2025-08-14 12:33:40 +01:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
|
|
|
2025-08-14 13:55:45 +01:00
|
|
|
static WebIDL::ExceptionOr<GC::Ref<CSSStyleValue>> parse(JS::VM&, String property, String css_text);
|
|
|
|
static WebIDL::ExceptionOr<GC::RootVector<GC::Ref<CSSStyleValue>>> parse_all(JS::VM&, String property, String css_text);
|
|
|
|
|
2025-08-08 12:57:23 +01:00
|
|
|
virtual String to_string() const;
|
|
|
|
|
2025-08-14 12:33:40 +01:00
|
|
|
protected:
|
|
|
|
explicit CSSStyleValue(JS::Realm&);
|
|
|
|
|
2025-08-08 12:57:23 +01:00
|
|
|
private:
|
2025-08-13 14:46:21 +01:00
|
|
|
explicit CSSStyleValue(JS::Realm&, String associated_property, String constructed_from_string);
|
2025-08-08 12:57:23 +01:00
|
|
|
|
2025-08-14 13:55:45 +01:00
|
|
|
enum class ParseMultiple : u8 {
|
|
|
|
No,
|
|
|
|
Yes,
|
|
|
|
};
|
|
|
|
static WebIDL::ExceptionOr<Variant<GC::Ref<CSSStyleValue>, GC::RootVector<GC::Ref<CSSStyleValue>>>> parse_a_css_style_value(JS::VM&, String property, String css_text, ParseMultiple);
|
|
|
|
|
2025-08-08 12:57:23 +01:00
|
|
|
// https://drafts.css-houdini.org/css-typed-om-1/#dom-cssstylevalue-associatedproperty-slot
|
|
|
|
Optional<String> m_associated_property;
|
|
|
|
|
|
|
|
Optional<String> m_constructed_from_string;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|