mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 18:50:50 +00:00
LibWeb/CSS: Add basic implementation of CSSMarginRule
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.
This commit is contained in:
parent
aa9fa88428
commit
870f24f181
Notes:
github-actions[bot]
2025-05-16 10:02:36 +00:00
Author: https://github.com/AtkinsSJ
Commit: 870f24f181
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4746
21 changed files with 233 additions and 32 deletions
40
Libraries/LibWeb/CSS/CSSMarginRule.h
Normal file
40
Libraries/LibWeb/CSS/CSSMarginRule.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue