mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-29 05:38:24 +00:00
LibWeb/CSS: Add dump_string()
method to TokenStream
This is to support error reporting. It's not the most elegant way of getting the source CSS, but it works.
This commit is contained in:
parent
012f4735a7
commit
2a2a1986cc
Notes:
github-actions[bot]
2025-08-04 09:52:44 +00:00
Author: https://github.com/AtkinsSJ
Commit: 2a2a1986cc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5576
2 changed files with 15 additions and 0 deletions
|
@ -187,3 +187,11 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct AK::Formatter<Web::CSS::Parser::Token> : Formatter<StringView> {
|
||||||
|
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::Parser::Token const& token)
|
||||||
|
{
|
||||||
|
return Formatter<StringView>::format(builder, token.to_string());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -189,6 +189,13 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String dump_string()
|
||||||
|
{
|
||||||
|
// FIXME: The whitespace is only needed because we strip it when parsing property values. Remove it here once
|
||||||
|
// we stop doing that.
|
||||||
|
return MUST(String::join(" "sv, m_tokens));
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// https://drafts.csswg.org/css-syntax/#token-stream-tokens
|
// https://drafts.csswg.org/css-syntax/#token-stream-tokens
|
||||||
Span<T const> m_tokens;
|
Span<T const> m_tokens;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue