1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:07:35 +00:00

LibWeb: Rough implementation of CSS namespace rule

This provides a rough implementation of the CSS @namespace rule.
Currently we just support default namespaces, namespace prefixes
are still to come.
This commit is contained in:
Jonah 2023-07-29 11:51:15 -05:00 committed by Sam Atkins
parent 3f7d97f098
commit 60e35f2a97
18 changed files with 266 additions and 3 deletions

View file

@ -0,0 +1,37 @@
/*
* Copyright (c) 2023, Jonah Shafran <jonahshafran@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/CSS/CSSRule.h>
namespace Web::CSS {
class CSSNamespaceRule final : public CSSRule {
WEB_PLATFORM_OBJECT(CSSNamespaceRule, CSSRule);
public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<CSSNamespaceRule>> create(JS::Realm&, Optional<StringView> prefix, StringView namespace_uri);
virtual ~CSSNamespaceRule() = default;
void set_namespace_uri(DeprecatedString value) { m_namespace_uri = move(value); }
DeprecatedString namespace_uri() const { return m_namespace_uri; }
void set_prefix(DeprecatedString value) { m_prefix = move(value); }
DeprecatedString prefix() const { return m_prefix; }
virtual Type type() const override { return Type::Namespace; }
private:
CSSNamespaceRule(JS::Realm&, Optional<StringView> prefix, StringView namespace_uri);
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual DeprecatedString serialized() const override;
DeprecatedString m_namespace_uri;
DeprecatedString m_prefix;
};
}