mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-04 15:19:16 +00:00
CSSStyleValue is adjusted to allow for subclasses. Serialization for CSSKeywordValue is implemented differently than the spec says because of a spec bug: https://github.com/w3c/csswg-drafts/issues/12545
38 lines
981 B
C++
38 lines
981 B
C++
/*
|
|
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/FlyString.h>
|
|
#include <LibWeb/CSS/CSSStyleValue.h>
|
|
|
|
namespace Web::CSS {
|
|
|
|
// https://drafts.css-houdini.org/css-typed-om-1/#csskeywordvalue
|
|
class CSSKeywordValue : public CSSStyleValue {
|
|
WEB_PLATFORM_OBJECT(CSSKeywordValue, CSSStyleValue);
|
|
GC_DECLARE_ALLOCATOR(CSSKeywordValue);
|
|
|
|
public:
|
|
[[nodiscard]] static GC::Ref<CSSKeywordValue> create(JS::Realm&, FlyString value);
|
|
static WebIDL::ExceptionOr<GC::Ref<CSSKeywordValue>> construct_impl(JS::Realm&, FlyString value);
|
|
|
|
virtual ~CSSKeywordValue() override = default;
|
|
|
|
FlyString const& value() const { return m_value; }
|
|
WebIDL::ExceptionOr<void> set_value(FlyString value);
|
|
|
|
virtual String to_string() const override;
|
|
|
|
private:
|
|
explicit CSSKeywordValue(JS::Realm&, FlyString value);
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
|
|
FlyString m_value;
|
|
};
|
|
|
|
}
|