mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:07:34 +00:00
LibWeb: Implement @supports
rule :^)
The main thing missing is that we don't serialize the supports clause, but for actually using a `@supports (something: cool) {}` rule in CSS, it works!
This commit is contained in:
parent
439d978ea5
commit
57a25139a5
9 changed files with 129 additions and 0 deletions
34
Userland/Libraries/LibWeb/CSS/CSSSupportsRule.cpp
Normal file
34
Userland/Libraries/LibWeb/CSS/CSSSupportsRule.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/CSS/CSSSupportsRule.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
CSSSupportsRule::CSSSupportsRule(NonnullRefPtr<Supports>&& supports, NonnullRefPtrVector<CSSRule>&& rules)
|
||||
: CSSConditionRule(move(rules))
|
||||
, m_supports(move(supports))
|
||||
{
|
||||
}
|
||||
|
||||
CSSSupportsRule::~CSSSupportsRule()
|
||||
{
|
||||
}
|
||||
|
||||
String CSSSupportsRule::condition_text() const
|
||||
{
|
||||
// FIXME: Serializing supports rules!
|
||||
return "<supports-condition>";
|
||||
}
|
||||
|
||||
void CSSSupportsRule::set_condition_text(String text)
|
||||
{
|
||||
if (auto new_supports = parse_css_supports({}, text))
|
||||
m_supports = new_supports.release_nonnull();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue