ladybird/Libraries/LibWeb/CSS/PageSelector.h
Sam Atkins 107b47f884 LibWeb/CSS: Move PageSelector into its own files
The main motivation here is that the CSS Parser needs to know about
PageSelectorList so that we can parse one in
`CSSPageRule::set_selector_text()`. Including all of `CSSPageRule.h`
there would pull in a lot of other headers that aren't needed.
2025-05-16 16:42:10 +01:00

38 lines
818 B
C++

/*
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/FlyString.h>
#include <AK/Optional.h>
#include <AK/Vector.h>
namespace Web::CSS {
enum class PagePseudoClass : u8 {
Left,
Right,
First,
Blank,
};
Optional<PagePseudoClass> page_pseudo_class_from_string(StringView);
StringView to_string(PagePseudoClass);
class PageSelector {
public:
PageSelector(Optional<FlyString> name, Vector<PagePseudoClass>);
Optional<FlyString> name() const { return m_name; }
Vector<PagePseudoClass> const& pseudo_classes() const { return m_pseudo_classes; }
String serialize() const;
private:
Optional<FlyString> m_name;
Vector<PagePseudoClass> m_pseudo_classes;
};
using PageSelectorList = Vector<PageSelector>;
}