diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index c53a309cab..d63a247bcc 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -2692,9 +2692,9 @@ ErrorOr> Parser::parse_aspect_ratio_value(Vector> Parser::parse_background_value(Vector> Parser::parse_single_background_position_value(Token transaction.commit(); return PositionStyleValue::create( - TRY(EdgeStyleValue::create(horizontal->edge, horizontal->offset)), - TRY(EdgeStyleValue::create(vertical->edge, vertical->offset))); + EdgeStyleValue::create(horizontal->edge, horizontal->offset), + EdgeStyleValue::create(vertical->edge, vertical->offset)); } ErrorOr> Parser::parse_single_background_position_x_or_y_value(TokenStream& tokens, PropertyID property) @@ -3398,14 +3398,14 @@ ErrorOr> Parser::parse_border_radius_shorthand_value(Vector> Parser::parse_single_shadow_value(TokenStream> Parser::parse_content_value(Vector c RefPtr alt_text; if (!alt_text_values.is_empty()) - alt_text = TRY(StyleValueList::create(move(alt_text_values), StyleValueList::Separator::Space)); + alt_text = StyleValueList::create(move(alt_text_values), StyleValueList::Separator::Space); - return ContentStyleValue::create(TRY(StyleValueList::create(move(content_values), StyleValueList::Separator::Space)), move(alt_text)); + return ContentStyleValue::create(StyleValueList::create(move(content_values), StyleValueList::Separator::Space), move(alt_text)); } // https://www.w3.org/TR/css-display-3/#the-display-properties @@ -3949,18 +3949,18 @@ ErrorOr> Parser::parse_flex_value(Vector cons case PropertyID::FlexGrow: { // 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 - auto flex_basis = TRY(PercentageStyleValue::create(Percentage(0))); - auto one = TRY(NumberStyleValue::create(1)); + auto flex_basis = PercentageStyleValue::create(Percentage(0)); + auto one = NumberStyleValue::create(1); return FlexStyleValue::create(*value, one, flex_basis); } case PropertyID::FlexBasis: { - auto one = TRY(NumberStyleValue::create(1)); + auto one = NumberStyleValue::create(1); return FlexStyleValue::create(one, one, *value); } case PropertyID::Flex: { if (value->is_identifier() && value->to_identifier() == ValueID::None) { - auto zero = TRY(NumberStyleValue::create(0)); - return FlexStyleValue::create(zero, zero, TRY(IdentifierStyleValue::create(ValueID::Auto))); + auto zero = NumberStyleValue::create(0); + return FlexStyleValue::create(zero, zero, IdentifierStyleValue::create(ValueID::Auto)); } break; } @@ -4014,7 +4014,7 @@ ErrorOr> Parser::parse_flex_value(Vector cons 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 - flex_basis = TRY(PercentageStyleValue::create(Percentage(0))); + flex_basis = PercentageStyleValue::create(Percentage(0)); } return FlexStyleValue::create(flex_grow.release_nonnull(), flex_shrink.release_nonnull(), flex_basis.release_nonnull()); @@ -4204,7 +4204,7 @@ ErrorOr> Parser::parse_font_family_value(TokenStream> Parser::parse_font_family_value(TokenStream> Parser::parse_font_family_value(TokenStream> Parser::parse_font_family_value(TokenStream> Parser::parse_list_style_value(Vector> Parser::parse_easing_value(TokenStream= 0 && value.token().number_value() <= 1) - values.append(TRY(NumberStyleValue::create(value.token().number().value()))); + values.append(NumberStyleValue::create(value.token().number().value())); else return nullptr; break; } case EasingFunctionParameterType::Integer: { if (value.is(Token::Type::Number) && value.token().number().is_integer()) - values.append(TRY(IntegerStyleValue::create(value.token().number().integer_value()))); + values.append(IntegerStyleValue::create(value.token().number().integer_value())); else return nullptr; break; @@ -4860,7 +4860,7 @@ ErrorOr> Parser::parse_transform_value(Vector if (maybe_calc_value && maybe_calc_value->resolves_to_angle()) { values.append(maybe_calc_value.release_nonnull()); } else if (value.is(Token::Type::Number) && value.token().number_value() == 0) { - values.append(TRY(AngleStyleValue::create(Angle::make_degrees(0)))); + values.append(AngleStyleValue::create(Angle::make_degrees(0))); } else { auto dimension_value = TRY(parse_dimension_value(value)); if (!dimension_value || !dimension_value->is_angle()) @@ -4934,7 +4934,7 @@ ErrorOr> Parser::parse_transform_value(Vector return nullptr; } - transformations.append(TRY(TransformationStyleValue::create(function, move(values)))); + transformations.append(TransformationStyleValue::create(function, move(values))); } return StyleValueList::create(move(transformations), StyleValueList::Separator::Space); } @@ -4954,7 +4954,7 @@ ErrorOr> Parser::parse_transform_origin_value(Vector offset; }; - auto to_axis_offset = [](RefPtr value) -> ErrorOr> { + auto to_axis_offset = [](RefPtr value) -> Optional { if (value->is_percentage()) return AxisOffset { Axis::None, value->as_percentage() }; if (value->is_length()) @@ -4962,15 +4962,15 @@ ErrorOr> Parser::parse_transform_origin_value(Vectoris_identifier()) { switch (value->to_identifier()) { case ValueID::Top: - return AxisOffset { Axis::Y, TRY(PercentageStyleValue::create(Percentage(0))) }; + return AxisOffset { Axis::Y, PercentageStyleValue::create(Percentage(0)) }; case ValueID::Left: - return AxisOffset { Axis::X, TRY(PercentageStyleValue::create(Percentage(0))) }; + return AxisOffset { Axis::X, PercentageStyleValue::create(Percentage(0)) }; case ValueID::Center: - return AxisOffset { Axis::None, TRY(PercentageStyleValue::create(Percentage(50))) }; + return AxisOffset { Axis::None, PercentageStyleValue::create(Percentage(50)) }; case ValueID::Bottom: - return AxisOffset { Axis::Y, TRY(PercentageStyleValue::create(Percentage(100))) }; + return AxisOffset { Axis::Y, PercentageStyleValue::create(Percentage(100)) }; case ValueID::Right: - return AxisOffset { Axis::X, TRY(PercentageStyleValue::create(Percentage(100))) }; + return AxisOffset { Axis::X, PercentageStyleValue::create(Percentage(100)) }; default: return OptionalNone {}; } @@ -4978,7 +4978,7 @@ ErrorOr> Parser::parse_transform_origin_value(Vector const& x_value, NonnullRefPtr const& y_value) -> ErrorOr> { + auto make_list = [](NonnullRefPtr const& x_value, NonnullRefPtr const& y_value) -> NonnullRefPtr { StyleValueVector values; values.append(x_value); values.append(y_value); @@ -4988,7 +4988,7 @@ ErrorOr> Parser::parse_transform_origin_value(Vector> Parser::parse_transform_origin_value(Vectoraxis) { case Axis::None: case Axis::X: - return make_list(single_value->offset, TRY(PercentageStyleValue::create(Percentage(50)))); + return make_list(single_value->offset, PercentageStyleValue::create(Percentage(50))); case Axis::Y: - return make_list(TRY(PercentageStyleValue::create(Percentage(50))), single_value->offset); + return make_list(PercentageStyleValue::create(Percentage(50)), single_value->offset); } VERIFY_NOT_REACHED(); } case 2: { - auto first_value = TRY(to_axis_offset(TRY(parse_css_value_for_property(PropertyID::TransformOrigin, tokens)))); - auto second_value = TRY(to_axis_offset(TRY(parse_css_value_for_property(PropertyID::TransformOrigin, tokens)))); + auto first_value = to_axis_offset(TRY(parse_css_value_for_property(PropertyID::TransformOrigin, tokens))); + auto second_value = to_axis_offset(TRY(parse_css_value_for_property(PropertyID::TransformOrigin, tokens))); if (!first_value.has_value() || !second_value.has_value()) return nullptr; @@ -5685,7 +5685,7 @@ Parser::ParseErrorOr> Parser::parse_css_value(Property } if (property_id == PropertyID::Custom || contains_var_or_attr) - return FIXME_TRY(UnresolvedStyleValue::create(move(component_values), contains_var_or_attr)); + return UnresolvedStyleValue::create(move(component_values), contains_var_or_attr); if (component_values.is_empty()) return ParseError::SyntaxError; @@ -5904,7 +5904,7 @@ Parser::ParseErrorOr> Parser::parse_css_value(Property return *parsed_values.take_first(); if (!parsed_values.is_empty() && parsed_values.size() <= property_maximum_value_count(property_id)) - return FIXME_TRY(StyleValueList::create(move(parsed_values), StyleValueList::Separator::Space)); + return StyleValueList::create(move(parsed_values), StyleValueList::Separator::Space); } // We have multiple values, but the property claims to accept only a single one, check if it's a shorthand property. @@ -5956,10 +5956,10 @@ Parser::ParseErrorOr> Parser::parse_css_value(Property if (it.value.size() == 1) longhand_values.unchecked_append(it.value.take_first()); else - longhand_values.unchecked_append(FIXME_TRY(StyleValueList::create(move(it.value), StyleValueList::Separator::Space))); + longhand_values.unchecked_append(StyleValueList::create(move(it.value), StyleValueList::Separator::Space)); } - return { FIXME_TRY(CompositeStyleValue::create(move(longhand_properties), move(longhand_values))) }; + return { CompositeStyleValue::create(move(longhand_properties), move(longhand_values)) }; #undef FIXME_TRY } @@ -6009,14 +6009,14 @@ ErrorOr Parser::parse_css_value_for_properties(Readonl if (ident.has_value()) { if (auto property = any_property_accepts_identifier(property_ids, ident.value()); property.has_value()) { (void)tokens.next_token(); - return PropertyAndValue { *property, TRY(IdentifierStyleValue::create(ident.value())) }; + return PropertyAndValue { *property, IdentifierStyleValue::create(ident.value()) }; } } // Custom idents if (auto property = any_property_accepts_type(property_ids, ValueType::CustomIdent); property.has_value()) { (void)tokens.next_token(); - return PropertyAndValue { *property, TRY(CustomIdentStyleValue::create(TRY(FlyString::from_utf8(peek_token.token().ident())))) }; + return PropertyAndValue { *property, CustomIdentStyleValue::create(TRY(FlyString::from_utf8(peek_token.token().ident()))) }; } } @@ -6064,7 +6064,7 @@ ErrorOr Parser::parse_css_value_for_properties(Readonl auto percentage = Percentage(peek_token.token().percentage()); if (auto property = any_property_accepts_type(property_ids, ValueType::Percentage); property.has_value() && property_accepts_percentage(*property, percentage)) { (void)tokens.next_token(); - return PropertyAndValue { *property, TRY(PercentageStyleValue::create(percentage)) }; + return PropertyAndValue { *property, PercentageStyleValue::create(percentage) }; } } @@ -6077,7 +6077,7 @@ ErrorOr Parser::parse_css_value_for_properties(Readonl if (peek_token.is(Token::Type::String)) { if (auto property = any_property_accepts_type(property_ids, ValueType::String); property.has_value()) - return PropertyAndValue { *property, TRY(StringStyleValue::create(TRY(String::from_utf8(tokens.next_token().token().string())))) }; + return PropertyAndValue { *property, StringStyleValue::create(TRY(String::from_utf8(tokens.next_token().token().string()))) }; } if (auto property = any_property_accepts_type(property_ids, ValueType::Url); property.has_value()) { @@ -6102,35 +6102,35 @@ ErrorOr Parser::parse_css_value_for_properties(Readonl auto angle = dimension.angle(); if (auto property = any_property_accepts_type(property_ids, ValueType::Angle); property.has_value() && property_accepts_angle(*property, angle)) { transaction.commit(); - return PropertyAndValue { *property, TRY(AngleStyleValue::create(angle)) }; + return PropertyAndValue { *property, AngleStyleValue::create(angle) }; } } if (dimension.is_frequency()) { auto frequency = dimension.frequency(); if (auto property = any_property_accepts_type(property_ids, ValueType::Frequency); property.has_value() && property_accepts_frequency(*property, frequency)) { transaction.commit(); - return PropertyAndValue { *property, TRY(FrequencyStyleValue::create(frequency)) }; + return PropertyAndValue { *property, FrequencyStyleValue::create(frequency) }; } } if (dimension.is_length()) { auto length = dimension.length(); if (auto property = any_property_accepts_type(property_ids, ValueType::Length); property.has_value() && property_accepts_length(*property, length)) { transaction.commit(); - return PropertyAndValue { *property, TRY(LengthStyleValue::create(length)) }; + return PropertyAndValue { *property, LengthStyleValue::create(length) }; } } if (dimension.is_resolution()) { auto resolution = dimension.resolution(); if (auto property = any_property_accepts_type(property_ids, ValueType::Resolution); property.has_value() && property_accepts_resolution(*property, resolution)) { transaction.commit(); - return PropertyAndValue { *property, TRY(ResolutionStyleValue::create(resolution)) }; + return PropertyAndValue { *property, ResolutionStyleValue::create(resolution) }; } } if (dimension.is_time()) { auto time = dimension.time(); if (auto property = any_property_accepts_type(property_ids, ValueType::Time); property.has_value() && property_accepts_time(*property, time)) { transaction.commit(); - return PropertyAndValue { *property, TRY(TimeStyleValue::create(time)) }; + return PropertyAndValue { *property, TimeStyleValue::create(time) }; } } } diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index 4388ab39c4..834f4376cd 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -129,33 +129,33 @@ static ErrorOr> style_value_for_display(Display display) StyleValueVector values; switch (display.outside()) { case Display::Outside::Inline: - TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::Inline)))); + TRY(values.try_append(IdentifierStyleValue::create(ValueID::Inline))); break; case Display::Outside::Block: - TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::Block)))); + TRY(values.try_append(IdentifierStyleValue::create(ValueID::Block))); break; case Display::Outside::RunIn: - TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::RunIn)))); + TRY(values.try_append(IdentifierStyleValue::create(ValueID::RunIn))); break; } switch (display.inside()) { case Display::Inside::Flow: - TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::Flow)))); + TRY(values.try_append(IdentifierStyleValue::create(ValueID::Flow))); break; case Display::Inside::FlowRoot: - TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::FlowRoot)))); + TRY(values.try_append(IdentifierStyleValue::create(ValueID::FlowRoot))); break; case Display::Inside::Table: - TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::Table)))); + TRY(values.try_append(IdentifierStyleValue::create(ValueID::Table))); break; case Display::Inside::Flex: - TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::Flex)))); + TRY(values.try_append(IdentifierStyleValue::create(ValueID::Flex))); break; case Display::Inside::Grid: - TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::Grid)))); + TRY(values.try_append(IdentifierStyleValue::create(ValueID::Grid))); break; case Display::Inside::Ruby: - TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::Ruby)))); + TRY(values.try_append(IdentifierStyleValue::create(ValueID::Ruby))); break; } @@ -201,7 +201,7 @@ static NonnullRefPtr value_or_default(Optional return default_style; } -static ErrorOr> style_value_for_length_percentage(LengthPercentage const& length_percentage) +static NonnullRefPtr style_value_for_length_percentage(LengthPercentage const& length_percentage) { if (length_percentage.is_auto()) return IdentifierStyleValue::create(ValueID::Auto); @@ -212,7 +212,7 @@ static ErrorOr> style_value_for_length_percentag return length_percentage.calculated(); } -static ErrorOr> style_value_for_size(Size const& size) +static NonnullRefPtr style_value_for_size(Size const& size) { if (size.is_none()) return IdentifierStyleValue::create(ValueID::None); @@ -232,7 +232,7 @@ static ErrorOr> style_value_for_size(Size const& TODO(); } -static ErrorOr> style_value_for_sided_shorthand(ValueComparingNonnullRefPtr top, ValueComparingNonnullRefPtr right, ValueComparingNonnullRefPtr bottom, ValueComparingNonnullRefPtr left) +static NonnullRefPtr style_value_for_sided_shorthand(ValueComparingNonnullRefPtr top, ValueComparingNonnullRefPtr right, ValueComparingNonnullRefPtr bottom, ValueComparingNonnullRefPtr left) { bool top_and_bottom_same = top == bottom; bool left_and_right_same = left == right; @@ -249,7 +249,7 @@ static ErrorOr> style_value_for_sided_shorthand( return StyleValueList::create(StyleValueVector { move(top), move(right), move(bottom), move(left) }, StyleValueList::Separator::Space); } -static ErrorOr> style_value_for_svg_paint(Optional const& maybe_paint) +static NonnullRefPtr style_value_for_svg_paint(Optional const& maybe_paint) { if (!maybe_paint.has_value()) return IdentifierStyleValue::create(ValueID::None); @@ -269,29 +269,29 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p case PropertyID::AccentColor: { auto accent_color = layout_node.computed_values().accent_color(); if (accent_color.has_value()) - return TRY(ColorStyleValue::create(accent_color.value())); - return TRY(IdentifierStyleValue::create(ValueID::Auto)); + return ColorStyleValue::create(accent_color.value()); + return IdentifierStyleValue::create(ValueID::Auto); } case PropertyID::AlignContent: - return TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().align_content()))); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().align_content())); case PropertyID::AlignItems: - return TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().align_items()))); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().align_items())); case PropertyID::AlignSelf: - return TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().align_self()))); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().align_self())); case PropertyID::Appearance: - return TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().appearance()))); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().appearance())); case PropertyID::AspectRatio: { auto aspect_ratio = layout_node.computed_values().aspect_ratio(); if (aspect_ratio.use_natural_aspect_ratio_if_available && aspect_ratio.preferred_ratio.has_value()) { - return TRY(StyleValueList::create( + return StyleValueList::create( StyleValueVector { - TRY(IdentifierStyleValue::create(ValueID::Auto)), - TRY(RatioStyleValue::create(aspect_ratio.preferred_ratio.value())) }, - StyleValueList::Separator::Space)); + IdentifierStyleValue::create(ValueID::Auto), + RatioStyleValue::create(aspect_ratio.preferred_ratio.value()) }, + StyleValueList::Separator::Space); } if (aspect_ratio.preferred_ratio.has_value()) - return TRY(RatioStyleValue::create(aspect_ratio.preferred_ratio.value())); - return TRY(IdentifierStyleValue::create(ValueID::Auto)); + return RatioStyleValue::create(aspect_ratio.preferred_ratio.value()); + return IdentifierStyleValue::create(ValueID::Auto); } case PropertyID::Background: { auto maybe_background_color = property(PropertyID::BackgroundColor); @@ -304,14 +304,14 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p auto maybe_background_clip = property(PropertyID::BackgroundClip); return BackgroundStyleValue::create( - value_or_default(maybe_background_color, TRY(InitialStyleValue::the())), - value_or_default(maybe_background_image, TRY(IdentifierStyleValue::create(ValueID::None))), - value_or_default(maybe_background_position, TRY(PositionStyleValue::create(TRY(EdgeStyleValue::create(PositionEdge::Left, Length::make_px(0))), TRY(EdgeStyleValue::create(PositionEdge::Top, Length::make_px(0)))))), - value_or_default(maybe_background_size, TRY(IdentifierStyleValue::create(ValueID::Auto))), - value_or_default(maybe_background_repeat, TRY(BackgroundRepeatStyleValue::create(Repeat::Repeat, Repeat::Repeat))), - value_or_default(maybe_background_attachment, TRY(IdentifierStyleValue::create(ValueID::Scroll))), - value_or_default(maybe_background_origin, TRY(IdentifierStyleValue::create(ValueID::PaddingBox))), - value_or_default(maybe_background_clip, TRY(IdentifierStyleValue::create(ValueID::BorderBox)))); + value_or_default(maybe_background_color, InitialStyleValue::the()), + value_or_default(maybe_background_image, IdentifierStyleValue::create(ValueID::None)), + value_or_default(maybe_background_position, PositionStyleValue::create(EdgeStyleValue::create(PositionEdge::Left, Length::make_px(0)), EdgeStyleValue::create(PositionEdge::Top, Length::make_px(0)))), + value_or_default(maybe_background_size, IdentifierStyleValue::create(ValueID::Auto)), + value_or_default(maybe_background_repeat, BackgroundRepeatStyleValue::create(Repeat::Repeat, Repeat::Repeat)), + value_or_default(maybe_background_attachment, IdentifierStyleValue::create(ValueID::Scroll)), + value_or_default(maybe_background_origin, IdentifierStyleValue::create(ValueID::PaddingBox)), + value_or_default(maybe_background_clip, IdentifierStyleValue::create(ValueID::BorderBox))); } case PropertyID::BackgroundAttachment: return style_value_for_background_property( @@ -344,13 +344,13 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p layout_node, [](auto& layer) -> ErrorOr> { return PositionStyleValue::create( - TRY(EdgeStyleValue::create(layer.position_edge_x, layer.position_offset_x)), - TRY(EdgeStyleValue::create(layer.position_edge_y, layer.position_offset_y))); + EdgeStyleValue::create(layer.position_edge_x, layer.position_offset_x), + EdgeStyleValue::create(layer.position_edge_y, layer.position_offset_y)); }, []() -> ErrorOr> { return PositionStyleValue::create( - TRY(EdgeStyleValue::create(PositionEdge::Left, Percentage(0))), - TRY(EdgeStyleValue::create(PositionEdge::Top, Percentage(0)))); + EdgeStyleValue::create(PositionEdge::Left, Percentage(0)), + EdgeStyleValue::create(PositionEdge::Top, Percentage(0))); }); case PropertyID::BackgroundPositionX: return style_value_for_background_property( @@ -367,8 +367,8 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p layout_node, [](auto& layer) -> ErrorOr> { StyleValueVector repeat { - TRY(IdentifierStyleValue::create(to_value_id(layer.repeat_x))), - TRY(IdentifierStyleValue::create(to_value_id(layer.repeat_y))), + IdentifierStyleValue::create(to_value_id(layer.repeat_x)), + IdentifierStyleValue::create(to_value_id(layer.repeat_y)), }; return StyleValueList::create(move(repeat), StyleValueList::Separator::Space); }, @@ -396,16 +396,16 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p // `border` only has a reasonable value if all four sides are the same. if (top != right || top != bottom || top != left) return nullptr; - auto width = TRY(LengthStyleValue::create(Length::make_px(top.width))); - auto style = TRY(IdentifierStyleValue::create(to_value_id(top.line_style))); - auto color = TRY(ColorStyleValue::create(top.color)); + auto width = LengthStyleValue::create(Length::make_px(top.width)); + auto style = IdentifierStyleValue::create(to_value_id(top.line_style)); + auto color = ColorStyleValue::create(top.color); return BorderStyleValue::create(width, style, color); } case PropertyID::BorderBottom: { auto border = layout_node.computed_values().border_bottom(); - auto width = TRY(LengthStyleValue::create(Length::make_px(border.width))); - auto style = TRY(IdentifierStyleValue::create(to_value_id(border.line_style))); - auto color = TRY(ColorStyleValue::create(border.color)); + auto width = LengthStyleValue::create(Length::make_px(border.width)); + auto style = IdentifierStyleValue::create(to_value_id(border.line_style)); + auto color = ColorStyleValue::create(border.color); return BorderStyleValue::create(width, style, color); } case PropertyID::BorderBottomColor: @@ -423,19 +423,19 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p case PropertyID::BorderBottomWidth: return LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_bottom().width)); case PropertyID::BorderColor: { - auto top = TRY(ColorStyleValue::create(layout_node.computed_values().border_top().color)); - auto right = TRY(ColorStyleValue::create(layout_node.computed_values().border_right().color)); - auto bottom = TRY(ColorStyleValue::create(layout_node.computed_values().border_bottom().color)); - auto left = TRY(ColorStyleValue::create(layout_node.computed_values().border_left().color)); + auto top = ColorStyleValue::create(layout_node.computed_values().border_top().color); + auto right = ColorStyleValue::create(layout_node.computed_values().border_right().color); + auto bottom = ColorStyleValue::create(layout_node.computed_values().border_bottom().color); + auto left = ColorStyleValue::create(layout_node.computed_values().border_left().color); return style_value_for_sided_shorthand(top, right, bottom, left); } case PropertyID::BorderCollapse: return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_collapse())); case PropertyID::BorderLeft: { auto border = layout_node.computed_values().border_left(); - auto width = TRY(LengthStyleValue::create(Length::make_px(border.width))); - auto style = TRY(IdentifierStyleValue::create(to_value_id(border.line_style))); - auto color = TRY(ColorStyleValue::create(border.color)); + auto width = LengthStyleValue::create(Length::make_px(border.width)); + auto style = IdentifierStyleValue::create(to_value_id(border.line_style)); + auto color = ColorStyleValue::create(border.color); return BorderStyleValue::create(width, style, color); } case PropertyID::BorderLeftColor: @@ -471,9 +471,9 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p } case PropertyID::BorderRight: { auto border = layout_node.computed_values().border_right(); - auto width = TRY(LengthStyleValue::create(Length::make_px(border.width))); - auto style = TRY(IdentifierStyleValue::create(to_value_id(border.line_style))); - auto color = TRY(ColorStyleValue::create(border.color)); + auto width = LengthStyleValue::create(Length::make_px(border.width)); + auto style = IdentifierStyleValue::create(to_value_id(border.line_style)); + auto color = ColorStyleValue::create(border.color); return BorderStyleValue::create(width, style, color); } case PropertyID::BorderRightColor: @@ -489,23 +489,23 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p return LengthStyleValue::create(horizontal); return StyleValueList::create( { - TRY(LengthStyleValue::create(horizontal)), - TRY(LengthStyleValue::create(vertical)), + LengthStyleValue::create(horizontal), + LengthStyleValue::create(vertical), }, StyleValueList::Separator::Space); } case PropertyID::BorderStyle: { - auto top = TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_top().line_style))); - auto right = TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_right().line_style))); - auto bottom = TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_bottom().line_style))); - auto left = TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_left().line_style))); + auto top = IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_top().line_style)); + auto right = IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_right().line_style)); + auto bottom = IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_bottom().line_style)); + auto left = IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_left().line_style)); return style_value_for_sided_shorthand(top, right, bottom, left); } case PropertyID::BorderTop: { auto border = layout_node.computed_values().border_top(); - auto width = TRY(LengthStyleValue::create(Length::make_px(border.width))); - auto style = TRY(IdentifierStyleValue::create(to_value_id(border.line_style))); - auto color = TRY(ColorStyleValue::create(border.color)); + auto width = LengthStyleValue::create(Length::make_px(border.width)); + auto style = IdentifierStyleValue::create(to_value_id(border.line_style)); + auto color = ColorStyleValue::create(border.color); return BorderStyleValue::create(width, style, color); } case PropertyID::BorderTopColor: @@ -523,10 +523,10 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p case PropertyID::BorderTopWidth: return LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_top().width)); case PropertyID::BorderWidth: { - auto top = TRY(LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_top().width))); - auto right = TRY(LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_right().width))); - auto bottom = TRY(LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_bottom().width))); - auto left = TRY(LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_left().width))); + auto top = LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_top().width)); + auto right = LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_right().width)); + auto bottom = LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_bottom().width)); + auto left = LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_left().width)); return style_value_for_sided_shorthand(top, right, bottom, left); } case PropertyID::Bottom: @@ -537,10 +537,10 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p return nullptr; auto make_box_shadow_style_value = [](ShadowData const& data) -> ErrorOr> { - auto offset_x = TRY(LengthStyleValue::create(data.offset_x)); - auto offset_y = TRY(LengthStyleValue::create(data.offset_y)); - auto blur_radius = TRY(LengthStyleValue::create(data.blur_radius)); - auto spread_distance = TRY(LengthStyleValue::create(data.spread_distance)); + auto offset_x = LengthStyleValue::create(data.offset_x); + auto offset_y = LengthStyleValue::create(data.offset_y); + auto blur_radius = LengthStyleValue::create(data.blur_radius); + auto spread_distance = LengthStyleValue::create(data.spread_distance); return ShadowStyleValue::create(data.color, offset_x, offset_y, blur_radius, spread_distance, data.placement); }; @@ -705,9 +705,9 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p case PropertyID::JustifyContent: return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().justify_content())); case PropertyID::JustifyItems: - return TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().justify_items()))); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().justify_items())); case PropertyID::JustifySelf: - return TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().justify_self()))); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().justify_self())); case PropertyID::Left: return style_value_for_length_percentage(layout_node.computed_values().inset().left()); case PropertyID::LineHeight: @@ -716,10 +716,10 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().list_style_type())); case PropertyID::Margin: { auto margin = layout_node.computed_values().margin(); - auto top = TRY(style_value_for_length_percentage(margin.top())); - auto right = TRY(style_value_for_length_percentage(margin.right())); - auto bottom = TRY(style_value_for_length_percentage(margin.bottom())); - auto left = TRY(style_value_for_length_percentage(margin.left())); + auto top = style_value_for_length_percentage(margin.top()); + auto right = style_value_for_length_percentage(margin.right()); + auto bottom = style_value_for_length_percentage(margin.bottom()); + auto left = style_value_for_length_percentage(margin.left()); return style_value_for_sided_shorthand(move(top), move(right), move(bottom), move(left)); } case PropertyID::MarginBottom: @@ -763,10 +763,10 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().overflow_y())); case PropertyID::Padding: { auto padding = layout_node.computed_values().padding(); - auto top = TRY(style_value_for_length_percentage(padding.top())); - auto right = TRY(style_value_for_length_percentage(padding.right())); - auto bottom = TRY(style_value_for_length_percentage(padding.bottom())); - auto left = TRY(style_value_for_length_percentage(padding.left())); + auto top = style_value_for_length_percentage(padding.top()); + auto right = style_value_for_length_percentage(padding.right()); + auto bottom = style_value_for_length_percentage(padding.bottom()); + auto left = style_value_for_length_percentage(padding.left()); return style_value_for_sided_shorthand(move(top), move(right), move(bottom), move(left)); } case PropertyID::PaddingBottom: @@ -809,7 +809,7 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p StyleValueVector style_values; TRY(style_values.try_ensure_capacity(text_decoration_lines.size())); for (auto const& line : text_decoration_lines) { - style_values.unchecked_append(TRY(IdentifierStyleValue::create(to_value_id(line)))); + style_values.unchecked_append(IdentifierStyleValue::create(to_value_id(line))); } return StyleValueList::create(move(style_values), StyleValueList::Separator::Space); } @@ -848,14 +848,14 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p StyleValueVector parameters; TRY(parameters.try_ensure_capacity(6)); - parameters.unchecked_append(TRY(NumberStyleValue::create(affine_matrix.a()))); - parameters.unchecked_append(TRY(NumberStyleValue::create(affine_matrix.b()))); - parameters.unchecked_append(TRY(NumberStyleValue::create(affine_matrix.c()))); - parameters.unchecked_append(TRY(NumberStyleValue::create(affine_matrix.d()))); - parameters.unchecked_append(TRY(NumberStyleValue::create(affine_matrix.e()))); - parameters.unchecked_append(TRY(NumberStyleValue::create(affine_matrix.f()))); + parameters.unchecked_append(NumberStyleValue::create(affine_matrix.a())); + parameters.unchecked_append(NumberStyleValue::create(affine_matrix.b())); + parameters.unchecked_append(NumberStyleValue::create(affine_matrix.c())); + parameters.unchecked_append(NumberStyleValue::create(affine_matrix.d())); + parameters.unchecked_append(NumberStyleValue::create(affine_matrix.e())); + parameters.unchecked_append(NumberStyleValue::create(affine_matrix.f())); - NonnullRefPtr matrix_function = TRY(TransformationStyleValue::create(TransformFunction::Matrix, move(parameters))); + NonnullRefPtr matrix_function = TransformationStyleValue::create(TransformFunction::Matrix, move(parameters)); // Elsewhere we always store the transform property's value as a StyleValueList of TransformationStyleValues, // so this is just for consistency. StyleValueVector matrix_functions { matrix_function }; diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 15d069e5a4..2c11103789 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -688,8 +688,8 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope y_positions.unchecked_append(layer); } } - set_longhand_property(CSS::PropertyID::BackgroundPositionX, StyleValueList::create(move(x_positions), values_list.separator()).release_value_but_fixme_should_propagate_errors()); - set_longhand_property(CSS::PropertyID::BackgroundPositionY, StyleValueList::create(move(y_positions), values_list.separator()).release_value_but_fixme_should_propagate_errors()); + set_longhand_property(CSS::PropertyID::BackgroundPositionX, StyleValueList::create(move(x_positions), values_list.separator())); + set_longhand_property(CSS::PropertyID::BackgroundPositionY, StyleValueList::create(move(y_positions), values_list.separator())); } else { set_longhand_property(CSS::PropertyID::BackgroundPositionX, value); set_longhand_property(CSS::PropertyID::BackgroundPositionY, value); @@ -2320,8 +2320,8 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele auto found_font = compute_font_for_style_values(element, pseudo_element, font_family, font_size, font_style, font_weight, font_stretch); - style.set_property(CSS::PropertyID::FontSize, LengthStyleValue::create(CSS::Length::make_px(found_font->pixel_size())).release_value_but_fixme_should_propagate_errors(), nullptr); - style.set_property(CSS::PropertyID::FontWeight, NumberStyleValue::create(font_weight->to_font_weight()).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::FontSize, LengthStyleValue::create(CSS::Length::make_px(found_font->pixel_size())), nullptr); + style.set_property(CSS::PropertyID::FontWeight, NumberStyleValue::create(font_weight->to_font_weight())); style.set_computed_font(found_font.release_nonnull()); @@ -2370,8 +2370,8 @@ ErrorOr StyleComputer::absolutize_values(StyleProperties& style, DOM::Elem // because most percentages are relative to containing block metrics. auto line_height_value_slot = style.m_property_values[to_underlying(CSS::PropertyID::LineHeight)].map([](auto& x) -> auto& { return x.style; }); if (line_height_value_slot.has_value() && (*line_height_value_slot)->is_percentage()) { - *line_height_value_slot = TRY(LengthStyleValue::create( - Length::make_px(font_size * static_cast((*line_height_value_slot)->as_percentage().percentage().as_fraction())))); + *line_height_value_slot = LengthStyleValue::create( + Length::make_px(font_size * static_cast((*line_height_value_slot)->as_percentage().percentage().as_fraction()))); } auto line_height = style.line_height(viewport_rect(), font_metrics, m_root_element_font_metrics); @@ -2379,7 +2379,7 @@ ErrorOr StyleComputer::absolutize_values(StyleProperties& style, DOM::Elem // NOTE: line-height might be using lh which should be resolved against the parent line height (like we did here already) if (line_height_value_slot.has_value() && (*line_height_value_slot)->is_length()) - (*line_height_value_slot) = TRY(LengthStyleValue::create(Length::make_px(line_height))); + (*line_height_value_slot) = LengthStyleValue::create(Length::make_px(line_height)); for (size_t i = 0; i < style.m_property_values.size(); ++i) { auto& value_slot = style.m_property_values[i]; @@ -2479,7 +2479,7 @@ void StyleComputer::transform_box_type_if_needed(StyleProperties& style, DOM::El } if (new_display != display) - style.set_property(CSS::PropertyID::Display, DisplayStyleValue::create(new_display).release_value_but_fixme_should_propagate_errors(), style.property_source_declaration(CSS::PropertyID::Display)); + style.set_property(CSS::PropertyID::Display, DisplayStyleValue::create(new_display), style.property_source_declaration(CSS::PropertyID::Display)); } NonnullRefPtr StyleComputer::create_document_style() const @@ -2488,9 +2488,9 @@ NonnullRefPtr StyleComputer::create_document_style() const compute_font(style, nullptr, {}); compute_defaulted_values(style, nullptr, {}); absolutize_values(style, nullptr, {}).release_value_but_fixme_should_propagate_errors(); - style->set_property(CSS::PropertyID::Width, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().width())).release_value_but_fixme_should_propagate_errors(), nullptr); - style->set_property(CSS::PropertyID::Height, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().height())).release_value_but_fixme_should_propagate_errors(), nullptr); - style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Block)).release_value_but_fixme_should_propagate_errors(), nullptr); + style->set_property(CSS::PropertyID::Width, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().width())), nullptr); + style->set_property(CSS::PropertyID::Height, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().height())), nullptr); + style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Block)), nullptr); return style; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.h index e4437a7609..a01230128a 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.h @@ -16,9 +16,9 @@ namespace Web::CSS { class AngleStyleValue : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(Angle angle) + static ValueComparingNonnullRefPtr create(Angle angle) { - return adopt_nonnull_ref_or_enomem(new (nothrow) AngleStyleValue(move(angle))); + return adopt_ref(*new (nothrow) AngleStyleValue(move(angle))); } virtual ~AngleStyleValue() override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/BackgroundRepeatStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/BackgroundRepeatStyleValue.h index a3ea5c8df4..cb084f9408 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/BackgroundRepeatStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/BackgroundRepeatStyleValue.h @@ -16,9 +16,9 @@ namespace Web::CSS { class BackgroundRepeatStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(Repeat repeat_x, Repeat repeat_y) + static ValueComparingNonnullRefPtr create(Repeat repeat_x, Repeat repeat_y) { - return adopt_nonnull_ref_or_enomem(new (nothrow) BackgroundRepeatStyleValue(repeat_x, repeat_y)); + return adopt_ref(*new (nothrow) BackgroundRepeatStyleValue(repeat_x, repeat_y)); } virtual ~BackgroundRepeatStyleValue() override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/BackgroundSizeStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/BackgroundSizeStyleValue.h index 593979e685..0a4f3b2df2 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/BackgroundSizeStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/BackgroundSizeStyleValue.h @@ -18,9 +18,9 @@ namespace Web::CSS { // NOTE: This is not used for identifier sizes, like `cover` and `contain`. class BackgroundSizeStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(LengthPercentage size_x, LengthPercentage size_y) + static ValueComparingNonnullRefPtr create(LengthPercentage size_x, LengthPercentage size_y) { - return adopt_nonnull_ref_or_enomem(new (nothrow) BackgroundSizeStyleValue(size_x, size_y)); + return adopt_ref(*new (nothrow) BackgroundSizeStyleValue(size_x, size_y)); } virtual ~BackgroundSizeStyleValue() override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/BackgroundStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/BackgroundStyleValue.h index 797776dea7..42240d6313 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/BackgroundStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/BackgroundStyleValue.h @@ -15,7 +15,7 @@ namespace Web::CSS { class BackgroundStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create( + static ValueComparingNonnullRefPtr create( ValueComparingNonnullRefPtr color, ValueComparingNonnullRefPtr image, ValueComparingNonnullRefPtr position, @@ -25,7 +25,7 @@ public: ValueComparingNonnullRefPtr origin, ValueComparingNonnullRefPtr clip) { - return adopt_nonnull_ref_or_enomem(new (nothrow) BackgroundStyleValue(move(color), move(image), move(position), move(size), move(repeat), move(attachment), move(origin), move(clip))); + return adopt_ref(*new (nothrow) BackgroundStyleValue(move(color), move(image), move(position), move(size), move(repeat), move(attachment), move(origin), move(clip))); } virtual ~BackgroundStyleValue() override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/BorderRadiusShorthandStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/BorderRadiusShorthandStyleValue.h index ee76105b66..cedc862512 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/BorderRadiusShorthandStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/BorderRadiusShorthandStyleValue.h @@ -16,13 +16,13 @@ namespace Web::CSS { class BorderRadiusShorthandStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create( + static ValueComparingNonnullRefPtr create( ValueComparingNonnullRefPtr top_left, ValueComparingNonnullRefPtr top_right, ValueComparingNonnullRefPtr bottom_right, ValueComparingNonnullRefPtr bottom_left) { - return adopt_nonnull_ref_or_enomem(new (nothrow) BorderRadiusShorthandStyleValue(move(top_left), move(top_right), move(bottom_right), move(bottom_left))); + return adopt_ref(*new (nothrow) BorderRadiusShorthandStyleValue(move(top_left), move(top_right), move(bottom_right), move(bottom_left))); } virtual ~BorderRadiusShorthandStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/BorderRadiusStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/BorderRadiusStyleValue.h index 1d28b4002e..b5de4a3575 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/BorderRadiusStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/BorderRadiusStyleValue.h @@ -17,9 +17,9 @@ namespace Web::CSS { class BorderRadiusStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(LengthPercentage const& horizontal_radius, LengthPercentage const& vertical_radius) + static ValueComparingNonnullRefPtr create(LengthPercentage const& horizontal_radius, LengthPercentage const& vertical_radius) { - return adopt_nonnull_ref_or_enomem(new (nothrow) BorderRadiusStyleValue(horizontal_radius, vertical_radius)); + return adopt_ref(*new (nothrow) BorderRadiusStyleValue(horizontal_radius, vertical_radius)); } virtual ~BorderRadiusStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/BorderStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/BorderStyleValue.h index fffb42a633..d84db7558f 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/BorderStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/BorderStyleValue.h @@ -15,12 +15,12 @@ namespace Web::CSS { class BorderStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create( + static ValueComparingNonnullRefPtr create( ValueComparingNonnullRefPtr border_width, ValueComparingNonnullRefPtr border_style, ValueComparingNonnullRefPtr border_color) { - return adopt_nonnull_ref_or_enomem(new (nothrow) BorderStyleValue(move(border_width), move(border_style), move(border_color))); + return adopt_ref(*new (nothrow) BorderStyleValue(move(border_width), move(border_style), move(border_color))); } virtual ~BorderStyleValue() override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h index d50bac72ec..ca39b039c7 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h @@ -66,9 +66,9 @@ public: Value m_value; }; - static ErrorOr> create(NonnullOwnPtr calculation, CSSNumericType resolved_type) + static ValueComparingNonnullRefPtr create(NonnullOwnPtr calculation, CSSNumericType resolved_type) { - return adopt_nonnull_ref_or_enomem(new (nothrow) CalculatedStyleValue(move(calculation), resolved_type)); + return adopt_ref(*new (nothrow) CalculatedStyleValue(move(calculation), resolved_type)); } ErrorOr to_string() const override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ColorStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/ColorStyleValue.cpp index c4de19cca2..906d7de16c 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ColorStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ColorStyleValue.cpp @@ -12,24 +12,24 @@ namespace Web::CSS { -ErrorOr> ColorStyleValue::create(Color color) +ValueComparingNonnullRefPtr ColorStyleValue::create(Color color) { if (color.value() == 0) { - static auto transparent = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ColorStyleValue(color))); + static auto transparent = adopt_ref(*new (nothrow) ColorStyleValue(color)); return transparent; } if (color == Color::from_rgb(0x000000)) { - static auto black = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ColorStyleValue(color))); + static auto black = adopt_ref(*new (nothrow) ColorStyleValue(color)); return black; } if (color == Color::from_rgb(0xffffff)) { - static auto white = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ColorStyleValue(color))); + static auto white = adopt_ref(*new (nothrow) ColorStyleValue(color)); return white; } - return adopt_nonnull_ref_or_enomem(new (nothrow) ColorStyleValue(color)); + return adopt_ref(*new (nothrow) ColorStyleValue(color)); } ErrorOr ColorStyleValue::to_string() const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ColorStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/ColorStyleValue.h index 0d1516820f..414d8d2a8d 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ColorStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ColorStyleValue.h @@ -16,7 +16,7 @@ namespace Web::CSS { class ColorStyleValue : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(Color color); + static ValueComparingNonnullRefPtr create(Color color); virtual ~ColorStyleValue() override = default; Color color() const { return m_color; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/CompositeStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/CompositeStyleValue.h index dd6bed05e6..f3ebd44c87 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/CompositeStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/CompositeStyleValue.h @@ -12,9 +12,9 @@ namespace Web::CSS { class CompositeStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(Vector sub_properties, Vector> values) + static ValueComparingNonnullRefPtr create(Vector sub_properties, Vector> values) { - return adopt_nonnull_ref_or_enomem(new CompositeStyleValue(move(sub_properties), move(values))); + return adopt_ref(*new CompositeStyleValue(move(sub_properties), move(values))); } virtual ~CompositeStyleValue() override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ConicGradientStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/ConicGradientStyleValue.h index 5603d0e517..7c5888c8af 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ConicGradientStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ConicGradientStyleValue.h @@ -18,10 +18,10 @@ namespace Web::CSS { class ConicGradientStyleValue final : public AbstractImageStyleValue { public: - static ErrorOr> create(Angle from_angle, PositionValue position, Vector color_stop_list, GradientRepeating repeating) + static ValueComparingNonnullRefPtr create(Angle from_angle, PositionValue position, Vector color_stop_list, GradientRepeating repeating) { VERIFY(color_stop_list.size() >= 2); - return adopt_nonnull_ref_or_enomem(new (nothrow) ConicGradientStyleValue(from_angle, position, move(color_stop_list), repeating)); + return adopt_ref(*new (nothrow) ConicGradientStyleValue(from_angle, position, move(color_stop_list), repeating)); } virtual ErrorOr to_string() const override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ContentStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/ContentStyleValue.h index bfc5ce5f8b..4124317f2e 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ContentStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ContentStyleValue.h @@ -15,9 +15,9 @@ namespace Web::CSS { class ContentStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(ValueComparingNonnullRefPtr content, ValueComparingRefPtr alt_text) + static ValueComparingNonnullRefPtr create(ValueComparingNonnullRefPtr content, ValueComparingRefPtr alt_text) { - return adopt_nonnull_ref_or_enomem(new (nothrow) ContentStyleValue(move(content), move(alt_text))); + return adopt_ref(*new (nothrow) ContentStyleValue(move(content), move(alt_text))); } virtual ~ContentStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/CustomIdentStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/CustomIdentStyleValue.h index 7c92c52d89..2db44a3ece 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/CustomIdentStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/CustomIdentStyleValue.h @@ -14,9 +14,9 @@ namespace Web::CSS { // https://www.w3.org/TR/css-values-4/#custom-idents class CustomIdentStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(FlyString custom_ident) + static ValueComparingNonnullRefPtr create(FlyString custom_ident) { - return adopt_nonnull_ref_or_enomem(new (nothrow) CustomIdentStyleValue(move(custom_ident))); + return adopt_ref(*new (nothrow) CustomIdentStyleValue(move(custom_ident))); } virtual ~CustomIdentStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/DisplayStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/DisplayStyleValue.cpp index da78f1e030..3adf2af752 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/DisplayStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/DisplayStyleValue.cpp @@ -8,9 +8,9 @@ namespace Web::CSS { -ErrorOr> DisplayStyleValue::create(Display const& display) +ValueComparingNonnullRefPtr DisplayStyleValue::create(Display const& display) { - return adopt_nonnull_ref_or_enomem(new (nothrow) DisplayStyleValue(display)); + return adopt_ref(*new (nothrow) DisplayStyleValue(display)); } } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/DisplayStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/DisplayStyleValue.h index 856008bdcf..474af6a20c 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/DisplayStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/DisplayStyleValue.h @@ -13,7 +13,7 @@ namespace Web::CSS { class DisplayStyleValue : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(Display const&); + static ValueComparingNonnullRefPtr create(Display const&); virtual ~DisplayStyleValue() override = default; virtual ErrorOr to_string() const override { return m_display.to_string(); } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/EasingStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/EasingStyleValue.h index c22bd3c10f..d5fc007d74 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/EasingStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/EasingStyleValue.h @@ -17,9 +17,9 @@ namespace Web::CSS { class EasingStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(CSS::EasingFunction easing_function, StyleValueVector&& values) + static ValueComparingNonnullRefPtr create(CSS::EasingFunction easing_function, StyleValueVector&& values) { - return adopt_nonnull_ref_or_enomem(new (nothrow) EasingStyleValue(easing_function, move(values))); + return adopt_ref(*new (nothrow) EasingStyleValue(easing_function, move(values))); } virtual ~EasingStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/EdgeStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/EdgeStyleValue.h index af5c10e4a3..0fdec93512 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/EdgeStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/EdgeStyleValue.h @@ -14,9 +14,9 @@ namespace Web::CSS { class EdgeStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(PositionEdge edge, LengthPercentage const& offset) + static ValueComparingNonnullRefPtr create(PositionEdge edge, LengthPercentage const& offset) { - return adopt_nonnull_ref_or_enomem(new (nothrow) EdgeStyleValue(edge, offset)); + return adopt_ref(*new (nothrow) EdgeStyleValue(edge, offset)); } virtual ~EdgeStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.h index 7b3c5e9e60..3fb1830ae1 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.h @@ -70,11 +70,11 @@ using FilterFunction = Variant { public: - static ErrorOr> create( + static ValueComparingNonnullRefPtr create( Vector filter_value_list) { VERIFY(filter_value_list.size() >= 1); - return adopt_nonnull_ref_or_enomem(new (nothrow) FilterValueListStyleValue(move(filter_value_list))); + return adopt_ref(*new (nothrow) FilterValueListStyleValue(move(filter_value_list))); } Vector const& filter_value_list() const { return m_filter_value_list; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/FlexFlowStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/FlexFlowStyleValue.h index c6968a6bb9..5ea5f30b94 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/FlexFlowStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/FlexFlowStyleValue.h @@ -15,9 +15,9 @@ namespace Web::CSS { class FlexFlowStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(ValueComparingNonnullRefPtr flex_direction, ValueComparingNonnullRefPtr flex_wrap) + static ValueComparingNonnullRefPtr create(ValueComparingNonnullRefPtr flex_direction, ValueComparingNonnullRefPtr flex_wrap) { - return adopt_nonnull_ref_or_enomem(new (nothrow) FlexFlowStyleValue(move(flex_direction), move(flex_wrap))); + return adopt_ref(*new (nothrow) FlexFlowStyleValue(move(flex_direction), move(flex_wrap))); } virtual ~FlexFlowStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/FlexStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/FlexStyleValue.h index ecd02846f0..6cfa530165 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/FlexStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/FlexStyleValue.h @@ -15,12 +15,12 @@ namespace Web::CSS { class FlexStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create( + static ValueComparingNonnullRefPtr create( ValueComparingNonnullRefPtr grow, ValueComparingNonnullRefPtr shrink, ValueComparingNonnullRefPtr basis) { - return adopt_nonnull_ref_or_enomem(new (nothrow) FlexStyleValue(move(grow), move(shrink), move(basis))); + return adopt_ref(*new (nothrow) FlexStyleValue(move(grow), move(shrink), move(basis))); } virtual ~FlexStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/FontStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/FontStyleValue.h index 4563a22369..64441bd5bf 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/FontStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/FontStyleValue.h @@ -15,7 +15,7 @@ namespace Web::CSS { class FontStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create( + static ValueComparingNonnullRefPtr create( ValueComparingNonnullRefPtr font_stretch, ValueComparingNonnullRefPtr font_style, ValueComparingNonnullRefPtr font_weight, @@ -23,7 +23,7 @@ public: ValueComparingNonnullRefPtr line_height, ValueComparingNonnullRefPtr font_families) { - return adopt_nonnull_ref_or_enomem(new (nothrow) FontStyleValue(move(font_stretch), move(font_style), move(font_weight), move(font_size), move(line_height), move(font_families))); + return adopt_ref(*new (nothrow) FontStyleValue(move(font_stretch), move(font_style), move(font_weight), move(font_size), move(line_height), move(font_families))); } virtual ~FontStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/FrequencyStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/FrequencyStyleValue.h index 72b67b5820..1a6c96ba3e 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/FrequencyStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/FrequencyStyleValue.h @@ -16,9 +16,9 @@ namespace Web::CSS { class FrequencyStyleValue : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(Frequency frequency) + static ValueComparingNonnullRefPtr create(Frequency frequency) { - return adopt_nonnull_ref_or_enomem(new (nothrow) FrequencyStyleValue(move(frequency))); + return adopt_ref(*new (nothrow) FrequencyStyleValue(move(frequency))); } virtual ~FrequencyStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.cpp index 6713fcc9a7..caddec1b97 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.cpp @@ -12,22 +12,22 @@ namespace Web::CSS { -ErrorOr> GridAreaShorthandStyleValue::create( +ValueComparingNonnullRefPtr GridAreaShorthandStyleValue::create( ValueComparingNonnullRefPtr row_start, ValueComparingNonnullRefPtr column_start, ValueComparingNonnullRefPtr row_end, ValueComparingNonnullRefPtr column_end) { - return adopt_nonnull_ref_or_enomem(new (nothrow) GridAreaShorthandStyleValue(row_start, column_start, row_end, column_end)); + return adopt_ref(*new (nothrow) GridAreaShorthandStyleValue(row_start, column_start, row_end, column_end)); } -ErrorOr> GridAreaShorthandStyleValue::create(GridTrackPlacement row_start, GridTrackPlacement column_start, GridTrackPlacement row_end, GridTrackPlacement column_end) +ValueComparingNonnullRefPtr GridAreaShorthandStyleValue::create(GridTrackPlacement row_start, GridTrackPlacement column_start, GridTrackPlacement row_end, GridTrackPlacement column_end) { - return adopt_nonnull_ref_or_enomem(new (nothrow) GridAreaShorthandStyleValue( - TRY(GridTrackPlacementStyleValue::create(row_start)), - TRY(GridTrackPlacementStyleValue::create(column_start)), - TRY(GridTrackPlacementStyleValue::create(row_end)), - TRY(GridTrackPlacementStyleValue::create(column_end)))); + return adopt_ref(*new (nothrow) GridAreaShorthandStyleValue( + GridTrackPlacementStyleValue::create(row_start), + GridTrackPlacementStyleValue::create(column_start), + GridTrackPlacementStyleValue::create(row_end), + GridTrackPlacementStyleValue::create(column_end))); } ErrorOr GridAreaShorthandStyleValue::to_string() const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h index c22d6f7217..9f63da82ff 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h @@ -15,12 +15,12 @@ namespace Web::CSS { class GridAreaShorthandStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create( + static ValueComparingNonnullRefPtr create( ValueComparingNonnullRefPtr row_start, ValueComparingNonnullRefPtr column_start, ValueComparingNonnullRefPtr row_end, ValueComparingNonnullRefPtr column_end); - static ErrorOr> create(GridTrackPlacement row_start, GridTrackPlacement column_start, GridTrackPlacement row_end, GridTrackPlacement column_end); + static ValueComparingNonnullRefPtr create(GridTrackPlacement row_start, GridTrackPlacement column_start, GridTrackPlacement row_end, GridTrackPlacement column_end); virtual ~GridAreaShorthandStyleValue() override = default; auto row_start() const { return m_properties.row_start; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.cpp index a12b171abc..b9ad7a3e22 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.cpp @@ -11,9 +11,9 @@ namespace Web::CSS { -ErrorOr> GridTemplateAreaStyleValue::create(Vector> grid_template_area) +ValueComparingNonnullRefPtr GridTemplateAreaStyleValue::create(Vector> grid_template_area) { - return adopt_nonnull_ref_or_enomem(new (nothrow) GridTemplateAreaStyleValue(grid_template_area)); + return adopt_ref(*new (nothrow) GridTemplateAreaStyleValue(grid_template_area)); } ErrorOr GridTemplateAreaStyleValue::to_string() const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h index dab6c96f5e..61d3cad017 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h @@ -15,7 +15,7 @@ namespace Web::CSS { class GridTemplateAreaStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(Vector> grid_template_area); + static ValueComparingNonnullRefPtr create(Vector> grid_template_area); virtual ~GridTemplateAreaStyleValue() override = default; Vector> const& grid_template_area() const { return m_grid_template_area; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.cpp index babb00ff02..5961ac4037 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.cpp @@ -12,16 +12,16 @@ namespace Web::CSS { -ErrorOr> GridTrackPlacementShorthandStyleValue::create(ValueComparingNonnullRefPtr start, ValueComparingNonnullRefPtr end) +ValueComparingNonnullRefPtr GridTrackPlacementShorthandStyleValue::create(ValueComparingNonnullRefPtr start, ValueComparingNonnullRefPtr end) { - return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackPlacementShorthandStyleValue(move(start), move(end))); + return adopt_ref(*new (nothrow) GridTrackPlacementShorthandStyleValue(move(start), move(end))); } -ErrorOr> GridTrackPlacementShorthandStyleValue::create(GridTrackPlacement start) +ValueComparingNonnullRefPtr GridTrackPlacementShorthandStyleValue::create(GridTrackPlacement start) { - return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackPlacementShorthandStyleValue( - TRY(GridTrackPlacementStyleValue::create(start)), - TRY(GridTrackPlacementStyleValue::create(GridTrackPlacement::make_auto())))); + return adopt_ref(*new (nothrow) GridTrackPlacementShorthandStyleValue( + GridTrackPlacementStyleValue::create(start), + GridTrackPlacementStyleValue::create(GridTrackPlacement::make_auto()))); } ErrorOr GridTrackPlacementShorthandStyleValue::to_string() const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h index 76a8f06ea6..bb21a7f0c6 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h @@ -15,8 +15,8 @@ namespace Web::CSS { class GridTrackPlacementShorthandStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(ValueComparingNonnullRefPtr start, ValueComparingNonnullRefPtr end); - static ErrorOr> create(GridTrackPlacement start); + static ValueComparingNonnullRefPtr create(ValueComparingNonnullRefPtr start, ValueComparingNonnullRefPtr end); + static ValueComparingNonnullRefPtr create(GridTrackPlacement start); virtual ~GridTrackPlacementShorthandStyleValue() override = default; auto start() const { return m_properties.start; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.cpp index 4ff810dc00..d594340efd 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.cpp @@ -11,9 +11,9 @@ namespace Web::CSS { -ErrorOr> GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement grid_track_placement) +ValueComparingNonnullRefPtr GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement grid_track_placement) { - return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackPlacementStyleValue(grid_track_placement)); + return adopt_ref(*new (nothrow) GridTrackPlacementStyleValue(grid_track_placement)); } ErrorOr GridTrackPlacementStyleValue::to_string() const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h index 47210e92a2..7f69c0553e 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h @@ -16,7 +16,7 @@ namespace Web::CSS { class GridTrackPlacementStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(GridTrackPlacement grid_track_placement); + static ValueComparingNonnullRefPtr create(GridTrackPlacement grid_track_placement); virtual ~GridTrackPlacementStyleValue() override = default; GridTrackPlacement const& grid_track_placement() const { return m_grid_track_placement; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListShorthandStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListShorthandStyleValue.cpp index db83e24c00..c78a2fc68b 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListShorthandStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListShorthandStyleValue.cpp @@ -9,12 +9,12 @@ namespace Web::CSS { -ErrorOr> GridTrackSizeListShorthandStyleValue::create( +ValueComparingNonnullRefPtr GridTrackSizeListShorthandStyleValue::create( ValueComparingNonnullRefPtr areas, ValueComparingNonnullRefPtr rows, ValueComparingNonnullRefPtr columns) { - return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackSizeListShorthandStyleValue(move(areas), move(rows), move(columns))); + return adopt_ref(*new (nothrow) GridTrackSizeListShorthandStyleValue(move(areas), move(rows), move(columns))); } ErrorOr GridTrackSizeListShorthandStyleValue::to_string() const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListShorthandStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListShorthandStyleValue.h index 815fd58e09..b7842187d4 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListShorthandStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListShorthandStyleValue.h @@ -13,7 +13,7 @@ namespace Web::CSS { class GridTrackSizeListShorthandStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create( + static ValueComparingNonnullRefPtr create( ValueComparingNonnullRefPtr areas, ValueComparingNonnullRefPtr rows, ValueComparingNonnullRefPtr columns); diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.cpp index 3a1538cde0..7d73c282f4 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.cpp @@ -16,19 +16,19 @@ ErrorOr GridTrackSizeListStyleValue::to_string() const return m_grid_track_size_list.to_string(); } -ErrorOr> GridTrackSizeListStyleValue::create(CSS::GridTrackSizeList grid_track_size_list) +ValueComparingNonnullRefPtr GridTrackSizeListStyleValue::create(CSS::GridTrackSizeList grid_track_size_list) { - return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackSizeListStyleValue(grid_track_size_list)); + return adopt_ref(*new (nothrow) GridTrackSizeListStyleValue(grid_track_size_list)); } -ErrorOr> GridTrackSizeListStyleValue::make_auto() +ValueComparingNonnullRefPtr GridTrackSizeListStyleValue::make_auto() { - return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackSizeListStyleValue(CSS::GridTrackSizeList())); + return adopt_ref(*new (nothrow) GridTrackSizeListStyleValue(CSS::GridTrackSizeList())); } -ErrorOr> GridTrackSizeListStyleValue::make_none() +ValueComparingNonnullRefPtr GridTrackSizeListStyleValue::make_none() { - return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackSizeListStyleValue(CSS::GridTrackSizeList())); + return adopt_ref(*new (nothrow) GridTrackSizeListStyleValue(CSS::GridTrackSizeList())); } } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.h index bc973db41e..e3f68a4c8e 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.h @@ -16,11 +16,11 @@ namespace Web::CSS { class GridTrackSizeListStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(CSS::GridTrackSizeList grid_track_size_list); + static ValueComparingNonnullRefPtr create(CSS::GridTrackSizeList grid_track_size_list); virtual ~GridTrackSizeListStyleValue() override = default; - static ErrorOr> make_auto(); - static ErrorOr> make_none(); + static ValueComparingNonnullRefPtr make_auto(); + static ValueComparingNonnullRefPtr make_none(); CSS::GridTrackSizeList grid_track_size_list() const { return m_grid_track_size_list; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/IdentifierStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/IdentifierStyleValue.h index a7cc592b59..bcbefdd95e 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/IdentifierStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/IdentifierStyleValue.h @@ -16,9 +16,9 @@ namespace Web::CSS { class IdentifierStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(ValueID id) + static ValueComparingNonnullRefPtr create(ValueID id) { - return adopt_nonnull_ref_or_enomem(new (nothrow) IdentifierStyleValue(id)); + return adopt_ref(*new (nothrow) IdentifierStyleValue(id)); } virtual ~IdentifierStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.h index 300adea755..c50cb26d24 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.h @@ -20,9 +20,9 @@ class ImageStyleValue final : public AbstractImageStyleValue , public Weakable { public: - static ErrorOr> create(AK::URL const& url) + static ValueComparingNonnullRefPtr create(AK::URL const& url) { - return adopt_nonnull_ref_or_enomem(new (nothrow) ImageStyleValue(url)); + return adopt_ref(*new (nothrow) ImageStyleValue(url)); } virtual ~ImageStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/InheritStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/InheritStyleValue.h index 74e5e523c8..4b43408cc0 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/InheritStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/InheritStyleValue.h @@ -12,9 +12,9 @@ namespace Web::CSS { class InheritStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> the() + static ValueComparingNonnullRefPtr the() { - static ValueComparingNonnullRefPtr instance = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) InheritStyleValue)); + static ValueComparingNonnullRefPtr instance = adopt_ref(*new (nothrow) InheritStyleValue); return instance; } virtual ~InheritStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/InitialStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/InitialStyleValue.h index 6457a6ea72..2eb6204f5c 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/InitialStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/InitialStyleValue.h @@ -12,9 +12,9 @@ namespace Web::CSS { class InitialStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> the() + static ValueComparingNonnullRefPtr the() { - static ValueComparingNonnullRefPtr instance = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) InitialStyleValue)); + static ValueComparingNonnullRefPtr instance = adopt_ref(*new (nothrow) InitialStyleValue); return instance; } virtual ~InitialStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/IntegerStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/IntegerStyleValue.h index f47fbe3be0..9ee2af60f6 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/IntegerStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/IntegerStyleValue.h @@ -12,9 +12,9 @@ namespace Web::CSS { class IntegerStyleValue : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(i64 value) + static ValueComparingNonnullRefPtr create(i64 value) { - return adopt_nonnull_ref_or_enomem(new (nothrow) IntegerStyleValue(value)); + return adopt_ref(*new (nothrow) IntegerStyleValue(value)); } i64 integer() const { return m_value; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/LengthStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/LengthStyleValue.cpp index e750edeba5..06a317b66d 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/LengthStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/LengthStyleValue.cpp @@ -11,20 +11,20 @@ namespace Web::CSS { -ErrorOr> LengthStyleValue::create(Length const& length) +ValueComparingNonnullRefPtr LengthStyleValue::create(Length const& length) { VERIFY(!length.is_auto()); if (length.is_px()) { if (length.raw_value() == 0) { - static auto value = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) LengthStyleValue(CSS::Length::make_px(0)))); + static auto value = adopt_ref(*new (nothrow) LengthStyleValue(CSS::Length::make_px(0))); return value; } if (length.raw_value() == 1) { - static auto value = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) LengthStyleValue(CSS::Length::make_px(1)))); + static auto value = adopt_ref(*new (nothrow) LengthStyleValue(CSS::Length::make_px(1))); return value; } } - return adopt_nonnull_ref_or_enomem(new (nothrow) LengthStyleValue(length)); + return adopt_ref(*new (nothrow) LengthStyleValue(length)); } ErrorOr> LengthStyleValue::absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/LengthStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/LengthStyleValue.h index 0c6b8b4f95..b2c615c37e 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/LengthStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/LengthStyleValue.h @@ -15,7 +15,7 @@ namespace Web::CSS { class LengthStyleValue : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(Length const&); + static ValueComparingNonnullRefPtr create(Length const&); virtual ~LengthStyleValue() override = default; Length const& length() const { return m_length; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/LinearGradientStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/LinearGradientStyleValue.h index 4c5e08a565..8b94927a07 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/LinearGradientStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/LinearGradientStyleValue.h @@ -38,10 +38,10 @@ public: WebKit }; - static ErrorOr> create(GradientDirection direction, Vector color_stop_list, GradientType type, GradientRepeating repeating) + static ValueComparingNonnullRefPtr create(GradientDirection direction, Vector color_stop_list, GradientType type, GradientRepeating repeating) { VERIFY(color_stop_list.size() >= 2); - return adopt_nonnull_ref_or_enomem(new (nothrow) LinearGradientStyleValue(direction, move(color_stop_list), type, repeating)); + return adopt_ref(*new (nothrow) LinearGradientStyleValue(direction, move(color_stop_list), type, repeating)); } virtual ErrorOr to_string() const override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ListStyleStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/ListStyleStyleValue.h index a6d6d5dbfd..bf3264a037 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ListStyleStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ListStyleStyleValue.h @@ -15,12 +15,12 @@ namespace Web::CSS { class ListStyleStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create( + static ValueComparingNonnullRefPtr create( ValueComparingNonnullRefPtr position, ValueComparingNonnullRefPtr image, ValueComparingNonnullRefPtr style_type) { - return adopt_nonnull_ref_or_enomem(new (nothrow) ListStyleStyleValue(move(position), move(image), move(style_type))); + return adopt_ref(*new (nothrow) ListStyleStyleValue(move(position), move(image), move(style_type))); } virtual ~ListStyleStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.h index c04c4ff8fc..04c26d568f 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.h @@ -15,9 +15,9 @@ namespace Web::CSS { class NumberStyleValue : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(double value) + static ValueComparingNonnullRefPtr create(double value) { - return adopt_nonnull_ref_or_enomem(new (nothrow) NumberStyleValue(value)); + return adopt_ref(*new (nothrow) NumberStyleValue(value)); } double number() const { return m_value; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/OverflowStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/OverflowStyleValue.h index 9dae744d05..58724c8527 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/OverflowStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/OverflowStyleValue.h @@ -15,9 +15,9 @@ namespace Web::CSS { class OverflowStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(ValueComparingNonnullRefPtr overflow_x, ValueComparingNonnullRefPtr overflow_y) + static ValueComparingNonnullRefPtr create(ValueComparingNonnullRefPtr overflow_x, ValueComparingNonnullRefPtr overflow_y) { - return adopt_nonnull_ref_or_enomem(new (nothrow) OverflowStyleValue(move(overflow_x), move(overflow_y))); + return adopt_ref(*new (nothrow) OverflowStyleValue(move(overflow_x), move(overflow_y))); } virtual ~OverflowStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/PercentageStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/PercentageStyleValue.h index 5ad055a3c5..ca80faed92 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/PercentageStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/PercentageStyleValue.h @@ -16,9 +16,9 @@ namespace Web::CSS { class PercentageStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(Percentage percentage) + static ValueComparingNonnullRefPtr create(Percentage percentage) { - return adopt_nonnull_ref_or_enomem(new (nothrow) PercentageStyleValue(move(percentage))); + return adopt_ref(*new (nothrow) PercentageStyleValue(move(percentage))); } virtual ~PercentageStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/PlaceContentStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/PlaceContentStyleValue.h index 39a0e67466..e7abd42cd2 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/PlaceContentStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/PlaceContentStyleValue.h @@ -12,9 +12,9 @@ namespace Web::CSS { class PlaceContentStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(ValueComparingNonnullRefPtr align_content, ValueComparingNonnullRefPtr justify_content) + static ValueComparingNonnullRefPtr create(ValueComparingNonnullRefPtr align_content, ValueComparingNonnullRefPtr justify_content) { - return adopt_nonnull_ref_or_enomem(new (nothrow) PlaceContentStyleValue(move(align_content), move(justify_content))); + return adopt_ref(*new (nothrow) PlaceContentStyleValue(move(align_content), move(justify_content))); } virtual ~PlaceContentStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/PlaceItemsStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/PlaceItemsStyleValue.h index 1a0e9ac627..f82363056a 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/PlaceItemsStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/PlaceItemsStyleValue.h @@ -12,9 +12,9 @@ namespace Web::CSS { class PlaceItemsStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(ValueComparingNonnullRefPtr align_items, ValueComparingNonnullRefPtr justify_items) + static ValueComparingNonnullRefPtr create(ValueComparingNonnullRefPtr align_items, ValueComparingNonnullRefPtr justify_items) { - return adopt_nonnull_ref_or_enomem(new (nothrow) PlaceItemsStyleValue(move(align_items), move(justify_items))); + return adopt_ref(*new (nothrow) PlaceItemsStyleValue(move(align_items), move(justify_items))); } virtual ~PlaceItemsStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/PlaceSelfStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/PlaceSelfStyleValue.h index 8c0c908b6f..0235245778 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/PlaceSelfStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/PlaceSelfStyleValue.h @@ -12,9 +12,9 @@ namespace Web::CSS { class PlaceSelfStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(ValueComparingNonnullRefPtr align_self, ValueComparingNonnullRefPtr justify_self) + static ValueComparingNonnullRefPtr create(ValueComparingNonnullRefPtr align_self, ValueComparingNonnullRefPtr justify_self) { - return adopt_nonnull_ref_or_enomem(new (nothrow) PlaceSelfStyleValue(move(align_self), move(justify_self))); + return adopt_ref(*new (nothrow) PlaceSelfStyleValue(move(align_self), move(justify_self))); } virtual ~PlaceSelfStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/PositionStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/PositionStyleValue.h index 05bd39f391..0a24f95608 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/PositionStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/PositionStyleValue.h @@ -17,9 +17,9 @@ namespace Web::CSS { class PositionStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(ValueComparingNonnullRefPtr egde_x, ValueComparingNonnullRefPtr edge_y) + static ValueComparingNonnullRefPtr create(ValueComparingNonnullRefPtr egde_x, ValueComparingNonnullRefPtr edge_y) { - return adopt_nonnull_ref_or_enomem(new (nothrow) PositionStyleValue(move(egde_x), move(edge_y))); + return adopt_ref(*new (nothrow) PositionStyleValue(move(egde_x), move(edge_y))); } virtual ~PositionStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/RadialGradientStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/RadialGradientStyleValue.h index 7b1a0d1a54..6cd43946db 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/RadialGradientStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/RadialGradientStyleValue.h @@ -44,10 +44,10 @@ public: using Size = Variant; - static ErrorOr> create(EndingShape ending_shape, Size size, PositionValue position, Vector color_stop_list, GradientRepeating repeating) + static ValueComparingNonnullRefPtr create(EndingShape ending_shape, Size size, PositionValue position, Vector color_stop_list, GradientRepeating repeating) { VERIFY(color_stop_list.size() >= 2); - return adopt_nonnull_ref_or_enomem(new (nothrow) RadialGradientStyleValue(ending_shape, size, position, move(color_stop_list), repeating)); + return adopt_ref(*new (nothrow) RadialGradientStyleValue(ending_shape, size, position, move(color_stop_list), repeating)); } virtual ErrorOr to_string() const override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/RatioStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/RatioStyleValue.h index 99eff85e19..d768ceb8a6 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/RatioStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/RatioStyleValue.h @@ -13,9 +13,9 @@ namespace Web::CSS { class RatioStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(Ratio ratio) + static ValueComparingNonnullRefPtr create(Ratio ratio) { - return adopt_nonnull_ref_or_enomem(new (nothrow) RatioStyleValue(move(ratio))); + return adopt_ref(*new (nothrow) RatioStyleValue(move(ratio))); } virtual ~RatioStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.cpp index d2d88ebb33..66aa3cf8f5 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.cpp @@ -11,9 +11,9 @@ namespace Web::CSS { -ErrorOr> RectStyleValue::create(EdgeRect rect) +ValueComparingNonnullRefPtr RectStyleValue::create(EdgeRect rect) { - return adopt_nonnull_ref_or_enomem(new (nothrow) RectStyleValue(move(rect))); + return adopt_ref(*new (nothrow) RectStyleValue(move(rect))); } ErrorOr RectStyleValue::to_string() const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.h index a04073bade..ff43095752 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.h @@ -16,7 +16,7 @@ namespace Web::CSS { class RectStyleValue : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(EdgeRect rect); + static ValueComparingNonnullRefPtr create(EdgeRect rect); virtual ~RectStyleValue() override = default; EdgeRect rect() const { return m_rect; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ResolutionStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/ResolutionStyleValue.h index 172e67be0f..26377a2aa0 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ResolutionStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ResolutionStyleValue.h @@ -13,9 +13,9 @@ namespace Web::CSS { class ResolutionStyleValue : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(Resolution resolution) + static ValueComparingNonnullRefPtr create(Resolution resolution) { - return adopt_nonnull_ref_or_enomem(new (nothrow) ResolutionStyleValue(move(resolution))); + return adopt_ref(*new (nothrow) ResolutionStyleValue(move(resolution))); } virtual ~ResolutionStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/RevertStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/RevertStyleValue.h index 195fdb3094..f3b6445b04 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/RevertStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/RevertStyleValue.h @@ -12,9 +12,9 @@ namespace Web::CSS { class RevertStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> the() + static ValueComparingNonnullRefPtr the() { - static ValueComparingNonnullRefPtr instance = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) RevertStyleValue)); + static ValueComparingNonnullRefPtr instance = adopt_ref(*new (nothrow) RevertStyleValue); return instance; } virtual ~RevertStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.h index 1c90ba5b98..b7a6a564c9 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.h @@ -22,7 +22,7 @@ enum class ShadowPlacement { class ShadowStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create( + static ValueComparingNonnullRefPtr create( Color color, ValueComparingNonnullRefPtr offset_x, ValueComparingNonnullRefPtr offset_y, @@ -30,7 +30,7 @@ public: ValueComparingNonnullRefPtr spread_distance, ShadowPlacement placement) { - return adopt_nonnull_ref_or_enomem(new (nothrow) ShadowStyleValue(color, move(offset_x), move(offset_y), move(blur_radius), move(spread_distance), placement)); + return adopt_ref(*new (nothrow) ShadowStyleValue(color, move(offset_x), move(offset_y), move(blur_radius), move(spread_distance), placement)); } virtual ~ShadowStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/StringStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/StringStyleValue.h index 13b23b60cd..bffbe1fec9 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/StringStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/StringStyleValue.h @@ -13,9 +13,9 @@ namespace Web::CSS { class StringStyleValue : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(String const& string) + static ValueComparingNonnullRefPtr create(String const& string) { - return adopt_nonnull_ref_or_enomem(new (nothrow) StringStyleValue(string)); + return adopt_ref(*new (nothrow) StringStyleValue(string)); } virtual ~StringStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/StyleValueList.h b/Userland/Libraries/LibWeb/CSS/StyleValues/StyleValueList.h index c2e76a527e..a6392e5f8e 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/StyleValueList.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/StyleValueList.h @@ -19,9 +19,9 @@ public: Space, Comma, }; - static ErrorOr> create(StyleValueVector&& values, Separator separator) + static ValueComparingNonnullRefPtr create(StyleValueVector&& values, Separator separator) { - return adopt_nonnull_ref_or_enomem(new (nothrow) StyleValueList(move(values), separator)); + return adopt_ref(*new (nothrow) StyleValueList(move(values), separator)); } size_t size() const { return m_properties.values.size(); } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/TextDecorationStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/TextDecorationStyleValue.h index 89c31d5296..35a2ab5eac 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/TextDecorationStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/TextDecorationStyleValue.h @@ -15,13 +15,13 @@ namespace Web::CSS { class TextDecorationStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create( + static ValueComparingNonnullRefPtr create( ValueComparingNonnullRefPtr line, ValueComparingNonnullRefPtr thickness, ValueComparingNonnullRefPtr style, ValueComparingNonnullRefPtr color) { - return adopt_nonnull_ref_or_enomem(new (nothrow) TextDecorationStyleValue(move(line), move(thickness), move(style), move(color))); + return adopt_ref(*new (nothrow) TextDecorationStyleValue(move(line), move(thickness), move(style), move(color))); } virtual ~TextDecorationStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/TimeStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/TimeStyleValue.h index fd60795191..e027bd346a 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/TimeStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/TimeStyleValue.h @@ -16,9 +16,9 @@ namespace Web::CSS { class TimeStyleValue : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(Time time) + static ValueComparingNonnullRefPtr create(Time time) { - return adopt_nonnull_ref_or_enomem(new (nothrow) TimeStyleValue(move(time))); + return adopt_ref(*new (nothrow) TimeStyleValue(move(time))); } virtual ~TimeStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/TransformationStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/TransformationStyleValue.h index 68bfbfba37..3ce2ff5a01 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/TransformationStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/TransformationStyleValue.h @@ -16,9 +16,9 @@ namespace Web::CSS { class TransformationStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(CSS::TransformFunction transform_function, StyleValueVector&& values) + static ValueComparingNonnullRefPtr create(CSS::TransformFunction transform_function, StyleValueVector&& values) { - return adopt_nonnull_ref_or_enomem(new (nothrow) TransformationStyleValue(transform_function, move(values))); + return adopt_ref(*new (nothrow) TransformationStyleValue(transform_function, move(values))); } virtual ~TransformationStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/URLStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/URLStyleValue.h index dc25d8a5b8..813ee4415d 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/URLStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/URLStyleValue.h @@ -14,9 +14,9 @@ namespace Web::CSS { class URLStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> create(AK::URL const& url) + static ValueComparingNonnullRefPtr create(AK::URL const& url) { - return adopt_nonnull_ref_or_enomem(new (nothrow) URLStyleValue(url)); + return adopt_ref(*new (nothrow) URLStyleValue(url)); } virtual ~URLStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/UnresolvedStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/UnresolvedStyleValue.h index 03aa437319..4b754e05c7 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/UnresolvedStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/UnresolvedStyleValue.h @@ -17,9 +17,9 @@ namespace Web::CSS { class UnresolvedStyleValue final : public StyleValue { public: - static ErrorOr> create(Vector&& values, bool contains_var_or_attr) + static ValueComparingNonnullRefPtr create(Vector&& values, bool contains_var_or_attr) { - return adopt_nonnull_ref_or_enomem(new (nothrow) UnresolvedStyleValue(move(values), contains_var_or_attr)); + return adopt_ref(*new (nothrow) UnresolvedStyleValue(move(values), contains_var_or_attr)); } virtual ~UnresolvedStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/UnsetStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/UnsetStyleValue.h index 2d527f72ce..4589bd02da 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/UnsetStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/UnsetStyleValue.h @@ -15,9 +15,9 @@ namespace Web::CSS { class UnsetStyleValue final : public StyleValueWithDefaultOperators { public: - static ErrorOr> the() + static ValueComparingNonnullRefPtr the() { - static ValueComparingNonnullRefPtr instance = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) UnsetStyleValue)); + static ValueComparingNonnullRefPtr instance = adopt_ref(*new (nothrow) UnsetStyleValue); return instance; } virtual ~UnsetStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp index d10385ffaf..4e31e98b9d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp @@ -35,12 +35,12 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co // https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value auto color = parse_legacy_color_value(value); if (color.has_value()) - style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors(), nullptr); + style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()), nullptr); } else if (name.equals_ignoring_ascii_case("text"sv)) { // https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value-2 auto color = parse_legacy_color_value(value); if (color.has_value()) - style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors(), nullptr); + style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()), nullptr); } else if (name.equals_ignoring_ascii_case("background"sv)) { VERIFY(m_background_style_value); style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value, nullptr); @@ -67,7 +67,7 @@ void HTMLBodyElement::attribute_changed(DeprecatedFlyString const& name, Depreca if (color.has_value()) document().set_visited_link_color(color.value()); } else if (name.equals_ignoring_ascii_case("background"sv)) { - m_background_style_value = CSS::ImageStyleValue::create(document().parse_url(value)).release_value_but_fixme_should_propagate_errors(); + m_background_style_value = CSS::ImageStyleValue::create(document().parse_url(value)); m_background_style_value->on_animate = [this] { if (layout_node()) { layout_node()->set_needs_display(); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp index 352276bef9..eee88d7693 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp @@ -24,13 +24,13 @@ void HTMLDivElement::apply_presentational_hints(CSS::StyleProperties& style) con for_each_attribute([&](auto& name, auto& value) { if (name.equals_ignoring_ascii_case("align"sv)) { if (value.equals_ignoring_ascii_case("left"sv)) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebLeft).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebLeft)); else if (value.equals_ignoring_ascii_case("right"sv)) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebRight).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebRight)); else if (value.equals_ignoring_ascii_case("center"sv)) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebCenter).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebCenter)); else if (value.equals_ignoring_ascii_case("justify"sv)) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify)); } }); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp index 899e5e5502..a104339c04 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp @@ -32,7 +32,7 @@ void HTMLFontElement::apply_presentational_hints(CSS::StyleProperties& style) co // https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3:rules-for-parsing-a-legacy-colour-value auto color = parse_legacy_color_value(value); if (color.has_value()) - style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value())); } }); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp index 49fed4e4dd..8d6d1ab858 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp @@ -31,13 +31,13 @@ void HTMLHeadingElement::apply_presentational_hints(CSS::StyleProperties& style) for_each_attribute([&](auto& name, auto& value) { if (name.equals_ignoring_ascii_case("align"sv)) { if (value == "left"sv) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Left).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Left)); else if (value == "right"sv) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Right).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Right)); else if (value == "center"sv) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Center).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Center)); else if (value == "justify"sv) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify)); } }); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 8683ccfba0..fe028d0b2c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -80,7 +80,7 @@ JS::GCPtr HTMLInputElement::create_layout_node(NonnullRefPtrdisplay().is_inline_outside() && style->display().is_flow_inside()) - style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::InlineBlock)).release_value_but_fixme_should_propagate_errors()); + style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::InlineBlock))); return Element::create_layout_node_for_display_type(document(), style->display(), style, this); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp index d9afc10eef..73e63b01c7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp @@ -33,7 +33,7 @@ void HTMLMarqueeElement::apply_presentational_hints(CSS::StyleProperties& style) // https://html.spec.whatwg.org/multipage/rendering.html#the-marquee-element-2:rules-for-parsing-a-legacy-colour-value auto color = parse_legacy_color_value(value); if (color.has_value()) - style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value())); } }); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp index 43e68812a1..3b560b656a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp @@ -31,13 +31,13 @@ void HTMLParagraphElement::apply_presentational_hints(CSS::StyleProperties& styl for_each_attribute([&](auto& name, auto& value) { if (name.equals_ignoring_ascii_case("align"sv)) { if (value == "left"sv) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Left).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Left)); else if (value == "right"sv) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Right).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Right)); else if (value == "center"sv) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Center).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Center)); else if (value == "justify"sv) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify)); } }); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp index 2e42cc5dd3..f24a94c110 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp @@ -30,7 +30,7 @@ void HTMLPreElement::apply_presentational_hints(CSS::StyleProperties& style) con for_each_attribute([&](auto const& name, auto const&) { if (name.equals_ignoring_ascii_case(HTML::AttributeNames::wrap)) - style.set_property(CSS::PropertyID::WhiteSpace, CSS::IdentifierStyleValue::create(CSS::ValueID::PreWrap).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::WhiteSpace, CSS::IdentifierStyleValue::create(CSS::ValueID::PreWrap)); }); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp index 7be9125c74..2d9f245abb 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp @@ -31,7 +31,7 @@ void HTMLTableCaptionElement::apply_presentational_hints(CSS::StyleProperties& s for_each_attribute([&](auto& name, auto& value) { if (name.equals_ignoring_ascii_case("align"sv)) { if (value == "bottom"sv) - style.set_property(CSS::PropertyID::CaptionSide, CSS::IdentifierStyleValue::create(CSS::ValueID::Bottom).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::CaptionSide, CSS::IdentifierStyleValue::create(CSS::ValueID::Bottom)); } }); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp index d216ca9840..3538b35bc6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp @@ -36,7 +36,7 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl // https://html.spec.whatwg.org/multipage/rendering.html#tables-2:rules-for-parsing-a-legacy-colour-value auto color = parse_legacy_color_value(value); if (color.has_value()) - style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value())); return; } if (name == HTML::AttributeNames::valign) { @@ -46,7 +46,7 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl } if (name == HTML::AttributeNames::align) { 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).release_value_but_fixme_should_propagate_errors()); + 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()) style.set_property(CSS::PropertyID::TextAlign, parsed_value.release_nonnull()); @@ -63,7 +63,7 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl return; } else if (name == HTML::AttributeNames::background) { if (auto parsed_value = document().parse_url(value); parsed_value.is_valid()) - style.set_property(CSS::PropertyID::BackgroundImage, CSS::ImageStyleValue::create(parsed_value).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::BackgroundImage, CSS::ImageStyleValue::create(parsed_value)); return; } }); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp index 0de18caa38..2db842edb8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp @@ -56,7 +56,7 @@ void HTMLTableElement::apply_presentational_hints(CSS::StyleProperties& style) c // https://html.spec.whatwg.org/multipage/rendering.html#tables-2:rules-for-parsing-a-legacy-colour-value auto color = parse_legacy_color_value(value); if (color.has_value()) - style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value())); return; } if (name == HTML::AttributeNames::cellspacing) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp index 62eb74a53f..729cf2beea 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp @@ -41,11 +41,11 @@ void HTMLTableRowElement::apply_presentational_hints(CSS::StyleProperties& style // https://html.spec.whatwg.org/multipage/rendering.html#tables-2:rules-for-parsing-a-legacy-colour-value auto color = parse_legacy_color_value(value); if (color.has_value()) - style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value())); return; } else if (name == HTML::AttributeNames::background) { if (auto parsed_value = document().parse_url(value); parsed_value.is_valid()) - style.set_property(CSS::PropertyID::BackgroundImage, CSS::ImageStyleValue::create(parsed_value).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::BackgroundImage, CSS::ImageStyleValue::create(parsed_value)); return; } }); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp index 60ae51dc42..711b7cea44 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp @@ -3993,14 +3993,14 @@ static RefPtr 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)).release_value_but_fixme_should_propagate_errors(); + return CSS::LengthStyleValue::create(CSS::Length::make_px(value)); // 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)).release_value_but_fixme_should_propagate_errors(); + return CSS::PercentageStyleValue::create(CSS::Percentage(value)); // 3. Return value as a length. - return CSS::LengthStyleValue::create(CSS::Length::make_px(value)).release_value_but_fixme_should_propagate_errors(); + return CSS::LengthStyleValue::create(CSS::Length::make_px(value)); } // https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-dimension-values @@ -4034,7 +4034,7 @@ RefPtr 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)).release_value_but_fixme_should_propagate_errors(); + return CSS::LengthStyleValue::create(CSS::Length::make_px(*integer_value)); float value = *integer_value; @@ -4065,7 +4065,7 @@ RefPtr 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)).release_value_but_fixme_should_propagate_errors(); + return CSS::LengthStyleValue::create(CSS::Length::make_px(value)); // 5. If the code point at position within input is not an ASCII digit, then break. if (!is_ascii_digit(*position)) diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp index 46ad7633ea..43b707cc4b 100644 --- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -352,11 +352,11 @@ ErrorOr TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder:: auto& progress = static_cast(dom_node); if (!progress.using_system_appearance()) { auto bar_style = TRY(style_computer.compute_style(progress, CSS::Selector::PseudoElement::ProgressBar)); - bar_style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::FlowRoot)).release_value_but_fixme_should_propagate_errors()); + bar_style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::FlowRoot))); auto value_style = TRY(style_computer.compute_style(progress, CSS::Selector::PseudoElement::ProgressValue)); - value_style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Block)).release_value_but_fixme_should_propagate_errors()); + value_style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Block))); auto position = progress.position(); - value_style->set_property(CSS::PropertyID::Width, CSS::PercentageStyleValue::create(CSS::Percentage(position >= 0 ? round_to(100 * position) : 0)).release_value_but_fixme_should_propagate_errors()); + value_style->set_property(CSS::PropertyID::Width, CSS::PercentageStyleValue::create(CSS::Percentage(position >= 0 ? round_to(100 * position) : 0))); auto bar_display = bar_style->display(); auto value_display = value_style->display(); auto progress_bar = DOM::Element::create_layout_node_for_display_type(document, bar_display, bar_style, nullptr); diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index c0667ff52a..cba5f115ef 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -396,7 +396,7 @@ Gfx::FloatMatrix4x4 StackingContext::get_transformation_matrix(CSS::Transformati 0, 0, 0, 1); break; default: - dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Unhandled transformation function {}", MUST(CSS::TransformationStyleValue::create(transformation.function, {}))->to_string()); + dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Unhandled transformation function {}", CSS::TransformationStyleValue::create(transformation.function, {})->to_string()); } return Gfx::FloatMatrix4x4::identity(); } diff --git a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp index 135f3f653c..4534312b3a 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp @@ -49,7 +49,7 @@ void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) cons // If the `width` attribute is an empty string, it defaults to 100%. // This matches WebKit and Blink, but not Firefox. The spec is unclear. // FIXME: Figure out what to do here. - style.set_property(CSS::PropertyID::Width, CSS::PercentageStyleValue::create(CSS::Percentage { 100 }).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::Width, CSS::PercentageStyleValue::create(CSS::Percentage { 100 })); } // Height defaults to 100% @@ -60,7 +60,7 @@ void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) cons // If the `height` attribute is an empty string, it defaults to 100%. // This matches WebKit and Blink, but not Firefox. The spec is unclear. // FIXME: Figure out what to do here. - style.set_property(CSS::PropertyID::Height, CSS::PercentageStyleValue::create(CSS::Percentage { 100 }).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::Height, CSS::PercentageStyleValue::create(CSS::Percentage { 100 })); } } diff --git a/Userland/Libraries/LibWeb/SVG/SVGSymbolElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGSymbolElement.cpp index 9c55b18dae..c7273425eb 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGSymbolElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGSymbolElement.cpp @@ -31,17 +31,17 @@ void SVGSymbolElement::initialize(JS::Realm& realm) void SVGSymbolElement::apply_presentational_hints(CSS::StyleProperties& style) const { // The user agent style sheet sets the overflow property for ‘symbol’ elements to hidden. - auto hidden = CSS::IdentifierStyleValue::create(CSS::ValueID::Hidden).release_value_but_fixme_should_propagate_errors(); - style.set_property(CSS::PropertyID::Overflow, CSS::OverflowStyleValue::create(hidden, hidden).release_value_but_fixme_should_propagate_errors()); + auto hidden = CSS::IdentifierStyleValue::create(CSS::ValueID::Hidden); + style.set_property(CSS::PropertyID::Overflow, CSS::OverflowStyleValue::create(hidden, hidden)); if (is_direct_child_of_use_shadow_tree()) { // The generated instance of a ‘symbol’ that is the direct referenced element of a ‘use’ element must always have a computed value of inline for the display property. - style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Inline)).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Inline))); } else { // FIXME: When we have a DefaultSVG.css then use https://svgwg.org/svg2-draft/styling.html#UAStyleSheet instead. // The user agent must set the display property on the ‘symbol’ element to none, as part of the user agent style sheet, // and this declaration must have importance over any other CSS rule or presentation attribute. - style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::None)).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::None))); } }