1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:38:11 +00:00

LibWeb: Propagate errors from StyleValue construction

Turns out we create a lot of these, mostly from places that don't return
ErrorOr. The yak stack grows.
This commit is contained in:
Sam Atkins 2023-05-05 15:02:03 +01:00 committed by Andreas Kling
parent 36bb04d792
commit d16600a48b
76 changed files with 445 additions and 415 deletions

View file

@ -3830,14 +3830,14 @@ static RefPtr<CSS::StyleValue> parse_current_dimension_value(float value, Utf8Vi
{
// 1. If position is past the end of input, then return value as a length.
if (position == input.end())
return CSS::LengthStyleValue::create(CSS::Length::make_px(value));
return CSS::LengthStyleValue::create(CSS::Length::make_px(value)).release_value_but_fixme_should_propagate_errors();
// 2. If the code point at position within input is U+0025 (%), then return value as a percentage.
if (*position == '%')
return CSS::PercentageStyleValue::create(CSS::Percentage(value));
return CSS::PercentageStyleValue::create(CSS::Percentage(value)).release_value_but_fixme_should_propagate_errors();
// 3. Return value as a length.
return CSS::LengthStyleValue::create(CSS::Length::make_px(value));
return CSS::LengthStyleValue::create(CSS::Length::make_px(value)).release_value_but_fixme_should_propagate_errors();
}
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-dimension-values
@ -3871,7 +3871,7 @@ RefPtr<CSS::StyleValue> parse_dimension_value(StringView string)
// 6. If position is past the end of input, then return value as a length.
if (position == input.end())
return CSS::LengthStyleValue::create(CSS::Length::make_px(*integer_value));
return CSS::LengthStyleValue::create(CSS::Length::make_px(*integer_value)).release_value_but_fixme_should_propagate_errors();
float value = *integer_value;
@ -3902,7 +3902,7 @@ RefPtr<CSS::StyleValue> parse_dimension_value(StringView string)
// 4. If position is past the end of input, then return value as a length.
if (position == input.end())
return CSS::LengthStyleValue::create(CSS::Length::make_px(value));
return CSS::LengthStyleValue::create(CSS::Length::make_px(value)).release_value_but_fixme_should_propagate_errors();
// 5. If the code point at position within input is not an ASCII digit, then break.
if (!is_ascii_digit(*position))