mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-09 19:16:02 +00:00
LibWeb/CSS: Make CSS Parser::create() infallible
Now that `Tokenizer::tokenize()` just returns a String, there are no errors to propagate, and we can simplify the user code a bit.
This commit is contained in:
parent
89c5f25016
commit
59778d2b36
Notes:
github-actions[bot]
2024-07-26 15:30:15 +00:00
Author: https://github.com/AtkinsSJ
Commit: 59778d2b36
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/846
8 changed files with 33 additions and 64 deletions
|
@ -33,12 +33,7 @@ public:
|
|||
// 1. If the given value is a string, then:
|
||||
[&](String const& string) {
|
||||
// 1. Let context be this's canvas attribute's value, if that is an element; otherwise null.
|
||||
auto maybe_parser = CSS::Parser::Parser::create(CSS::Parser::ParsingContext(realm), string);
|
||||
if (maybe_parser.is_error()) {
|
||||
dbgln_if(CANVAS_RENDERING_CONTEXT_2D_DEBUG, "CanvasFillStrokeStyles: Failed to create CSS parser.");
|
||||
return;
|
||||
}
|
||||
auto parser = maybe_parser.release_value();
|
||||
auto parser = CSS::Parser::Parser::create(CSS::Parser::ParsingContext(realm), string);
|
||||
|
||||
// 2. Let parsedValue be the result of parsing the given value with context if non-null.
|
||||
// FIXME: Parse a color value
|
||||
|
@ -80,12 +75,7 @@ public:
|
|||
// 1. If the given value is a string, then:
|
||||
[&](String const& string) {
|
||||
// 1. Let context be this's canvas attribute's value, if that is an element; otherwise null.
|
||||
auto maybe_parser = CSS::Parser::Parser::create(CSS::Parser::ParsingContext(realm), string);
|
||||
if (maybe_parser.is_error()) {
|
||||
dbgln_if(CANVAS_RENDERING_CONTEXT_2D_DEBUG, "CanvasFillStrokeStyles: Failed to create CSS parser.");
|
||||
return;
|
||||
}
|
||||
auto parser = maybe_parser.release_value();
|
||||
auto parser = CSS::Parser::Parser::create(CSS::Parser::ParsingContext(realm), string);
|
||||
|
||||
// 2. Let parsedValue be the result of parsing the given value with context if non-null.
|
||||
// FIXME: Parse a color value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue