mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-19 02:10:26 +00:00
No parsing yet, just CSSContainerRule and the supporting ContainerQuery class. CSSContainerRule is unusual in how it matches, because instead of it either matching or not matching globally, it instead is matched against a specific element. But also, some at-rules inside it always apply, as if they were written outside it. This doesn't fit well with how CSSConditionRule is implemented, and will likely require some rework later. For now, `condition_matches()` always returns false, and `for_each_effective_rule()` is overridden to always process those global at-rules and nothing else.
32 lines
770 B
C++
32 lines
770 B
C++
/*
|
|
* Copyright (c) 2026, Sam Atkins <sam@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/NonnullOwnPtr.h>
|
|
#include <AK/RefCounted.h>
|
|
#include <LibWeb/CSS/BooleanExpression.h>
|
|
|
|
namespace Web::CSS {
|
|
|
|
// https://drafts.csswg.org/css-conditional-5/#container-rule
|
|
class WEB_API ContainerQuery final : public RefCounted<ContainerQuery> {
|
|
public:
|
|
static NonnullRefPtr<ContainerQuery> create(NonnullOwnPtr<BooleanExpression>&&);
|
|
|
|
bool matches() const { return m_matches; }
|
|
String to_string() const;
|
|
|
|
void dump(StringBuilder&, int indent_levels = 0) const;
|
|
|
|
private:
|
|
explicit ContainerQuery(NonnullOwnPtr<BooleanExpression>&&);
|
|
|
|
NonnullOwnPtr<BooleanExpression> m_condition;
|
|
bool m_matches { false };
|
|
};
|
|
|
|
}
|