mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-30 06:06:48 +00:00
LibWeb/CSS: Preserve whitespace and comments in custom properties
A couple of parts of this: - Store the source text for Declarations of custom properties. - Then save that in the UnresolvedStyleValue. - Serialize UnresolvedStyleValue using the saved source when available - that is, for custom properties but not for regular properties that include var() or attr().
This commit is contained in:
parent
f8995d37a2
commit
bf3e6daedb
Notes:
github-actions[bot]
2024-10-16 12:23:36 +00:00
Author: https://github.com/AtkinsSJ
Commit: bf3e6daedb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1795
4 changed files with 20 additions and 9 deletions
|
@ -17,9 +17,9 @@ namespace Web::CSS {
|
|||
|
||||
class UnresolvedStyleValue final : public CSSStyleValue {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<UnresolvedStyleValue> create(Vector<Parser::ComponentValue>&& values, bool contains_var_or_attr)
|
||||
static ValueComparingNonnullRefPtr<UnresolvedStyleValue> create(Vector<Parser::ComponentValue>&& values, bool contains_var_or_attr, Optional<String> original_source_text)
|
||||
{
|
||||
return adopt_ref(*new (nothrow) UnresolvedStyleValue(move(values), contains_var_or_attr));
|
||||
return adopt_ref(*new (nothrow) UnresolvedStyleValue(move(values), contains_var_or_attr, move(original_source_text)));
|
||||
}
|
||||
virtual ~UnresolvedStyleValue() override = default;
|
||||
|
||||
|
@ -31,15 +31,17 @@ public:
|
|||
virtual bool equals(CSSStyleValue const& other) const override;
|
||||
|
||||
private:
|
||||
UnresolvedStyleValue(Vector<Parser::ComponentValue>&& values, bool contains_var_or_attr)
|
||||
UnresolvedStyleValue(Vector<Parser::ComponentValue>&& values, bool contains_var_or_attr, Optional<String> original_source_text)
|
||||
: CSSStyleValue(Type::Unresolved)
|
||||
, m_values(move(values))
|
||||
, m_contains_var_or_attr(contains_var_or_attr)
|
||||
, m_original_source_text(move(original_source_text))
|
||||
{
|
||||
}
|
||||
|
||||
Vector<Parser::ComponentValue> m_values;
|
||||
bool m_contains_var_or_attr { false };
|
||||
Optional<String> m_original_source_text;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue