mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 12:49:19 +00:00
LibWeb: Add basic implementation of @page
This doesn't support selectors, and the only descriptors for now are for margins.
This commit is contained in:
parent
1002464322
commit
aaf07ae30d
Notes:
github-actions[bot]
2025-05-15 08:54:53 +00:00
Author: https://github.com/AtkinsSJ
Commit: aaf07ae30d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4735
27 changed files with 471 additions and 20 deletions
42
Libraries/LibWeb/CSS/CSSPageRule.h
Normal file
42
Libraries/LibWeb/CSS/CSSPageRule.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/CSS/CSSGroupingRule.h>
|
||||
#include <LibWeb/CSS/CSSPageDescriptors.h>
|
||||
#include <LibWeb/CSS/Selector.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
// https://drafts.csswg.org/css-page-3/#at-ruledef-page
|
||||
class CSSPageRule final : public CSSGroupingRule {
|
||||
WEB_PLATFORM_OBJECT(CSSPageRule, CSSGroupingRule);
|
||||
GC_DECLARE_ALLOCATOR(CSSPageRule);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static GC::Ref<CSSPageRule> create(JS::Realm&, SelectorList&&, GC::Ref<CSSPageDescriptors>, CSSRuleList&);
|
||||
|
||||
virtual ~CSSPageRule() override = default;
|
||||
|
||||
String selector_text() const;
|
||||
void set_selector_text(StringView);
|
||||
|
||||
GC::Ref<CSSPageDescriptors> style() { return m_style; }
|
||||
GC::Ref<CSSPageDescriptors const> descriptors() const { return m_style; }
|
||||
|
||||
private:
|
||||
CSSPageRule(JS::Realm&, SelectorList&&, GC::Ref<CSSPageDescriptors>, CSSRuleList&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual String serialized() const override;
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
SelectorList m_selectors;
|
||||
GC::Ref<CSSPageDescriptors> m_style;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue