mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb/CSS: Implement CSSUnparsedValue and CSSVariableReferenceValue
We don't serialize these the way WPT expects, because we don't implement the comment-insertion rules from CSS-Syntax. We don't implement that for regular serialization either, so it's something we can worry about later.
This commit is contained in:
Notes:
github-actions[bot]
2025-08-21 09:23:12 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/6428c9990d2 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5901
42
Libraries/LibWeb/CSS/CSSVariableReferenceValue.h
Normal file
42
Libraries/LibWeb/CSS/CSSVariableReferenceValue.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/FlyString.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
class CSSVariableReferenceValue : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(CSSVariableReferenceValue, Bindings::PlatformObject);
|
||||
GC_DECLARE_ALLOCATOR(CSSVariableReferenceValue);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static GC::Ref<CSSVariableReferenceValue> create(JS::Realm&, FlyString variable, GC::Ptr<CSSUnparsedValue> fallback = nullptr);
|
||||
static WebIDL::ExceptionOr<GC::Ref<CSSVariableReferenceValue>> construct_impl(JS::Realm&, FlyString variable, GC::Ptr<CSSUnparsedValue> fallback);
|
||||
|
||||
virtual ~CSSVariableReferenceValue() override;
|
||||
|
||||
String variable() const;
|
||||
WebIDL::ExceptionOr<void> set_variable(FlyString);
|
||||
|
||||
GC::Ptr<CSSUnparsedValue> fallback() const;
|
||||
WebIDL::ExceptionOr<void> set_fallback(GC::Ptr<CSSUnparsedValue>);
|
||||
|
||||
String to_string() const;
|
||||
|
||||
private:
|
||||
CSSVariableReferenceValue(JS::Realm&, FlyString variable, GC::Ptr<CSSUnparsedValue> fallback);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
FlyString m_variable;
|
||||
GC::Ptr<CSSUnparsedValue> m_fallback;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user