/* * Copyright (c) 2021, Sam Atkins * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include #include namespace Web::CSS { class Supports final : public RefCounted { friend class Parser; public: struct Feature { String declaration; MatchResult evaluate() const; }; struct Condition; struct InParens { Variant, Feature, GeneralEnclosed> value; MatchResult evaluate() const; }; struct Condition { enum class Type { Not, And, Or, }; Type type; Vector children; MatchResult evaluate() const; }; static NonnullRefPtr create(NonnullOwnPtr&& condition) { return adopt_ref(*new Supports(move(condition))); } bool matches() const { return m_matches; } private: Supports(NonnullOwnPtr&&); NonnullOwnPtr m_condition; bool m_matches { false }; }; }