ladybird/Libraries/LibWeb/CSS/CSS.h
norbiros 90c0decd95 LibWeb/CSS: Add CSS.registerProperty JS method
This adds an *almost* complete implementation of `CSS.registerProperty`
method enabling further progress on the `@property` feature.
2025-07-22 10:57:54 +01:00

32 lines
792 B
C++

/*
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/String.h>
#include <AK/StringView.h>
#include <LibJS/Forward.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
// https://www.w3.org/TR/cssom-1/#namespacedef-css
namespace Web::CSS {
struct PropertyDefinition {
String name;
String syntax;
bool inherits;
Optional<String> initial_value;
};
WebIDL::ExceptionOr<String> escape(JS::VM&, StringView identifier);
bool supports(JS::VM&, StringView property, StringView value);
WebIDL::ExceptionOr<bool> supports(JS::VM&, StringView condition_text);
WebIDL::ExceptionOr<void> register_property(JS::VM&, PropertyDefinition definition);
}