1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:17:34 +00:00

LibWeb: Use StateTransaction for UnicodeRange parsing

...and change how the two parsing steps fit together.

The two steps were previously quite muddled. Both worked with the
TokenStream directly, and both were responsible for rewinding that
stream if there was an error. This is both confusing and also made it
impossible to replace the rewinding with StateTransactions.

This commit more clearly divides the work between the two functions: One
parses ComponentValues and produces a string, and the other parses that
string to produce the UnicodeRange. It also replaces manual rewinding
in the former with StateTransactions.
This commit is contained in:
Sam Atkins 2022-04-27 19:56:05 +01:00 committed by Andreas Kling
parent dc00657c4f
commit 2b3185955e
2 changed files with 66 additions and 66 deletions

View file

@ -310,7 +310,7 @@ private:
Optional<Length> parse_length(ComponentValue const&);
Optional<Ratio> parse_ratio(TokenStream<ComponentValue>&);
Optional<UnicodeRange> parse_unicode_range(TokenStream<ComponentValue>&);
Optional<UnicodeRange> create_unicode_range_from_tokens(TokenStream<ComponentValue>&, int start_position, int end_position);
Optional<UnicodeRange> parse_unicode_range(StringView);
enum class AllowedDataUrlType {
None,