mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-01 06:31:53 +00:00
This is a bit under-specced, specifically there's no definition of CSSMarginDescriptors so I've gone with CSSStyleProperties for now. Gets us 17 WPT subtests.
40 lines
1 KiB
C++
40 lines
1 KiB
C++
/*
|
|
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/CSS/CSSRule.h>
|
|
|
|
namespace Web::CSS {
|
|
|
|
// https://drafts.csswg.org/cssom/#cssmarginrule
|
|
class CSSMarginRule final : public CSSRule {
|
|
WEB_PLATFORM_OBJECT(CSSMarginRule, CSSRule);
|
|
GC_DECLARE_ALLOCATOR(CSSMarginRule);
|
|
|
|
public:
|
|
[[nodiscard]] static GC::Ref<CSSMarginRule> create(JS::Realm&, FlyString name, GC::Ref<CSSStyleProperties>);
|
|
|
|
virtual ~CSSMarginRule() override = default;
|
|
|
|
String name() const { return m_name.to_string(); }
|
|
GC::Ref<CSSStyleProperties> style() { return m_style; }
|
|
GC::Ref<CSSStyleProperties const> style() const { return m_style; }
|
|
|
|
private:
|
|
CSSMarginRule(JS::Realm&, FlyString name, GC::Ref<CSSStyleProperties>);
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
virtual String serialized() const override;
|
|
virtual void visit_edges(Visitor&) override;
|
|
|
|
FlyString m_name;
|
|
GC::Ref<CSSStyleProperties> m_style;
|
|
};
|
|
|
|
bool is_margin_rule_name(StringView);
|
|
|
|
}
|