ladybird/Userland/Libraries/LibWeb/CSS/Parser/StyleFunctionRule.h
Sam Atkins 23dc0dac88 LibWeb: Parse and resolve UnresolvedStyleValues
If a property is custom or contains a `var()` reference, it cannot be
parsed into a proper StyleValue immediately, so we store it as an
UnresolvedStyleValue until the property is compute. Then, at compute
time, we resolve them by expanding out any `var()` references, and
parsing the result.

The implementation here is very naive, and involves copying the
UnresolvedStyleValue's tree of StyleComponentValueRules while copying
the contents of any `var()`s it finds along the way. This is quite an
expensive operation to do every time that the style is computed.
2021-12-09 21:30:31 +01:00

36 lines
853 B
C++

/*
* Copyright (c) 2020-2021, the SerenityOS developers.
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefCounted.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibWeb/CSS/Parser/StyleComponentValueRule.h>
namespace Web::CSS {
class StyleComponentValueRule;
class StyleFunctionRule : public RefCounted<StyleFunctionRule> {
friend class Parser;
public:
explicit StyleFunctionRule(String name);
StyleFunctionRule(String name, Vector<StyleComponentValueRule>&& values);
~StyleFunctionRule();
String const& name() const { return m_name; }
Vector<StyleComponentValueRule> const& values() const { return m_values; }
String to_string() const;
private:
String m_name;
Vector<StyleComponentValueRule> m_values;
};
}