Bläddra i källkod

LibWeb: Make external StyleValue-parsing methods infallible

Sam Atkins 1 år sedan
förälder
incheckning
28c2836c24

+ 3 - 3
Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp

@@ -156,7 +156,7 @@ Optional<PropertyID> property_id_from_camel_case_string(StringView);
 Optional<PropertyID> property_id_from_string(StringView);
 StringView string_from_property_id(PropertyID);
 bool is_inherited_property(PropertyID);
-ErrorOr<NonnullRefPtr<StyleValue>> property_initial_value(JS::Realm&, PropertyID);
+NonnullRefPtr<StyleValue> property_initial_value(JS::Realm&, PropertyID);
 
 enum class ValueType {
     Angle,
@@ -496,7 +496,7 @@ bool property_affects_stacking_context(PropertyID property_id)
     }
 }
 
-ErrorOr<NonnullRefPtr<StyleValue>> property_initial_value(JS::Realm& context_realm, PropertyID property_id)
+NonnullRefPtr<StyleValue> property_initial_value(JS::Realm& context_realm, PropertyID property_id)
 {
     static Array<RefPtr<StyleValue>, to_underlying(last_property_id) + 1> initial_values;
     if (auto initial_value = initial_values[to_underlying(property_id)])
@@ -525,7 +525,7 @@ ErrorOr<NonnullRefPtr<StyleValue>> property_initial_value(JS::Realm& context_rea
         TRY(member_generator.try_append(
             R"~~~(        case PropertyID::@name:titlecase@:
         {
-            auto parsed_value = TRY(parse_css_value(parsing_context, "@initial_value_string@"sv, PropertyID::@name:titlecase@));
+            auto parsed_value = parse_css_value(parsing_context, "@initial_value_string@"sv, PropertyID::@name:titlecase@);
             VERIFY(!parsed_value.is_null());
             auto initial_value = parsed_value.release_nonnull();
             initial_values[to_underlying(PropertyID::@name:titlecase@)] = initial_value;

+ 1 - 1
Userland/Libraries/LibWeb/CSS/CSS.cpp

@@ -28,7 +28,7 @@ bool supports(JS::VM& vm, StringView property, StringView value)
     // 1. If property is an ASCII case-insensitive match for any defined CSS property that the UA supports,
     //    and value successfully parses according to that property’s grammar, return true.
     if (auto property_id = property_id_from_string(property); property_id.has_value()) {
-        if (parse_css_value(Parser::ParsingContext { realm }, value, property_id.value()).release_value_but_fixme_should_propagate_errors())
+        if (parse_css_value(Parser::ParsingContext { realm }, value, property_id.value()))
             return true;
     }
 

+ 2 - 2
Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.cpp

@@ -100,8 +100,8 @@ WebIDL::ExceptionOr<void> PropertyOwningCSSStyleDeclaration::set_property(Proper
 
     // 5. Let component value list be the result of parsing value for property property.
     auto component_value_list = is<ElementInlineCSSStyleDeclaration>(this)
-        ? MUST(parse_css_value(CSS::Parser::ParsingContext { static_cast<ElementInlineCSSStyleDeclaration&>(*this).element()->document() }, value, property_id))
-        : MUST(parse_css_value(CSS::Parser::ParsingContext { realm() }, value, property_id));
+        ? parse_css_value(CSS::Parser::ParsingContext { static_cast<ElementInlineCSSStyleDeclaration&>(*this).element()->document() }, value, property_id)
+        : parse_css_value(CSS::Parser::ParsingContext { realm() }, value, property_id);
 
     // 6. If component value list is null, then return.
     if (!component_value_list)

+ 2 - 2
Userland/Libraries/LibWeb/CSS/Parser/Helpers.cpp

@@ -34,11 +34,11 @@ CSS::ElementInlineCSSStyleDeclaration* parse_css_style_attribute(CSS::Parser::Pa
     return parser.parse_as_style_attribute(element);
 }
 
-ErrorOr<RefPtr<CSS::StyleValue>> parse_css_value(CSS::Parser::ParsingContext const& context, StringView string, CSS::PropertyID property_id)
+RefPtr<CSS::StyleValue> parse_css_value(CSS::Parser::ParsingContext const& context, StringView string, CSS::PropertyID property_id)
 {
     if (string.is_empty())
         return nullptr;
-    auto parser = TRY(CSS::Parser::Parser::create(context, string));
+    auto parser = MUST(CSS::Parser::Parser::create(context, string));
     return parser.parse_as_css_value(property_id);
 }
 

+ 31 - 31
Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp

@@ -2717,14 +2717,14 @@ RefPtr<StyleValue> Parser::parse_background_value(Vector<ComponentValue> const&
     StyleValueVector background_origins;
     RefPtr<StyleValue> background_color;
 
-    auto initial_background_image = MUST(property_initial_value(m_context.realm(), PropertyID::BackgroundImage));
-    auto initial_background_position = MUST(property_initial_value(m_context.realm(), PropertyID::BackgroundPosition));
-    auto initial_background_size = MUST(property_initial_value(m_context.realm(), PropertyID::BackgroundSize));
-    auto initial_background_repeat = MUST(property_initial_value(m_context.realm(), PropertyID::BackgroundRepeat));
-    auto initial_background_attachment = MUST(property_initial_value(m_context.realm(), PropertyID::BackgroundAttachment));
-    auto initial_background_clip = MUST(property_initial_value(m_context.realm(), PropertyID::BackgroundClip));
-    auto initial_background_origin = MUST(property_initial_value(m_context.realm(), PropertyID::BackgroundOrigin));
-    auto initial_background_color = MUST(property_initial_value(m_context.realm(), PropertyID::BackgroundColor));
+    auto initial_background_image = property_initial_value(m_context.realm(), PropertyID::BackgroundImage);
+    auto initial_background_position = property_initial_value(m_context.realm(), PropertyID::BackgroundPosition);
+    auto initial_background_size = property_initial_value(m_context.realm(), PropertyID::BackgroundSize);
+    auto initial_background_repeat = property_initial_value(m_context.realm(), PropertyID::BackgroundRepeat);
+    auto initial_background_attachment = property_initial_value(m_context.realm(), PropertyID::BackgroundAttachment);
+    auto initial_background_clip = property_initial_value(m_context.realm(), PropertyID::BackgroundClip);
+    auto initial_background_origin = property_initial_value(m_context.realm(), PropertyID::BackgroundOrigin);
+    auto initial_background_color = property_initial_value(m_context.realm(), PropertyID::BackgroundColor);
 
     // Per-layer values
     RefPtr<StyleValue> background_image;
@@ -3297,11 +3297,11 @@ RefPtr<StyleValue> Parser::parse_border_value(Vector<ComponentValue> const& comp
     }
 
     if (!border_width)
-        border_width = MUST(property_initial_value(m_context.realm(), PropertyID::BorderWidth));
+        border_width = property_initial_value(m_context.realm(), PropertyID::BorderWidth);
     if (!border_style)
-        border_style = MUST(property_initial_value(m_context.realm(), PropertyID::BorderStyle));
+        border_style = property_initial_value(m_context.realm(), PropertyID::BorderStyle);
     if (!border_color)
-        border_color = MUST(property_initial_value(m_context.realm(), PropertyID::BorderColor));
+        border_color = property_initial_value(m_context.realm(), PropertyID::BorderColor);
 
     return BorderStyleValue::create(border_width.release_nonnull(), border_style.release_nonnull(), border_color.release_nonnull());
 }
@@ -4006,9 +4006,9 @@ RefPtr<StyleValue> Parser::parse_flex_value(Vector<ComponentValue> const& compon
     }
 
     if (!flex_grow)
-        flex_grow = MUST(property_initial_value(m_context.realm(), PropertyID::FlexGrow));
+        flex_grow = property_initial_value(m_context.realm(), PropertyID::FlexGrow);
     if (!flex_shrink)
-        flex_shrink = MUST(property_initial_value(m_context.realm(), PropertyID::FlexShrink));
+        flex_shrink = property_initial_value(m_context.realm(), PropertyID::FlexShrink);
     if (!flex_basis) {
         // NOTE: The spec says that flex-basis should be 0 here, but other engines currently use 0%.
         // https://github.com/w3c/csswg-drafts/issues/5742
@@ -4050,9 +4050,9 @@ RefPtr<StyleValue> Parser::parse_flex_flow_value(Vector<ComponentValue> const& c
     }
 
     if (!flex_direction)
-        flex_direction = MUST(property_initial_value(m_context.realm(), PropertyID::FlexDirection));
+        flex_direction = property_initial_value(m_context.realm(), PropertyID::FlexDirection);
     if (!flex_wrap)
-        flex_wrap = MUST(property_initial_value(m_context.realm(), PropertyID::FlexWrap));
+        flex_wrap = property_initial_value(m_context.realm(), PropertyID::FlexWrap);
 
     return FlexFlowStyleValue::create(flex_direction.release_nonnull(), flex_wrap.release_nonnull());
 }
@@ -4169,13 +4169,13 @@ RefPtr<StyleValue> Parser::parse_font_value(Vector<ComponentValue> const& compon
         return nullptr;
 
     if (!font_stretch)
-        font_stretch = MUST(property_initial_value(m_context.realm(), PropertyID::FontStretch));
+        font_stretch = property_initial_value(m_context.realm(), PropertyID::FontStretch);
     if (!font_style)
-        font_style = MUST(property_initial_value(m_context.realm(), PropertyID::FontStyle));
+        font_style = property_initial_value(m_context.realm(), PropertyID::FontStyle);
     if (!font_weight)
-        font_weight = MUST(property_initial_value(m_context.realm(), PropertyID::FontWeight));
+        font_weight = property_initial_value(m_context.realm(), PropertyID::FontWeight);
     if (!line_height)
-        line_height = MUST(property_initial_value(m_context.realm(), PropertyID::LineHeight));
+        line_height = property_initial_value(m_context.realm(), PropertyID::LineHeight);
 
     return FontStyleValue::create(font_stretch.release_nonnull(), font_style.release_nonnull(), font_weight.release_nonnull(), font_size.release_nonnull(), line_height.release_nonnull(), font_families.release_nonnull());
 }
@@ -4528,11 +4528,11 @@ RefPtr<StyleValue> Parser::parse_list_style_value(Vector<ComponentValue> const&
     }
 
     if (!list_position)
-        list_position = MUST(property_initial_value(m_context.realm(), PropertyID::ListStylePosition));
+        list_position = property_initial_value(m_context.realm(), PropertyID::ListStylePosition);
     if (!list_image)
-        list_image = MUST(property_initial_value(m_context.realm(), PropertyID::ListStyleImage));
+        list_image = property_initial_value(m_context.realm(), PropertyID::ListStyleImage);
     if (!list_type)
-        list_type = MUST(property_initial_value(m_context.realm(), PropertyID::ListStyleType));
+        list_type = property_initial_value(m_context.realm(), PropertyID::ListStyleType);
 
     return ListStyleStyleValue::create(list_position.release_nonnull(), list_image.release_nonnull(), list_type.release_nonnull());
 }
@@ -4666,13 +4666,13 @@ RefPtr<StyleValue> Parser::parse_text_decoration_value(Vector<ComponentValue> co
     }
 
     if (!decoration_line)
-        decoration_line = MUST(property_initial_value(m_context.realm(), PropertyID::TextDecorationLine));
+        decoration_line = property_initial_value(m_context.realm(), PropertyID::TextDecorationLine);
     if (!decoration_thickness)
-        decoration_thickness = MUST(property_initial_value(m_context.realm(), PropertyID::TextDecorationThickness));
+        decoration_thickness = property_initial_value(m_context.realm(), PropertyID::TextDecorationThickness);
     if (!decoration_style)
-        decoration_style = MUST(property_initial_value(m_context.realm(), PropertyID::TextDecorationStyle));
+        decoration_style = property_initial_value(m_context.realm(), PropertyID::TextDecorationStyle);
     if (!decoration_color)
-        decoration_color = MUST(property_initial_value(m_context.realm(), PropertyID::TextDecorationColor));
+        decoration_color = property_initial_value(m_context.realm(), PropertyID::TextDecorationColor);
 
     return TextDecorationStyleValue::create(decoration_line.release_nonnull(), decoration_thickness.release_nonnull(), decoration_style.release_nonnull(), decoration_color.release_nonnull());
 }
@@ -5923,7 +5923,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
     }
 
     for (auto& property : unassigned_properties)
-        assigned_values.ensure(to_underlying(property)).append(MUST(property_initial_value(m_context.realm(), property)));
+        assigned_values.ensure(to_underlying(property)).append(property_initial_value(m_context.realm(), property));
 
     stream.skip_whitespace();
     if (stream.has_next_token())
@@ -6486,18 +6486,18 @@ bool Parser::is_builtin(StringView name)
         || name.equals_ignoring_ascii_case("unset"sv);
 }
 
-ErrorOr<RefPtr<CalculatedStyleValue>> Parser::parse_calculated_value(Badge<StyleComputer>, ParsingContext const& context, ComponentValue const& token)
+RefPtr<CalculatedStyleValue> Parser::parse_calculated_value(Badge<StyleComputer>, ParsingContext const& context, ComponentValue const& token)
 {
-    auto parser = TRY(Parser::create(context, ""sv));
+    auto parser = MUST(Parser::create(context, ""sv));
     return parser.parse_calculated_value(token);
 }
 
-ErrorOr<RefPtr<StyleValue>> Parser::parse_css_value(Badge<StyleComputer>, ParsingContext const& context, PropertyID property_id, Vector<ComponentValue> const& tokens)
+RefPtr<StyleValue> Parser::parse_css_value(Badge<StyleComputer>, ParsingContext const& context, PropertyID property_id, Vector<ComponentValue> const& tokens)
 {
     if (tokens.is_empty() || property_id == CSS::PropertyID::Invalid || property_id == CSS::PropertyID::Custom)
         return nullptr;
 
-    auto parser = TRY(Parser::create(context, ""sv));
+    auto parser = MUST(Parser::create(context, ""sv));
     TokenStream<ComponentValue> token_stream { tokens };
     auto result = parser.parse_css_value(property_id, token_stream);
     if (result.is_error())

+ 3 - 3
Userland/Libraries/LibWeb/CSS/Parser/Parser.h

@@ -66,8 +66,8 @@ public:
 
     RefPtr<StyleValue> parse_as_css_value(PropertyID);
 
-    static ErrorOr<RefPtr<StyleValue>> parse_css_value(Badge<StyleComputer>, ParsingContext const&, PropertyID, Vector<ComponentValue> const&);
-    static ErrorOr<RefPtr<CalculatedStyleValue>> parse_calculated_value(Badge<StyleComputer>, ParsingContext const&, ComponentValue const&);
+    static RefPtr<StyleValue> parse_css_value(Badge<StyleComputer>, ParsingContext const&, PropertyID, Vector<ComponentValue> const&);
+    static RefPtr<CalculatedStyleValue> parse_calculated_value(Badge<StyleComputer>, ParsingContext const&, ComponentValue const&);
 
     [[nodiscard]] LengthOrCalculated parse_as_sizes_attribute();
 
@@ -306,7 +306,7 @@ namespace Web {
 
 CSS::CSSStyleSheet* parse_css_stylesheet(CSS::Parser::ParsingContext const&, StringView, Optional<AK::URL> location = {});
 CSS::ElementInlineCSSStyleDeclaration* parse_css_style_attribute(CSS::Parser::ParsingContext const&, StringView, DOM::Element&);
-ErrorOr<RefPtr<CSS::StyleValue>> parse_css_value(CSS::Parser::ParsingContext const&, StringView, CSS::PropertyID property_id = CSS::PropertyID::Invalid);
+RefPtr<CSS::StyleValue> parse_css_value(CSS::Parser::ParsingContext const&, StringView, CSS::PropertyID property_id = CSS::PropertyID::Invalid);
 Optional<CSS::SelectorList> parse_selector(CSS::Parser::ParsingContext const&, StringView);
 CSS::CSSRule* parse_css_rule(CSS::Parser::ParsingContext const&, StringView);
 RefPtr<CSS::MediaQuery> parse_media_query(CSS::Parser::ParsingContext const&, StringView);

+ 7 - 7
Userland/Libraries/LibWeb/CSS/StyleComputer.cpp

@@ -921,7 +921,7 @@ void StyleComputer::set_all_properties(DOM::Element& element, Optional<CSS::Sele
             if (is_inherited_property(property_id))
                 style.m_property_values[to_underlying(property_id)] = { { get_inherit_value(document.realm(), property_id, &element, pseudo_element), nullptr } };
             else
-                style.m_property_values[to_underlying(property_id)] = { { property_initial_value(document.realm(), property_id).release_value_but_fixme_should_propagate_errors(), nullptr } };
+                style.m_property_values[to_underlying(property_id)] = { { property_initial_value(document.realm(), property_id), nullptr } };
             continue;
         }
 
@@ -1087,7 +1087,7 @@ bool StyleComputer::expand_unresolved_values(DOM::Element& element, StringView p
                 return false;
             }
 
-            if (auto maybe_calc_value = Parser::Parser::parse_calculated_value({}, Parser::ParsingContext { document() }, value).release_value_but_fixme_should_propagate_errors(); maybe_calc_value && maybe_calc_value->is_calculated()) {
+            if (auto maybe_calc_value = Parser::Parser::parse_calculated_value({}, Parser::ParsingContext { document() }, value); maybe_calc_value && maybe_calc_value->is_calculated()) {
                 auto& calc_value = maybe_calc_value->as_calculated();
                 if (calc_value.resolves_to_number()) {
                     auto resolved_value = calc_value.resolve_number();
@@ -1146,7 +1146,7 @@ RefPtr<StyleValue> StyleComputer::resolve_unresolved_style_value(DOM::Element& e
     if (!expand_unresolved_values(element, string_from_property_id(property_id), unresolved_values_with_variables_expanded, expanded_values))
         return {};
 
-    if (auto parsed_value = Parser::Parser::parse_css_value({}, Parser::ParsingContext { document() }, property_id, expanded_values).release_value_but_fixme_should_propagate_errors())
+    if (auto parsed_value = Parser::Parser::parse_css_value({}, Parser::ParsingContext { document() }, property_id, expanded_values))
         return parsed_value.release_nonnull();
 
     return {};
@@ -1939,7 +1939,7 @@ NonnullRefPtr<StyleValue const> get_inherit_value(JS::Realm& initial_value_conte
     auto* parent_element = element_to_inherit_style_from(element, pseudo_element);
 
     if (!parent_element || !parent_element->computed_css_values())
-        return property_initial_value(initial_value_context_realm, property_id).release_value_but_fixme_should_propagate_errors();
+        return property_initial_value(initial_value_context_realm, property_id);
     return parent_element->computed_css_values()->property(property_id);
 }
 
@@ -1952,12 +1952,12 @@ void StyleComputer::compute_defaulted_property_value(StyleProperties& style, DOM
         if (is_inherited_property(property_id))
             style.m_property_values[to_underlying(property_id)] = { { get_inherit_value(document().realm(), property_id, element, pseudo_element), nullptr } };
         else
-            style.m_property_values[to_underlying(property_id)] = { { property_initial_value(document().realm(), property_id).release_value_but_fixme_should_propagate_errors(), nullptr } };
+            style.m_property_values[to_underlying(property_id)] = { { property_initial_value(document().realm(), property_id), nullptr } };
         return;
     }
 
     if (value_slot->style->is_initial()) {
-        value_slot->style = property_initial_value(document().realm(), property_id).release_value_but_fixme_should_propagate_errors();
+        value_slot->style = property_initial_value(document().realm(), property_id);
         return;
     }
 
@@ -1974,7 +1974,7 @@ void StyleComputer::compute_defaulted_property_value(StyleProperties& style, DOM
             value_slot->style = get_inherit_value(document().realm(), property_id, element, pseudo_element);
         } else {
             // and if it is not, this is treated as initial.
-            value_slot->style = property_initial_value(document().realm(), property_id).release_value_but_fixme_should_propagate_errors();
+            value_slot->style = property_initial_value(document().realm(), property_id);
         }
     }
 }

+ 2 - 2
Userland/Libraries/LibWeb/HTML/Canvas/CanvasTextDrawingStyles.h

@@ -45,10 +45,10 @@ public:
         auto font_style_value_result = parse_css_value(parsing_context, font, CSS::PropertyID::Font);
 
         // If the new value is syntactically incorrect (including using property-independent style sheet syntax like 'inherit' or 'initial'), then it must be ignored, without assigning a new font value.
-        if (font_style_value_result.is_error() || !font_style_value_result.value()) {
+        if (!font_style_value_result) {
             return;
         }
-        my_drawing_state().font_style_value = font_style_value_result.value();
+        my_drawing_state().font_style_value = font_style_value_result.release_nonnull();
 
         // Load font with font style value properties
         auto const& font_style_value = my_drawing_state().font_style_value->as_font();

+ 2 - 2
Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp

@@ -40,7 +40,7 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl
             return;
         }
         if (name == HTML::AttributeNames::valign) {
-            if (auto parsed_value = parse_css_value(CSS::Parser::ParsingContext { document() }, value.view(), CSS::PropertyID::VerticalAlign).release_value_but_fixme_should_propagate_errors())
+            if (auto parsed_value = parse_css_value(CSS::Parser::ParsingContext { document() }, value.view(), CSS::PropertyID::VerticalAlign))
                 style.set_property(CSS::PropertyID::VerticalAlign, parsed_value.release_nonnull());
             return;
         }
@@ -48,7 +48,7 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl
             if (value.equals_ignoring_ascii_case("center"sv) || value.equals_ignoring_ascii_case("middle"sv)) {
                 style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebCenter));
             } else {
-                if (auto parsed_value = parse_css_value(CSS::Parser::ParsingContext { document() }, value.view(), CSS::PropertyID::TextAlign).release_value_but_fixme_should_propagate_errors())
+                if (auto parsed_value = parse_css_value(CSS::Parser::ParsingContext { document() }, value.view(), CSS::PropertyID::TextAlign))
                     style.set_property(CSS::PropertyID::TextAlign, parsed_value.release_nonnull());
             }
             return;

+ 2 - 2
Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp

@@ -52,10 +52,10 @@ void SVGForeignObjectElement::apply_presentational_hints(CSS::StyleProperties& s
 {
     Base::apply_presentational_hints(style);
     auto parsing_context = CSS::Parser::ParsingContext { document() };
-    if (auto width_value = parse_css_value(parsing_context, attribute(Web::HTML::AttributeNames::width), CSS::PropertyID::Width).release_value_but_fixme_should_propagate_errors())
+    if (auto width_value = parse_css_value(parsing_context, attribute(Web::HTML::AttributeNames::width), CSS::PropertyID::Width))
         style.set_property(CSS::PropertyID::Width, width_value.release_nonnull());
 
-    if (auto height_value = parse_css_value(parsing_context, attribute(Web::HTML::AttributeNames::height), CSS::PropertyID::Height).release_value_but_fixme_should_propagate_errors())
+    if (auto height_value = parse_css_value(parsing_context, attribute(Web::HTML::AttributeNames::height), CSS::PropertyID::Height))
         style.set_property(CSS::PropertyID::Height, height_value.release_nonnull());
 }
 

+ 9 - 9
Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp

@@ -125,32 +125,32 @@ void SVGGraphicsElement::apply_presentational_hints(CSS::StyleProperties& style)
     for_each_attribute([&](auto& name, auto& value) {
         if (name.equals_ignoring_ascii_case("fill"sv)) {
             // FIXME: The `fill` attribute and CSS `fill` property are not the same! But our support is limited enough that they are equivalent for now.
-            if (auto fill_value = parse_css_value(parsing_context, value, CSS::PropertyID::Fill).release_value_but_fixme_should_propagate_errors())
+            if (auto fill_value = parse_css_value(parsing_context, value, CSS::PropertyID::Fill))
                 style.set_property(CSS::PropertyID::Fill, fill_value.release_nonnull());
         } else if (name.equals_ignoring_ascii_case("stroke"sv)) {
             // FIXME: The `stroke` attribute and CSS `stroke` property are not the same! But our support is limited enough that they are equivalent for now.
-            if (auto stroke_value = parse_css_value(parsing_context, value, CSS::PropertyID::Stroke).release_value_but_fixme_should_propagate_errors())
+            if (auto stroke_value = parse_css_value(parsing_context, value, CSS::PropertyID::Stroke))
                 style.set_property(CSS::PropertyID::Stroke, stroke_value.release_nonnull());
         } else if (name.equals_ignoring_ascii_case("stroke-width"sv)) {
-            if (auto stroke_width_value = parse_css_value(parsing_context, value, CSS::PropertyID::StrokeWidth).release_value_but_fixme_should_propagate_errors())
+            if (auto stroke_width_value = parse_css_value(parsing_context, value, CSS::PropertyID::StrokeWidth))
                 style.set_property(CSS::PropertyID::StrokeWidth, stroke_width_value.release_nonnull());
         } else if (name.equals_ignoring_ascii_case("fill-rule"sv)) {
-            if (auto fill_rule_value = parse_css_value(parsing_context, value, CSS::PropertyID::FillRule).release_value_but_fixme_should_propagate_errors())
+            if (auto fill_rule_value = parse_css_value(parsing_context, value, CSS::PropertyID::FillRule))
                 style.set_property(CSS::PropertyID::FillRule, fill_rule_value.release_nonnull());
         } else if (name.equals_ignoring_ascii_case("fill-opacity"sv)) {
-            if (auto fill_opacity_value = parse_css_value(parsing_context, value, CSS::PropertyID::FillOpacity).release_value_but_fixme_should_propagate_errors())
+            if (auto fill_opacity_value = parse_css_value(parsing_context, value, CSS::PropertyID::FillOpacity))
                 style.set_property(CSS::PropertyID::FillOpacity, fill_opacity_value.release_nonnull());
         } else if (name.equals_ignoring_ascii_case("stroke-opacity"sv)) {
-            if (auto stroke_opacity_value = parse_css_value(parsing_context, value, CSS::PropertyID::StrokeOpacity).release_value_but_fixme_should_propagate_errors())
+            if (auto stroke_opacity_value = parse_css_value(parsing_context, value, CSS::PropertyID::StrokeOpacity))
                 style.set_property(CSS::PropertyID::StrokeOpacity, stroke_opacity_value.release_nonnull());
         } else if (name.equals_ignoring_ascii_case(SVG::AttributeNames::opacity)) {
-            if (auto opacity_value = parse_css_value(parsing_context, value, CSS::PropertyID::Opacity).release_value_but_fixme_should_propagate_errors())
+            if (auto opacity_value = parse_css_value(parsing_context, value, CSS::PropertyID::Opacity))
                 style.set_property(CSS::PropertyID::Opacity, opacity_value.release_nonnull());
         } else if (name.equals_ignoring_ascii_case("text-anchor"sv)) {
-            if (auto text_anchor_value = parse_css_value(parsing_context, value, CSS::PropertyID::TextAnchor).release_value_but_fixme_should_propagate_errors())
+            if (auto text_anchor_value = parse_css_value(parsing_context, value, CSS::PropertyID::TextAnchor))
                 style.set_property(CSS::PropertyID::TextAnchor, text_anchor_value.release_nonnull());
         } else if (name.equals_ignoring_ascii_case("font-size"sv)) {
-            if (auto font_size_value = parse_css_value(parsing_context, value, CSS::PropertyID::FontSize).release_value_but_fixme_should_propagate_errors())
+            if (auto font_size_value = parse_css_value(parsing_context, value, CSS::PropertyID::FontSize))
                 style.set_property(CSS::PropertyID::FontSize, font_size_value.release_nonnull());
         }
     });

+ 4 - 4
Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp

@@ -43,7 +43,7 @@ void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) cons
 
     auto width_attribute = attribute(SVG::AttributeNames::width);
     auto parsing_context = CSS::Parser::ParsingContext { document() };
-    if (auto width_value = parse_css_value(parsing_context, attribute(Web::HTML::AttributeNames::width), CSS::PropertyID::Width).release_value_but_fixme_should_propagate_errors()) {
+    if (auto width_value = parse_css_value(parsing_context, attribute(Web::HTML::AttributeNames::width), CSS::PropertyID::Width)) {
         style.set_property(CSS::PropertyID::Width, width_value.release_nonnull());
     } else if (width_attribute == "") {
         // If the `width` attribute is an empty string, it defaults to 100%.
@@ -54,7 +54,7 @@ void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) cons
 
     // Height defaults to 100%
     auto height_attribute = attribute(SVG::AttributeNames::height);
-    if (auto height_value = parse_css_value(parsing_context, attribute(Web::HTML::AttributeNames::height), CSS::PropertyID::Height).release_value_but_fixme_should_propagate_errors()) {
+    if (auto height_value = parse_css_value(parsing_context, attribute(Web::HTML::AttributeNames::height), CSS::PropertyID::Height)) {
         style.set_property(CSS::PropertyID::Height, height_value.release_nonnull());
     } else if (height_attribute == "") {
         // If the `height` attribute is an empty string, it defaults to 100%.
@@ -87,13 +87,13 @@ void SVGSVGElement::update_fallback_view_box_for_svg_as_image()
 
     auto width_attribute = attribute(SVG::AttributeNames::width);
     auto parsing_context = CSS::Parser::ParsingContext { document() };
-    if (auto width_value = parse_css_value(parsing_context, attribute(Web::HTML::AttributeNames::width), CSS::PropertyID::Width).release_value_but_fixme_should_propagate_errors()) {
+    if (auto width_value = parse_css_value(parsing_context, attribute(Web::HTML::AttributeNames::width), CSS::PropertyID::Width)) {
         if (width_value->is_length() && width_value->as_length().length().is_absolute())
             width = width_value->as_length().length().absolute_length_to_px().to_double();
     }
 
     auto height_attribute = attribute(SVG::AttributeNames::height);
-    if (auto height_value = parse_css_value(parsing_context, attribute(Web::HTML::AttributeNames::height), CSS::PropertyID::Height).release_value_but_fixme_should_propagate_errors()) {
+    if (auto height_value = parse_css_value(parsing_context, attribute(Web::HTML::AttributeNames::height), CSS::PropertyID::Height)) {
         if (height_value->is_length() && height_value->as_length().length().is_absolute())
             height = height_value->as_length().length().absolute_length_to_px().to_double();
     }

+ 2 - 2
Userland/Libraries/LibWeb/SVG/SVGStopElement.cpp

@@ -33,11 +33,11 @@ void SVGStopElement::apply_presentational_hints(CSS::StyleProperties& style) con
     for_each_attribute([&](auto& name, auto& value) {
         CSS::Parser::ParsingContext parsing_context { document() };
         if (name.equals_ignoring_ascii_case("stop-color"sv)) {
-            if (auto stop_color = parse_css_value(parsing_context, value, CSS::PropertyID::StopColor).release_value_but_fixme_should_propagate_errors()) {
+            if (auto stop_color = parse_css_value(parsing_context, value, CSS::PropertyID::StopColor)) {
                 style.set_property(CSS::PropertyID::StopColor, stop_color.release_nonnull());
             }
         } else if (name.equals_ignoring_ascii_case("stop-opacity"sv)) {
-            if (auto stop_opacity = parse_css_value(parsing_context, value, CSS::PropertyID::StopOpacity).release_value_but_fixme_should_propagate_errors()) {
+            if (auto stop_opacity = parse_css_value(parsing_context, value, CSS::PropertyID::StopOpacity)) {
                 style.set_property(CSS::PropertyID::StopOpacity, stop_opacity.release_nonnull());
             }
         }