diff options
Diffstat (limited to 'Userland/Libraries')
76 files changed, 446 insertions, 416 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 4dceda0c61..10e3ed1bed 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -2369,7 +2369,7 @@ RefPtr<StyleValue> Parser::parse_url_value(ComponentValue const& component_value auto url = parse_url_function(component_value, allowed_data_url_type); if (!url.has_value()) return {}; - return URLStyleValue::create(*url); + return URLStyleValue::create(*url).release_value_but_fixme_should_propagate_errors(); } template<typename TElement> @@ -2621,7 +2621,7 @@ RefPtr<StyleValue> Parser::parse_linear_gradient_function(ComponentValue const& if (!color_stops.has_value()) return {}; - return LinearGradientStyleValue::create(gradient_direction, move(*color_stops), gradient_type, repeating_gradient); + return LinearGradientStyleValue::create(gradient_direction, move(*color_stops), gradient_type, repeating_gradient).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_conic_gradient_function(ComponentValue const& component_value) @@ -2718,7 +2718,7 @@ RefPtr<StyleValue> Parser::parse_conic_gradient_function(ComponentValue const& c if (!color_stops.has_value()) return {}; - return ConicGradientStyleValue::create(from_angle, at_position, move(*color_stops), repeating_gradient); + return ConicGradientStyleValue::create(from_angle, at_position, move(*color_stops), repeating_gradient).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_radial_gradient_function(ComponentValue const& component_value) @@ -2869,7 +2869,7 @@ RefPtr<StyleValue> Parser::parse_radial_gradient_function(ComponentValue const& if (!color_stops.has_value()) return {}; - return RadialGradientStyleValue::create(ending_shape, size, at_position, move(*color_stops), repeating_gradient); + return RadialGradientStyleValue::create(ending_shape, size, at_position, move(*color_stops), repeating_gradient).release_value_but_fixme_should_propagate_errors(); } Optional<PositionValue> Parser::parse_position(TokenStream<ComponentValue>& tokens, PositionValue initial_value) @@ -3269,11 +3269,11 @@ RefPtr<StyleValue> Parser::parse_builtin_value(ComponentValue const& component_v if (component_value.is(Token::Type::Ident)) { auto ident = component_value.token().ident(); if (ident.equals_ignoring_ascii_case("inherit"sv)) - return InheritStyleValue::the(); + return InheritStyleValue::the().release_value_but_fixme_should_propagate_errors(); if (ident.equals_ignoring_ascii_case("initial"sv)) - return InitialStyleValue::the(); + return InitialStyleValue::the().release_value_but_fixme_should_propagate_errors(); if (ident.equals_ignoring_ascii_case("unset"sv)) - return UnsetStyleValue::the(); + return UnsetStyleValue::the().release_value_but_fixme_should_propagate_errors(); // FIXME: Implement `revert` and `revert-layer` keywords, from Cascade4 and Cascade5 respectively } @@ -3323,7 +3323,7 @@ RefPtr<CalculatedStyleValue> Parser::parse_calculated_value(Vector<ComponentValu }; dbgln_if(CSS_PARSER_DEBUG, "Deduced calc() resolved type as: {}", to_string(calc_type.value())); - return CalculatedStyleValue::create(calculation_tree.release_nonnull(), calc_type.release_value()); + return CalculatedStyleValue::create(calculation_tree.release_nonnull(), calc_type.release_value()).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_dynamic_value(ComponentValue const& component_value) @@ -3690,17 +3690,17 @@ RefPtr<StyleValue> Parser::parse_dimension_value(ComponentValue const& component return {}; if (dimension->is_angle()) - return AngleStyleValue::create(dimension->angle()); + return AngleStyleValue::create(dimension->angle()).release_value_but_fixme_should_propagate_errors(); if (dimension->is_frequency()) - return FrequencyStyleValue::create(dimension->frequency()); + return FrequencyStyleValue::create(dimension->frequency()).release_value_but_fixme_should_propagate_errors(); if (dimension->is_length()) - return LengthStyleValue::create(dimension->length()); + return LengthStyleValue::create(dimension->length()).release_value_but_fixme_should_propagate_errors(); if (dimension->is_percentage()) - return PercentageStyleValue::create(dimension->percentage()); + return PercentageStyleValue::create(dimension->percentage()).release_value_but_fixme_should_propagate_errors(); if (dimension->is_resolution()) - return ResolutionStyleValue::create(dimension->resolution()); + return ResolutionStyleValue::create(dimension->resolution()).release_value_but_fixme_should_propagate_errors(); if (dimension->is_time()) - return TimeStyleValue::create(dimension->time()); + return TimeStyleValue::create(dimension->time()).release_value_but_fixme_should_propagate_errors(); VERIFY_NOT_REACHED(); } @@ -3709,8 +3709,8 @@ RefPtr<StyleValue> Parser::parse_numeric_value(ComponentValue const& component_v if (component_value.is(Token::Type::Number)) { auto const& number = component_value.token(); if (number.number().is_integer()) - return NumericStyleValue::create_integer(number.to_integer()); - return NumericStyleValue::create_float(number.number_value()); + return NumericStyleValue::create_integer(number.to_integer()).release_value_but_fixme_should_propagate_errors(); + return NumericStyleValue::create_float(number.number_value()).release_value_but_fixme_should_propagate_errors(); } return {}; @@ -3721,7 +3721,7 @@ RefPtr<StyleValue> Parser::parse_identifier_value(ComponentValue const& componen if (component_value.is(Token::Type::Ident)) { auto value_id = value_id_from_string(component_value.token().ident()); if (value_id != ValueID::Invalid) - return IdentifierStyleValue::create(value_id); + return IdentifierStyleValue::create(value_id).release_value_but_fixme_should_propagate_errors(); } return {}; @@ -3934,7 +3934,7 @@ RefPtr<StyleValue> Parser::parse_rect_value(ComponentValue const& component_valu } } - return RectStyleValue::create(EdgeRect { params[0], params[1], params[2], params[3] }); + return RectStyleValue::create(EdgeRect { params[0], params[1], params[2], params[3] }).release_value_but_fixme_should_propagate_errors(); } Optional<Color> Parser::parse_color(ComponentValue const& component_value) @@ -4027,7 +4027,7 @@ RefPtr<StyleValue> Parser::parse_color_value(ComponentValue const& component_val { auto color = parse_color(component_value); if (color.has_value()) - return ColorStyleValue::create(color.value()); + return ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors(); return {}; } @@ -4035,7 +4035,7 @@ RefPtr<StyleValue> Parser::parse_color_value(ComponentValue const& component_val RefPtr<StyleValue> Parser::parse_string_value(ComponentValue const& component_value) { if (component_value.is(Token::Type::String)) - return StringStyleValue::create(String::from_utf8(component_value.token().string()).release_value_but_fixme_should_propagate_errors()); + return StringStyleValue::create(String::from_utf8(component_value.token().string()).release_value_but_fixme_should_propagate_errors()).release_value_but_fixme_should_propagate_errors(); return {}; } @@ -4044,7 +4044,7 @@ RefPtr<StyleValue> Parser::parse_image_value(ComponentValue const& component_val { auto url = parse_url_function(component_value, AllowedDataUrlType::Image); if (url.has_value()) - return ImageStyleValue::create(url.value()); + return ImageStyleValue::create(url.value()).release_value_but_fixme_should_propagate_errors(); auto linear_gradient = parse_linear_gradient_function(component_value); if (linear_gradient) return linear_gradient; @@ -4076,7 +4076,7 @@ RefPtr<StyleValue> Parser::parse_comma_separated_value_list(Vector<ComponentValu return {}; } - return StyleValueList::create(move(values), StyleValueList::Separator::Comma); + return StyleValueList::create(move(values), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_simple_comma_separated_value_list(Vector<ComponentValue> const& component_values) @@ -4247,13 +4247,14 @@ RefPtr<StyleValue> Parser::parse_background_value(Vector<ComponentValue> const& background_color = property_initial_value(m_context.realm(), PropertyID::BackgroundColor); return BackgroundStyleValue::create( background_color.release_nonnull(), - StyleValueList::create(move(background_images), StyleValueList::Separator::Comma), - StyleValueList::create(move(background_positions), StyleValueList::Separator::Comma), - StyleValueList::create(move(background_sizes), StyleValueList::Separator::Comma), - StyleValueList::create(move(background_repeats), StyleValueList::Separator::Comma), - StyleValueList::create(move(background_attachments), StyleValueList::Separator::Comma), - StyleValueList::create(move(background_origins), StyleValueList::Separator::Comma), - StyleValueList::create(move(background_clips), StyleValueList::Separator::Comma)); + StyleValueList::create(move(background_images), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors(), + StyleValueList::create(move(background_positions), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors(), + StyleValueList::create(move(background_sizes), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors(), + StyleValueList::create(move(background_repeats), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors(), + StyleValueList::create(move(background_attachments), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors(), + StyleValueList::create(move(background_origins), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors(), + StyleValueList::create(move(background_clips), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors()) + .release_value_but_fixme_should_propagate_errors(); } if (!background_color) @@ -4284,7 +4285,8 @@ RefPtr<StyleValue> Parser::parse_background_value(Vector<ComponentValue> const& background_repeat.release_nonnull(), background_attachment.release_nonnull(), background_origin.release_nonnull(), - background_clip.release_nonnull()); + background_clip.release_nonnull()) + .release_value_but_fixme_should_propagate_errors(); } static Optional<PositionEdge> identifier_to_edge(ValueID identifier) @@ -4456,8 +4458,9 @@ RefPtr<StyleValue> Parser::parse_single_background_position_value(TokenStream<Co transaction.commit(); return PositionStyleValue::create( - EdgeStyleValue::create(horizontal->edge, horizontal->offset), - EdgeStyleValue::create(vertical->edge, vertical->offset)); + EdgeStyleValue::create(horizontal->edge, horizontal->offset).release_value_but_fixme_should_propagate_errors(), + EdgeStyleValue::create(vertical->edge, vertical->offset).release_value_but_fixme_should_propagate_errors()) + .release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_single_background_position_x_or_y_value(TokenStream<ComponentValue>& tokens, PropertyID property) @@ -4489,7 +4492,7 @@ RefPtr<StyleValue> Parser::parse_single_background_position_x_or_y_value(TokenSt auto identifier = value->to_identifier(); if (identifier == ValueID::Center) { transaction.commit(); - return EdgeStyleValue::create(relative_edge, Percentage { 50 }); + return EdgeStyleValue::create(relative_edge, Percentage { 50 }).release_value_but_fixme_should_propagate_errors(); } if (auto edge = identifier_to_edge(identifier); edge.has_value()) { relative_edge = *edge; @@ -4500,7 +4503,7 @@ RefPtr<StyleValue> Parser::parse_single_background_position_x_or_y_value(TokenSt value = parse_value(tokens.peek_token()); if (!value) { transaction.commit(); - return EdgeStyleValue::create(relative_edge, Length::make_px(0)); + return EdgeStyleValue::create(relative_edge, Length::make_px(0)).release_value_but_fixme_should_propagate_errors(); } tokens.next_token(); } @@ -4509,7 +4512,7 @@ RefPtr<StyleValue> Parser::parse_single_background_position_x_or_y_value(TokenSt auto offset = style_value_to_length_percentage(value); if (offset.has_value()) { transaction.commit(); - return EdgeStyleValue::create(relative_edge, *offset); + return EdgeStyleValue::create(relative_edge, *offset).release_value_but_fixme_should_propagate_errors(); } return {}; @@ -4550,7 +4553,8 @@ RefPtr<StyleValue> Parser::parse_single_background_repeat_value(TokenStream<Comp transaction.commit(); return BackgroundRepeatStyleValue::create( value_id == ValueID::RepeatX ? Repeat::Repeat : Repeat::NoRepeat, - value_id == ValueID::RepeatX ? Repeat::NoRepeat : Repeat::Repeat); + value_id == ValueID::RepeatX ? Repeat::NoRepeat : Repeat::Repeat) + .release_value_but_fixme_should_propagate_errors(); } auto x_repeat = as_repeat(x_value->to_identifier()); @@ -4563,7 +4567,7 @@ RefPtr<StyleValue> Parser::parse_single_background_repeat_value(TokenStream<Comp if (!maybe_y_value || !property_accepts_value(PropertyID::BackgroundRepeat, *maybe_y_value)) { // We don't have a second value, so use x for both transaction.commit(); - return BackgroundRepeatStyleValue::create(x_repeat.value(), x_repeat.value()); + return BackgroundRepeatStyleValue::create(x_repeat.value(), x_repeat.value()).release_value_but_fixme_should_propagate_errors(); } tokens.next_token(); auto y_value = maybe_y_value.release_nonnull(); @@ -4575,7 +4579,7 @@ RefPtr<StyleValue> Parser::parse_single_background_repeat_value(TokenStream<Comp return nullptr; transaction.commit(); - return BackgroundRepeatStyleValue::create(x_repeat.value(), y_repeat.value()); + return BackgroundRepeatStyleValue::create(x_repeat.value(), y_repeat.value()).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_single_background_size_value(TokenStream<ComponentValue>& tokens) @@ -4609,7 +4613,7 @@ RefPtr<StyleValue> Parser::parse_single_background_size_value(TokenStream<Compon return nullptr; transaction.commit(); - return BackgroundSizeStyleValue::create(x_size.value(), x_size.value()); + return BackgroundSizeStyleValue::create(x_size.value(), x_size.value()).release_value_but_fixme_should_propagate_errors(); } tokens.next_token(); @@ -4621,7 +4625,7 @@ RefPtr<StyleValue> Parser::parse_single_background_size_value(TokenStream<Compon return nullptr; transaction.commit(); - return BackgroundSizeStyleValue::create(x_size.release_value(), y_size.release_value()); + return BackgroundSizeStyleValue::create(x_size.release_value(), y_size.release_value()).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_border_value(Vector<ComponentValue> const& component_values) @@ -4667,7 +4671,7 @@ RefPtr<StyleValue> Parser::parse_border_value(Vector<ComponentValue> const& comp if (!border_color) border_color = property_initial_value(m_context.realm(), PropertyID::BorderColor); - return BorderStyleValue::create(border_width.release_nonnull(), border_style.release_nonnull(), border_color.release_nonnull()); + return BorderStyleValue::create(border_width.release_nonnull(), border_style.release_nonnull(), border_color.release_nonnull()).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_border_radius_value(Vector<ComponentValue> const& component_values) @@ -4676,7 +4680,7 @@ RefPtr<StyleValue> Parser::parse_border_radius_value(Vector<ComponentValue> cons auto horizontal = parse_dimension(component_values[0]); auto vertical = parse_dimension(component_values[1]); if (horizontal.has_value() && horizontal->is_length_percentage() && vertical.has_value() && vertical->is_length_percentage()) - return BorderRadiusStyleValue::create(horizontal->length_percentage(), vertical->length_percentage()); + return BorderRadiusStyleValue::create(horizontal->length_percentage(), vertical->length_percentage()).release_value_but_fixme_should_propagate_errors(); return nullptr; } @@ -4684,7 +4688,7 @@ RefPtr<StyleValue> Parser::parse_border_radius_value(Vector<ComponentValue> cons if (component_values.size() == 1) { auto radius = parse_dimension(component_values[0]); if (radius.has_value() && radius->is_length_percentage()) - return BorderRadiusStyleValue::create(radius->length_percentage(), radius->length_percentage()); + return BorderRadiusStyleValue::create(radius->length_percentage(), radius->length_percentage()).release_value_but_fixme_should_propagate_errors(); return nullptr; } @@ -4761,15 +4765,19 @@ RefPtr<StyleValue> Parser::parse_border_radius_shorthand_value(Vector<ComponentV return nullptr; auto top_left_radius = BorderRadiusStyleValue::create(top_left(horizontal_radii), - vertical_radii.is_empty() ? top_left(horizontal_radii) : top_left(vertical_radii)); + vertical_radii.is_empty() ? top_left(horizontal_radii) : top_left(vertical_radii)) + .release_value_but_fixme_should_propagate_errors(); auto top_right_radius = BorderRadiusStyleValue::create(top_right(horizontal_radii), - vertical_radii.is_empty() ? top_right(horizontal_radii) : top_right(vertical_radii)); + vertical_radii.is_empty() ? top_right(horizontal_radii) : top_right(vertical_radii)) + .release_value_but_fixme_should_propagate_errors(); auto bottom_right_radius = BorderRadiusStyleValue::create(bottom_right(horizontal_radii), - vertical_radii.is_empty() ? bottom_right(horizontal_radii) : bottom_right(vertical_radii)); + vertical_radii.is_empty() ? bottom_right(horizontal_radii) : bottom_right(vertical_radii)) + .release_value_but_fixme_should_propagate_errors(); auto bottom_left_radius = BorderRadiusStyleValue::create(bottom_left(horizontal_radii), - vertical_radii.is_empty() ? bottom_left(horizontal_radii) : bottom_left(vertical_radii)); + vertical_radii.is_empty() ? bottom_left(horizontal_radii) : bottom_left(vertical_radii)) + .release_value_but_fixme_should_propagate_errors(); - return BorderRadiusShorthandStyleValue::create(move(top_left_radius), move(top_right_radius), move(bottom_right_radius), move(bottom_left_radius)); + return BorderRadiusShorthandStyleValue::create(move(top_left_radius), move(top_right_radius), move(bottom_right_radius), move(bottom_left_radius)).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_shadow_value(Vector<ComponentValue> const& component_values, AllowInsetKeyword allow_inset_keyword) @@ -4879,7 +4887,7 @@ RefPtr<StyleValue> Parser::parse_single_shadow_value(TokenStream<ComponentValue> placement = ShadowPlacement::Outer; transaction.commit(); - return ShadowStyleValue::create(color.release_value(), offset_x.release_value(), offset_y.release_value(), blur_radius.release_value(), spread_distance.release_value(), placement.release_value()); + return ShadowStyleValue::create(color.release_value(), offset_x.release_value(), offset_y.release_value(), blur_radius.release_value(), spread_distance.release_value(), placement.release_value()).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_content_value(Vector<ComponentValue> const& component_values) @@ -4937,9 +4945,9 @@ RefPtr<StyleValue> Parser::parse_content_value(Vector<ComponentValue> const& com RefPtr<StyleValueList> alt_text; if (!alt_text_values.is_empty()) - alt_text = StyleValueList::create(move(alt_text_values), StyleValueList::Separator::Space); + alt_text = StyleValueList::create(move(alt_text_values), StyleValueList::Separator::Space).release_value_but_fixme_should_propagate_errors(); - return ContentStyleValue::create(StyleValueList::create(move(content_values), StyleValueList::Separator::Space), move(alt_text)); + return ContentStyleValue::create(StyleValueList::create(move(content_values), StyleValueList::Separator::Space).release_value_but_fixme_should_propagate_errors(), move(alt_text)).release_value_but_fixme_should_propagate_errors(); } // https://www.w3.org/TR/css-display-3/#the-display-properties @@ -5095,7 +5103,7 @@ RefPtr<StyleValue> Parser::parse_display_value(Vector<ComponentValue> const& com display = parse_multi_component_display(component_values); if (display.has_value()) - return DisplayStyleValue::create(display.value()); + return DisplayStyleValue::create(display.value()).release_value_but_fixme_should_propagate_errors(); return {}; } @@ -5279,7 +5287,7 @@ RefPtr<StyleValue> Parser::parse_filter_value_list_value(Vector<ComponentValue> if (filter_value_list.is_empty()) return {}; - return FilterValueListStyleValue::create(move(filter_value_list)); + return FilterValueListStyleValue::create(move(filter_value_list)).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_flex_value(Vector<ComponentValue> const& component_values) @@ -5293,21 +5301,21 @@ RefPtr<StyleValue> Parser::parse_flex_value(Vector<ComponentValue> const& compon if (property_accepts_value(PropertyID::FlexGrow, *value)) { // 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 zero_percent = NumericStyleValue::create_integer(0); - auto one = NumericStyleValue::create_integer(1); - return FlexStyleValue::create(*value, one, zero_percent); + auto zero_percent = NumericStyleValue::create_integer(0).release_value_but_fixme_should_propagate_errors(); + auto one = NumericStyleValue::create_integer(1).release_value_but_fixme_should_propagate_errors(); + return FlexStyleValue::create(*value, one, zero_percent).release_value_but_fixme_should_propagate_errors(); } if (property_accepts_value(PropertyID::FlexBasis, *value)) { - auto one = NumericStyleValue::create_integer(1); - return FlexStyleValue::create(one, one, *value); + auto one = NumericStyleValue::create_integer(1).release_value_but_fixme_should_propagate_errors(); + return FlexStyleValue::create(one, one, *value).release_value_but_fixme_should_propagate_errors(); } if (value->is_identifier() && property_accepts_value(PropertyID::Flex, *value)) { switch (value->to_identifier()) { case ValueID::None: { - auto zero = NumericStyleValue::create_integer(0); - return FlexStyleValue::create(zero, zero, IdentifierStyleValue::create(ValueID::Auto)); + auto zero = NumericStyleValue::create_integer(0).release_value_but_fixme_should_propagate_errors(); + return FlexStyleValue::create(zero, zero, IdentifierStyleValue::create(ValueID::Auto).release_value_but_fixme_should_propagate_errors()).release_value_but_fixme_should_propagate_errors(); } default: return value; @@ -5329,7 +5337,7 @@ RefPtr<StyleValue> Parser::parse_flex_value(Vector<ComponentValue> const& compon // Zero is a valid value for basis, but only if grow and shrink are already specified. if (value->has_number() && value->to_number() == 0) { if (flex_grow && flex_shrink && !flex_basis) { - flex_basis = LengthStyleValue::create(Length::make_px(0)); + flex_basis = LengthStyleValue::create(Length::make_px(0)).release_value_but_fixme_should_propagate_errors(); continue; } } @@ -5367,7 +5375,7 @@ RefPtr<StyleValue> Parser::parse_flex_value(Vector<ComponentValue> const& compon if (!flex_basis) flex_basis = property_initial_value(m_context.realm(), PropertyID::FlexBasis); - return FlexStyleValue::create(flex_grow.release_nonnull(), flex_shrink.release_nonnull(), flex_basis.release_nonnull()); + return FlexStyleValue::create(flex_grow.release_nonnull(), flex_shrink.release_nonnull(), flex_basis.release_nonnull()).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_flex_flow_value(Vector<ComponentValue> const& component_values) @@ -5401,7 +5409,7 @@ RefPtr<StyleValue> Parser::parse_flex_flow_value(Vector<ComponentValue> const& c if (!flex_wrap) flex_wrap = property_initial_value(m_context.realm(), PropertyID::FlexWrap); - return FlexFlowStyleValue::create(flex_direction.release_nonnull(), flex_wrap.release_nonnull()); + return FlexFlowStyleValue::create(flex_direction.release_nonnull(), flex_wrap.release_nonnull()).release_value_but_fixme_should_propagate_errors(); } static bool is_generic_font_family(ValueID identifier) @@ -5518,7 +5526,7 @@ RefPtr<StyleValue> Parser::parse_font_value(Vector<ComponentValue> const& compon if (!line_height) line_height = property_initial_value(m_context.realm(), PropertyID::LineHeight); - return FontStyleValue::create(font_stretch.release_nonnull(), font_style.release_nonnull(), font_weight.release_nonnull(), font_size.release_nonnull(), line_height.release_nonnull(), font_families.release_nonnull()); + return FontStyleValue::create(font_stretch.release_nonnull(), font_style.release_nonnull(), font_weight.release_nonnull(), font_size.release_nonnull(), line_height.release_nonnull(), font_families.release_nonnull()).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_font_family_value(Vector<ComponentValue> const& component_values, size_t start_index) @@ -5547,7 +5555,7 @@ RefPtr<StyleValue> Parser::parse_font_family_value(Vector<ComponentValue> const& return nullptr; if (!is_comma_or_eof(i + 1)) return nullptr; - font_families.append(StringStyleValue::create(String::from_utf8(part.token().string()).release_value_but_fixme_should_propagate_errors())); + font_families.append(StringStyleValue::create(String::from_utf8(part.token().string()).release_value_but_fixme_should_propagate_errors()).release_value_but_fixme_should_propagate_errors()); i++; continue; } @@ -5575,7 +5583,7 @@ RefPtr<StyleValue> Parser::parse_font_family_value(Vector<ComponentValue> const& if (part.is(Token::Type::Comma)) { if (current_name_parts.is_empty()) return nullptr; - font_families.append(StringStyleValue::create(String::from_utf8(DeprecatedString::join(' ', current_name_parts)).release_value_but_fixme_should_propagate_errors())); + font_families.append(StringStyleValue::create(String::from_utf8(DeprecatedString::join(' ', current_name_parts)).release_value_but_fixme_should_propagate_errors()).release_value_but_fixme_should_propagate_errors()); current_name_parts.clear(); // Can't have a trailing comma if (i + 1 == component_values.size()) @@ -5585,13 +5593,13 @@ RefPtr<StyleValue> Parser::parse_font_family_value(Vector<ComponentValue> const& } if (!current_name_parts.is_empty()) { - font_families.append(StringStyleValue::create(String::from_utf8(DeprecatedString::join(' ', current_name_parts)).release_value_but_fixme_should_propagate_errors())); + font_families.append(StringStyleValue::create(String::from_utf8(DeprecatedString::join(' ', current_name_parts)).release_value_but_fixme_should_propagate_errors()).release_value_but_fixme_should_propagate_errors()); current_name_parts.clear(); } if (font_families.is_empty()) return nullptr; - return StyleValueList::create(move(font_families), StyleValueList::Separator::Comma); + return StyleValueList::create(move(font_families), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors(); } CSSRule* Parser::parse_font_face_rule(TokenStream<ComponentValue>& tokens) @@ -5829,14 +5837,14 @@ RefPtr<StyleValue> Parser::parse_list_style_value(Vector<ComponentValue> const& if (found_nones == 2) { if (list_image || list_type) return nullptr; - auto none = IdentifierStyleValue::create(ValueID::None); + auto none = IdentifierStyleValue::create(ValueID::None).release_value_but_fixme_should_propagate_errors(); list_image = none; list_type = none; } else if (found_nones == 1) { if (list_image && list_type) return nullptr; - auto none = IdentifierStyleValue::create(ValueID::None); + auto none = IdentifierStyleValue::create(ValueID::None).release_value_but_fixme_should_propagate_errors(); if (!list_image) list_image = none; if (!list_type) @@ -5850,7 +5858,7 @@ RefPtr<StyleValue> Parser::parse_list_style_value(Vector<ComponentValue> const& if (!list_type) list_type = property_initial_value(m_context.realm(), PropertyID::ListStyleType); - return ListStyleStyleValue::create(list_position.release_nonnull(), list_image.release_nonnull(), list_type.release_nonnull()); + return ListStyleStyleValue::create(list_position.release_nonnull(), list_image.release_nonnull(), list_type.release_nonnull()).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_overflow_value(Vector<ComponentValue> const& component_values) @@ -5861,7 +5869,7 @@ RefPtr<StyleValue> Parser::parse_overflow_value(Vector<ComponentValue> const& co return nullptr; auto value = maybe_value.release_nonnull(); if (property_accepts_value(PropertyID::Overflow, *value)) - return OverflowStyleValue::create(value, value); + return OverflowStyleValue::create(value, value).release_value_but_fixme_should_propagate_errors(); return nullptr; } @@ -5876,7 +5884,7 @@ RefPtr<StyleValue> Parser::parse_overflow_value(Vector<ComponentValue> const& co if (!property_accepts_value(PropertyID::OverflowX, x_value) || !property_accepts_value(PropertyID::OverflowY, y_value)) { return nullptr; } - return OverflowStyleValue::create(x_value, y_value); + return OverflowStyleValue::create(x_value, y_value).release_value_but_fixme_should_propagate_errors(); } return nullptr; @@ -5938,7 +5946,7 @@ RefPtr<StyleValue> Parser::parse_text_decoration_value(Vector<ComponentValue> co if (!decoration_color) decoration_color = property_initial_value(m_context.realm(), PropertyID::TextDecorationColor); - return TextDecorationStyleValue::create(decoration_line.release_nonnull(), decoration_thickness.release_nonnull(), decoration_style.release_nonnull(), decoration_color.release_nonnull()); + return TextDecorationStyleValue::create(decoration_line.release_nonnull(), decoration_thickness.release_nonnull(), decoration_style.release_nonnull(), decoration_color.release_nonnull()).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_text_decoration_line_value(TokenStream<ComponentValue>& tokens) @@ -5977,7 +5985,7 @@ RefPtr<StyleValue> Parser::parse_text_decoration_line_value(TokenStream<Componen if (style_values.is_empty()) return nullptr; - return StyleValueList::create(move(style_values), StyleValueList::Separator::Space); + return StyleValueList::create(move(style_values), StyleValueList::Separator::Space).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_transform_value(Vector<ComponentValue> const& component_values) @@ -5996,7 +6004,7 @@ RefPtr<StyleValue> Parser::parse_transform_value(Vector<ComponentValue> const& c tokens.skip_whitespace(); if (tokens.has_next_token()) return nullptr; - return IdentifierStyleValue::create(ValueID::None); + return IdentifierStyleValue::create(ValueID::None).release_value_but_fixme_should_propagate_errors(); } if (!part.is_function()) @@ -6033,7 +6041,7 @@ RefPtr<StyleValue> Parser::parse_transform_value(Vector<ComponentValue> const& c 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(AngleStyleValue::create(Angle::make_degrees(0))); + values.append(AngleStyleValue::create(Angle::make_degrees(0)).release_value_but_fixme_should_propagate_errors()); } else { auto dimension_value = parse_dimension_value(value); if (!dimension_value || !dimension_value->is_angle()) @@ -6105,9 +6113,9 @@ RefPtr<StyleValue> Parser::parse_transform_value(Vector<ComponentValue> const& c return nullptr; } - transformations.append(TransformationStyleValue::create(function, move(values))); + transformations.append(TransformationStyleValue::create(function, move(values)).release_value_but_fixme_should_propagate_errors()); } - return StyleValueList::create(move(transformations), StyleValueList::Separator::Space); + return StyleValueList::create(move(transformations), StyleValueList::Separator::Space).release_value_but_fixme_should_propagate_errors(); } // https://www.w3.org/TR/css-transforms-1/#propdef-transform-origin @@ -6131,19 +6139,19 @@ RefPtr<StyleValue> Parser::parse_transform_origin_value(Vector<ComponentValue> c if (value->is_length()) return AxisOffset { Axis::None, value->as_length() }; if (value->has_length()) - return AxisOffset { Axis::None, LengthStyleValue::create(value->to_length()) }; + return AxisOffset { Axis::None, LengthStyleValue::create(value->to_length()).release_value_but_fixme_should_propagate_errors() }; if (value->is_identifier()) { switch (value->to_identifier()) { case ValueID::Top: - return AxisOffset { Axis::Y, PercentageStyleValue::create(Percentage(0)) }; + return AxisOffset { Axis::Y, PercentageStyleValue::create(Percentage(0)).release_value_but_fixme_should_propagate_errors() }; case ValueID::Left: - return AxisOffset { Axis::X, PercentageStyleValue::create(Percentage(0)) }; + return AxisOffset { Axis::X, PercentageStyleValue::create(Percentage(0)).release_value_but_fixme_should_propagate_errors() }; case ValueID::Center: - return AxisOffset { Axis::None, PercentageStyleValue::create(Percentage(50)) }; + return AxisOffset { Axis::None, PercentageStyleValue::create(Percentage(50)).release_value_but_fixme_should_propagate_errors() }; case ValueID::Bottom: - return AxisOffset { Axis::Y, PercentageStyleValue::create(Percentage(100)) }; + return AxisOffset { Axis::Y, PercentageStyleValue::create(Percentage(100)).release_value_but_fixme_should_propagate_errors() }; case ValueID::Right: - return AxisOffset { Axis::X, PercentageStyleValue::create(Percentage(100)) }; + return AxisOffset { Axis::X, PercentageStyleValue::create(Percentage(100)).release_value_but_fixme_should_propagate_errors() }; default: return {}; } @@ -6155,7 +6163,7 @@ RefPtr<StyleValue> Parser::parse_transform_origin_value(Vector<ComponentValue> c StyleValueVector values; values.append(x_value); values.append(y_value); - return StyleValueList::create(move(values), StyleValueList::Separator::Space); + return StyleValueList::create(move(values), StyleValueList::Separator::Space).release_value_but_fixme_should_propagate_errors(); }; switch (component_values.size()) { @@ -6168,9 +6176,9 @@ RefPtr<StyleValue> Parser::parse_transform_origin_value(Vector<ComponentValue> c switch (single_value->axis) { case Axis::None: case Axis::X: - return make_list(single_value->offset, PercentageStyleValue::create(Percentage(50))); + return make_list(single_value->offset, PercentageStyleValue::create(Percentage(50)).release_value_but_fixme_should_propagate_errors()); case Axis::Y: - return make_list(PercentageStyleValue::create(Percentage(50)), single_value->offset); + return make_list(PercentageStyleValue::create(Percentage(50)).release_value_but_fixme_should_propagate_errors(), single_value->offset); } VERIFY_NOT_REACHED(); } @@ -6439,11 +6447,11 @@ RefPtr<StyleValue> Parser::parse_grid_track_size_list(Vector<ComponentValue> con auto token = tokens.next_token(); if (token.is_block()) { if (last_object_was_line_names && !allow_separate_line_name_blocks) - return GridTrackSizeListStyleValue::make_auto(); + return GridTrackSizeListStyleValue::make_auto().release_value_but_fixme_should_propagate_errors(); last_object_was_line_names = true; Vector<String> line_names; if (!token.block().is_square()) - return GridTrackSizeListStyleValue::make_auto(); + return GridTrackSizeListStyleValue::make_auto().release_value_but_fixme_should_propagate_errors(); TokenStream block_tokens { token.block().values() }; while (block_tokens.has_next_token()) { auto current_block_token = block_tokens.next_token(); @@ -6458,7 +6466,7 @@ RefPtr<StyleValue> Parser::parse_grid_track_size_list(Vector<ComponentValue> con last_object_was_line_names = false; auto track_sizing_function = parse_track_sizing_function(token); if (!track_sizing_function.has_value()) - return GridTrackSizeListStyleValue::make_auto(); + return GridTrackSizeListStyleValue::make_auto().release_value_but_fixme_should_propagate_errors(); // FIXME: Handle multiple repeat values (should combine them here, or remove // any other ones if the first one is auto-fill, etc.) track_list.append(track_sizing_function.value()); @@ -6466,7 +6474,7 @@ RefPtr<StyleValue> Parser::parse_grid_track_size_list(Vector<ComponentValue> con } while (line_names_list.size() <= track_list.size()) line_names_list.append({}); - return GridTrackSizeListStyleValue::create(CSS::GridTrackSizeList(track_list, line_names_list)); + return GridTrackSizeListStyleValue::create(CSS::GridTrackSizeList(track_list, line_names_list)).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_grid_track_placement(Vector<ComponentValue> const& component_values) @@ -6507,15 +6515,15 @@ RefPtr<StyleValue> Parser::parse_grid_track_placement(Vector<ComponentValue> con if (!tokens.has_next_token()) { if (is_auto(current_token)) - return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement()); + return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement()).release_value_but_fixme_should_propagate_errors(); if (is_span(current_token)) - return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement(1, true)); + return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement(1, true)).release_value_but_fixme_should_propagate_errors(); if (is_valid_integer(current_token)) - return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement(static_cast<int>(current_token.number_value()))); + return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement(static_cast<int>(current_token.number_value()))).release_value_but_fixme_should_propagate_errors(); if (is_line_name(current_token)) { auto maybe_string = String::from_utf8(current_token.ident()); if (!maybe_string.is_error()) - return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement(maybe_string.value())); + return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement(maybe_string.value())).release_value_but_fixme_should_propagate_errors(); } return {}; } @@ -6564,8 +6572,8 @@ RefPtr<StyleValue> Parser::parse_grid_track_placement(Vector<ComponentValue> con span_or_position_value = 1; if (!line_name_value.is_empty()) - return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement(line_name_value, span_or_position_value, span_value)); - return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement(span_or_position_value, span_value)); + return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement(line_name_value, span_or_position_value, span_value)).release_value_but_fixme_should_propagate_errors(); + return GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement(span_or_position_value, span_value)).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_grid_track_placement_shorthand_value(Vector<ComponentValue> const& component_values) @@ -6596,11 +6604,11 @@ RefPtr<StyleValue> Parser::parse_grid_track_placement_shorthand_value(Vector<Com auto parsed_start_value = parse_grid_track_placement(track_start_placement_tokens); if (parsed_start_value && track_end_placement_tokens.is_empty()) - return GridTrackPlacementShorthandStyleValue::create(parsed_start_value.release_nonnull()->as_grid_track_placement().grid_track_placement()); + return GridTrackPlacementShorthandStyleValue::create(parsed_start_value.release_nonnull()->as_grid_track_placement().grid_track_placement()).release_value_but_fixme_should_propagate_errors(); auto parsed_end_value = parse_grid_track_placement(track_end_placement_tokens); if (parsed_start_value && parsed_end_value) - return GridTrackPlacementShorthandStyleValue::create(parsed_start_value.release_nonnull()->as_grid_track_placement(), parsed_end_value.release_nonnull()->as_grid_track_placement()); + return GridTrackPlacementShorthandStyleValue::create(parsed_start_value.release_nonnull()->as_grid_track_placement(), parsed_end_value.release_nonnull()->as_grid_track_placement()).release_value_but_fixme_should_propagate_errors(); return {}; } @@ -6649,7 +6657,8 @@ RefPtr<StyleValue> Parser::parse_grid_track_size_list_shorthand_value(Vector<Com return GridTrackSizeListShorthandStyleValue::create( parsed_template_areas_values.release_nonnull()->as_grid_template_area(), parsed_template_rows_values.release_nonnull()->as_grid_track_size_list(), - parsed_template_columns_values.release_nonnull()->as_grid_track_size_list()); + parsed_template_columns_values.release_nonnull()->as_grid_track_size_list()) + .release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_grid_area_shorthand_value(Vector<ComponentValue> const& component_values) @@ -6725,7 +6734,7 @@ RefPtr<StyleValue> Parser::parse_grid_area_shorthand_value(Vector<ComponentValue else column_end = row_end; - return GridAreaShorthandStyleValue::create(row_start, column_start, row_end, column_end); + return GridAreaShorthandStyleValue::create(row_start, column_start, row_end, column_end).release_value_but_fixme_should_propagate_errors(); } RefPtr<StyleValue> Parser::parse_grid_template_areas_value(Vector<ComponentValue> const& component_values) @@ -6741,7 +6750,7 @@ RefPtr<StyleValue> Parser::parse_grid_template_areas_value(Vector<ComponentValue } grid_area_rows.append(move(grid_area_columns)); } - return GridTemplateAreaStyleValue::create(grid_area_rows); + return GridTemplateAreaStyleValue::create(grid_area_rows).release_value_but_fixme_should_propagate_errors(); } Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(PropertyID property_id, TokenStream<ComponentValue>& tokens) @@ -6796,7 +6805,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property } if (property_id == PropertyID::Custom || contains_var_or_attr) - return { UnresolvedStyleValue::create(move(component_values), contains_var_or_attr) }; + return { UnresolvedStyleValue::create(move(component_values), contains_var_or_attr).release_value_but_fixme_should_propagate_errors() }; if (component_values.is_empty()) return ParseError::SyntaxError; @@ -6992,7 +7001,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property parsed_values.append(parsed_value.release_nonnull()); } if (!parsed_values.is_empty() && parsed_values.size() <= property_maximum_value_count(property_id)) - return { StyleValueList::create(move(parsed_values), StyleValueList::Separator::Space) }; + return { StyleValueList::create(move(parsed_values), StyleValueList::Separator::Space).release_value_but_fixme_should_propagate_errors() }; } return ParseError::SyntaxError; diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index 6dfffd117c..9c3672a973 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -81,77 +81,77 @@ static NonnullRefPtr<StyleValue const> style_value_for_background_property(Layou StyleValueVector values; for (auto const& layer : background_layers) values.append(callback(layer)); - return StyleValueList::create(move(values), StyleValueList::Separator::Comma); + return StyleValueList::create(move(values), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors(); } static RefPtr<StyleValue> style_value_for_display(CSS::Display display) { if (display.is_none()) - return IdentifierStyleValue::create(CSS::ValueID::None); + return IdentifierStyleValue::create(CSS::ValueID::None).release_value_but_fixme_should_propagate_errors(); if (display.is_outside_and_inside()) { StyleValueVector values; switch (display.outside()) { case CSS::Display::Outside::Inline: - values.append(IdentifierStyleValue::create(CSS::ValueID::Inline)); + values.append(IdentifierStyleValue::create(CSS::ValueID::Inline).release_value_but_fixme_should_propagate_errors()); break; case CSS::Display::Outside::Block: - values.append(IdentifierStyleValue::create(CSS::ValueID::Block)); + values.append(IdentifierStyleValue::create(CSS::ValueID::Block).release_value_but_fixme_should_propagate_errors()); break; case CSS::Display::Outside::RunIn: - values.append(IdentifierStyleValue::create(CSS::ValueID::RunIn)); + values.append(IdentifierStyleValue::create(CSS::ValueID::RunIn).release_value_but_fixme_should_propagate_errors()); break; } switch (display.inside()) { case CSS::Display::Inside::Flow: - values.append(IdentifierStyleValue::create(CSS::ValueID::Flow)); + values.append(IdentifierStyleValue::create(CSS::ValueID::Flow).release_value_but_fixme_should_propagate_errors()); break; case CSS::Display::Inside::FlowRoot: - values.append(IdentifierStyleValue::create(CSS::ValueID::FlowRoot)); + values.append(IdentifierStyleValue::create(CSS::ValueID::FlowRoot).release_value_but_fixme_should_propagate_errors()); break; case CSS::Display::Inside::Table: - values.append(IdentifierStyleValue::create(CSS::ValueID::Table)); + values.append(IdentifierStyleValue::create(CSS::ValueID::Table).release_value_but_fixme_should_propagate_errors()); break; case CSS::Display::Inside::Flex: - values.append(IdentifierStyleValue::create(CSS::ValueID::Flex)); + values.append(IdentifierStyleValue::create(CSS::ValueID::Flex).release_value_but_fixme_should_propagate_errors()); break; case CSS::Display::Inside::Grid: - values.append(IdentifierStyleValue::create(CSS::ValueID::Grid)); + values.append(IdentifierStyleValue::create(CSS::ValueID::Grid).release_value_but_fixme_should_propagate_errors()); break; case CSS::Display::Inside::Ruby: - values.append(IdentifierStyleValue::create(CSS::ValueID::Ruby)); + values.append(IdentifierStyleValue::create(CSS::ValueID::Ruby).release_value_but_fixme_should_propagate_errors()); break; } - return StyleValueList::create(move(values), StyleValueList::Separator::Space); + return StyleValueList::create(move(values), StyleValueList::Separator::Space).release_value_but_fixme_should_propagate_errors(); } if (display.is_internal()) { switch (display.internal()) { case CSS::Display::Internal::TableRowGroup: - return IdentifierStyleValue::create(CSS::ValueID::TableRowGroup); + return IdentifierStyleValue::create(CSS::ValueID::TableRowGroup).release_value_but_fixme_should_propagate_errors(); case CSS::Display::Internal::TableHeaderGroup: - return IdentifierStyleValue::create(CSS::ValueID::TableHeaderGroup); + return IdentifierStyleValue::create(CSS::ValueID::TableHeaderGroup).release_value_but_fixme_should_propagate_errors(); case CSS::Display::Internal::TableFooterGroup: - return IdentifierStyleValue::create(CSS::ValueID::TableFooterGroup); + return IdentifierStyleValue::create(CSS::ValueID::TableFooterGroup).release_value_but_fixme_should_propagate_errors(); case CSS::Display::Internal::TableRow: - return IdentifierStyleValue::create(CSS::ValueID::TableRow); + return IdentifierStyleValue::create(CSS::ValueID::TableRow).release_value_but_fixme_should_propagate_errors(); case CSS::Display::Internal::TableCell: - return IdentifierStyleValue::create(CSS::ValueID::TableCell); + return IdentifierStyleValue::create(CSS::ValueID::TableCell).release_value_but_fixme_should_propagate_errors(); case CSS::Display::Internal::TableColumnGroup: - return IdentifierStyleValue::create(CSS::ValueID::TableColumnGroup); + return IdentifierStyleValue::create(CSS::ValueID::TableColumnGroup).release_value_but_fixme_should_propagate_errors(); case CSS::Display::Internal::TableColumn: - return IdentifierStyleValue::create(CSS::ValueID::TableColumn); + return IdentifierStyleValue::create(CSS::ValueID::TableColumn).release_value_but_fixme_should_propagate_errors(); case CSS::Display::Internal::TableCaption: - return IdentifierStyleValue::create(CSS::ValueID::TableCaption); + return IdentifierStyleValue::create(CSS::ValueID::TableCaption).release_value_but_fixme_should_propagate_errors(); case CSS::Display::Internal::RubyBase: - return IdentifierStyleValue::create(CSS::ValueID::RubyBase); + return IdentifierStyleValue::create(CSS::ValueID::RubyBase).release_value_but_fixme_should_propagate_errors(); case CSS::Display::Internal::RubyText: - return IdentifierStyleValue::create(CSS::ValueID::RubyText); + return IdentifierStyleValue::create(CSS::ValueID::RubyText).release_value_but_fixme_should_propagate_errors(); case CSS::Display::Internal::RubyBaseContainer: - return IdentifierStyleValue::create(CSS::ValueID::RubyBaseContainer); + return IdentifierStyleValue::create(CSS::ValueID::RubyBaseContainer).release_value_but_fixme_should_propagate_errors(); case CSS::Display::Internal::RubyTextContainer: - return IdentifierStyleValue::create(CSS::ValueID::RubyTextContainer); + return IdentifierStyleValue::create(CSS::ValueID::RubyTextContainer).release_value_but_fixme_should_propagate_errors(); } } @@ -168,30 +168,30 @@ static NonnullRefPtr<StyleValue const> value_or_default(Optional<StyleProperty> static NonnullRefPtr<StyleValue const> style_value_for_length_percentage(LengthPercentage const& length_percentage) { if (length_percentage.is_auto()) - return IdentifierStyleValue::create(ValueID::Auto); + return IdentifierStyleValue::create(ValueID::Auto).release_value_but_fixme_should_propagate_errors(); if (length_percentage.is_percentage()) - return PercentageStyleValue::create(length_percentage.percentage()); + return PercentageStyleValue::create(length_percentage.percentage()).release_value_but_fixme_should_propagate_errors(); if (length_percentage.is_length()) - return LengthStyleValue::create(length_percentage.length()); + return LengthStyleValue::create(length_percentage.length()).release_value_but_fixme_should_propagate_errors(); return length_percentage.calculated(); } static NonnullRefPtr<StyleValue const> style_value_for_size(CSS::Size const& size) { if (size.is_none()) - return IdentifierStyleValue::create(ValueID::None); + return IdentifierStyleValue::create(ValueID::None).release_value_but_fixme_should_propagate_errors(); if (size.is_percentage()) - return PercentageStyleValue::create(size.percentage()); + return PercentageStyleValue::create(size.percentage()).release_value_but_fixme_should_propagate_errors(); if (size.is_length()) - return LengthStyleValue::create(size.length()); + return LengthStyleValue::create(size.length()).release_value_but_fixme_should_propagate_errors(); if (size.is_auto()) - return IdentifierStyleValue::create(ValueID::Auto); + return IdentifierStyleValue::create(ValueID::Auto).release_value_but_fixme_should_propagate_errors(); if (size.is_calculated()) return size.calculated(); if (size.is_min_content()) - return IdentifierStyleValue::create(ValueID::MinContent); + return IdentifierStyleValue::create(ValueID::MinContent).release_value_but_fixme_should_propagate_errors(); if (size.is_max_content()) - return IdentifierStyleValue::create(ValueID::MaxContent); + return IdentifierStyleValue::create(ValueID::MaxContent).release_value_but_fixme_should_propagate_errors(); // FIXME: Support fit-content(<length>) TODO(); } @@ -210,88 +210,89 @@ RefPtr<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L auto maybe_background_clip = property(CSS::PropertyID::BackgroundClip); return BackgroundStyleValue::create( - value_or_default(maybe_background_color, InitialStyleValue::the()), - value_or_default(maybe_background_image, IdentifierStyleValue::create(CSS::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(CSS::ValueID::Auto)), - value_or_default(maybe_background_repeat, BackgroundRepeatStyleValue::create(CSS::Repeat::Repeat, CSS::Repeat::Repeat)), - value_or_default(maybe_background_attachment, IdentifierStyleValue::create(CSS::ValueID::Scroll)), - value_or_default(maybe_background_origin, IdentifierStyleValue::create(CSS::ValueID::PaddingBox)), - value_or_default(maybe_background_clip, IdentifierStyleValue::create(CSS::ValueID::BorderBox))); + value_or_default(maybe_background_color, InitialStyleValue::the().release_value_but_fixme_should_propagate_errors()), + value_or_default(maybe_background_image, IdentifierStyleValue::create(CSS::ValueID::None).release_value_but_fixme_should_propagate_errors()), + value_or_default(maybe_background_position, PositionStyleValue::create(EdgeStyleValue::create(PositionEdge::Left, Length::make_px(0)).release_value_but_fixme_should_propagate_errors(), EdgeStyleValue::create(PositionEdge::Top, Length::make_px(0)).release_value_but_fixme_should_propagate_errors()).release_value_but_fixme_should_propagate_errors()), + value_or_default(maybe_background_size, IdentifierStyleValue::create(CSS::ValueID::Auto).release_value_but_fixme_should_propagate_errors()), + value_or_default(maybe_background_repeat, BackgroundRepeatStyleValue::create(CSS::Repeat::Repeat, CSS::Repeat::Repeat).release_value_but_fixme_should_propagate_errors()), + value_or_default(maybe_background_attachment, IdentifierStyleValue::create(CSS::ValueID::Scroll).release_value_but_fixme_should_propagate_errors()), + value_or_default(maybe_background_origin, IdentifierStyleValue::create(CSS::ValueID::PaddingBox).release_value_but_fixme_should_propagate_errors()), + value_or_default(maybe_background_clip, IdentifierStyleValue::create(CSS::ValueID::BorderBox).release_value_but_fixme_should_propagate_errors())) + .release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::BackgroundAttachment: return style_value_for_background_property( layout_node, - [](auto& layer) { return IdentifierStyleValue::create(to_value_id(layer.attachment)); }, - [] { return IdentifierStyleValue::create(CSS::ValueID::Scroll); }); + [](auto& layer) { return IdentifierStyleValue::create(to_value_id(layer.attachment)).release_value_but_fixme_should_propagate_errors(); }, + [] { return IdentifierStyleValue::create(CSS::ValueID::Scroll).release_value_but_fixme_should_propagate_errors(); }); case CSS::PropertyID::BackgroundClip: return style_value_for_background_property( layout_node, - [](auto& layer) { return IdentifierStyleValue::create(to_value_id(layer.clip)); }, - [] { return IdentifierStyleValue::create(CSS::ValueID::BorderBox); }); + [](auto& layer) { return IdentifierStyleValue::create(to_value_id(layer.clip)).release_value_but_fixme_should_propagate_errors(); }, + [] { return IdentifierStyleValue::create(CSS::ValueID::BorderBox).release_value_but_fixme_should_propagate_errors(); }); case PropertyID::BackgroundColor: - return ColorStyleValue::create(layout_node.computed_values().background_color()); + return ColorStyleValue::create(layout_node.computed_values().background_color()).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::BackgroundImage: return style_value_for_background_property( layout_node, [](auto& layer) -> NonnullRefPtr<StyleValue const> { if (layer.background_image) return *layer.background_image; - return IdentifierStyleValue::create(CSS::ValueID::None); + return IdentifierStyleValue::create(CSS::ValueID::None).release_value_but_fixme_should_propagate_errors(); }, - [] { return IdentifierStyleValue::create(CSS::ValueID::None); }); + [] { return IdentifierStyleValue::create(CSS::ValueID::None).release_value_but_fixme_should_propagate_errors(); }); case CSS::PropertyID::BackgroundOrigin: return style_value_for_background_property( layout_node, - [](auto& layer) { return IdentifierStyleValue::create(to_value_id(layer.origin)); }, - [] { return IdentifierStyleValue::create(CSS::ValueID::PaddingBox); }); + [](auto& layer) { return IdentifierStyleValue::create(to_value_id(layer.origin)).release_value_but_fixme_should_propagate_errors(); }, + [] { return IdentifierStyleValue::create(CSS::ValueID::PaddingBox).release_value_but_fixme_should_propagate_errors(); }); case CSS::PropertyID::BackgroundRepeat: return style_value_for_background_property( layout_node, [](auto& layer) { StyleValueVector repeat { - IdentifierStyleValue::create(to_value_id(layer.repeat_x)), - IdentifierStyleValue::create(to_value_id(layer.repeat_y)), + IdentifierStyleValue::create(to_value_id(layer.repeat_x)).release_value_but_fixme_should_propagate_errors(), + IdentifierStyleValue::create(to_value_id(layer.repeat_y)).release_value_but_fixme_should_propagate_errors(), }; - return StyleValueList::create(move(repeat), StyleValueList::Separator::Space); + return StyleValueList::create(move(repeat), StyleValueList::Separator::Space).release_value_but_fixme_should_propagate_errors(); }, - [] { return BackgroundRepeatStyleValue::create(CSS::Repeat::Repeat, CSS::Repeat::Repeat); }); + [] { return BackgroundRepeatStyleValue::create(CSS::Repeat::Repeat, CSS::Repeat::Repeat).release_value_but_fixme_should_propagate_errors(); }); case CSS::PropertyID::BorderBottom: { auto border = layout_node.computed_values().border_bottom(); - 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); + auto width = LengthStyleValue::create(Length::make_px(border.width)).release_value_but_fixme_should_propagate_errors(); + auto style = IdentifierStyleValue::create(to_value_id(border.line_style)).release_value_but_fixme_should_propagate_errors(); + auto color = ColorStyleValue::create(border.color).release_value_but_fixme_should_propagate_errors(); + return BorderStyleValue::create(width, style, color).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::BorderBottomColor: - return ColorStyleValue::create(layout_node.computed_values().border_bottom().color); + return ColorStyleValue::create(layout_node.computed_values().border_bottom().color).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::BorderBottomLeftRadius: { auto const& border_radius = layout_node.computed_values().border_bottom_left_radius(); - return BorderRadiusStyleValue::create(border_radius.horizontal_radius, border_radius.vertical_radius); + return BorderRadiusStyleValue::create(border_radius.horizontal_radius, border_radius.vertical_radius).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::BorderBottomRightRadius: { auto const& border_radius = layout_node.computed_values().border_bottom_right_radius(); - return BorderRadiusStyleValue::create(border_radius.horizontal_radius, border_radius.vertical_radius); + return BorderRadiusStyleValue::create(border_radius.horizontal_radius, border_radius.vertical_radius).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::BorderBottomStyle: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_bottom().line_style)); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_bottom().line_style)).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::BorderBottomWidth: - return LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_bottom().width)); + return LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_bottom().width)).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::BorderCollapse: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_collapse())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_collapse())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::BorderLeft: { auto border = layout_node.computed_values().border_left(); - 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); + auto width = LengthStyleValue::create(Length::make_px(border.width)).release_value_but_fixme_should_propagate_errors(); + auto style = IdentifierStyleValue::create(to_value_id(border.line_style)).release_value_but_fixme_should_propagate_errors(); + auto color = ColorStyleValue::create(border.color).release_value_but_fixme_should_propagate_errors(); + return BorderStyleValue::create(width, style, color).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::BorderLeftColor: - return ColorStyleValue::create(layout_node.computed_values().border_left().color); + return ColorStyleValue::create(layout_node.computed_values().border_left().color).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::BorderLeftStyle: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_left().line_style)); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_left().line_style)).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::BorderLeftWidth: - return LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_left().width)); + return LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_left().width)).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::BorderRadius: { auto maybe_top_left_radius = property(CSS::PropertyID::BorderTopLeftRadius); auto maybe_top_right_radius = property(CSS::PropertyID::BorderTopRightRadius); @@ -315,42 +316,42 @@ RefPtr<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L bottom_right_radius = maybe_bottom_right_radius.value().value->as_border_radius(); } - return BorderRadiusShorthandStyleValue::create(top_left_radius.release_nonnull(), top_right_radius.release_nonnull(), bottom_right_radius.release_nonnull(), bottom_left_radius.release_nonnull()); + return BorderRadiusShorthandStyleValue::create(top_left_radius.release_nonnull(), top_right_radius.release_nonnull(), bottom_right_radius.release_nonnull(), bottom_left_radius.release_nonnull()).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::BorderRight: { auto border = layout_node.computed_values().border_right(); - 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); + auto width = LengthStyleValue::create(Length::make_px(border.width)).release_value_but_fixme_should_propagate_errors(); + auto style = IdentifierStyleValue::create(to_value_id(border.line_style)).release_value_but_fixme_should_propagate_errors(); + auto color = ColorStyleValue::create(border.color).release_value_but_fixme_should_propagate_errors(); + return BorderStyleValue::create(width, style, color).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::BorderRightColor: - return ColorStyleValue::create(layout_node.computed_values().border_right().color); + return ColorStyleValue::create(layout_node.computed_values().border_right().color).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::BorderRightStyle: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_right().line_style)); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_right().line_style)).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::BorderRightWidth: - return LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_right().width)); + return LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_right().width)).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::BorderTop: { auto border = layout_node.computed_values().border_top(); - 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); + auto width = LengthStyleValue::create(Length::make_px(border.width)).release_value_but_fixme_should_propagate_errors(); + auto style = IdentifierStyleValue::create(to_value_id(border.line_style)).release_value_but_fixme_should_propagate_errors(); + auto color = ColorStyleValue::create(border.color).release_value_but_fixme_should_propagate_errors(); + return BorderStyleValue::create(width, style, color).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::BorderTopColor: - return ColorStyleValue::create(layout_node.computed_values().border_top().color); + return ColorStyleValue::create(layout_node.computed_values().border_top().color).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::BorderTopLeftRadius: { auto const& border_radius = layout_node.computed_values().border_top_left_radius(); - return BorderRadiusStyleValue::create(border_radius.horizontal_radius, border_radius.vertical_radius); + return BorderRadiusStyleValue::create(border_radius.horizontal_radius, border_radius.vertical_radius).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::BorderTopRightRadius: { auto const& border_radius = layout_node.computed_values().border_top_right_radius(); - return BorderRadiusStyleValue::create(border_radius.horizontal_radius, border_radius.vertical_radius); + return BorderRadiusStyleValue::create(border_radius.horizontal_radius, border_radius.vertical_radius).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::BorderTopStyle: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_top().line_style)); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_top().line_style)).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::BorderTopWidth: - return LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_top().width)); + return LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_top().width)).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::BoxShadow: { auto box_shadow_layers = layout_node.computed_values().box_shadow(); if (box_shadow_layers.is_empty()) @@ -361,66 +362,66 @@ RefPtr<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L }; if (box_shadow_layers.size() == 1) - return make_box_shadow_style_value(box_shadow_layers.first()); + return make_box_shadow_style_value(box_shadow_layers.first()).release_value_but_fixme_should_propagate_errors(); StyleValueVector box_shadow; box_shadow.ensure_capacity(box_shadow_layers.size()); for (auto const& layer : box_shadow_layers) - box_shadow.append(make_box_shadow_style_value(layer)); - return StyleValueList::create(move(box_shadow), StyleValueList::Separator::Comma); + box_shadow.append(make_box_shadow_style_value(layer).release_value_but_fixme_should_propagate_errors()); + return StyleValueList::create(move(box_shadow), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::BoxSizing: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().box_sizing())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().box_sizing())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::Bottom: return style_value_for_length_percentage(layout_node.computed_values().inset().bottom()); case CSS::PropertyID::Clear: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().clear())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().clear())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::Clip: - return RectStyleValue::create(layout_node.computed_values().clip().to_rect()); + return RectStyleValue::create(layout_node.computed_values().clip().to_rect()).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::Color: - return ColorStyleValue::create(layout_node.computed_values().color()); + return ColorStyleValue::create(layout_node.computed_values().color()).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::ColumnGap: return style_value_for_size(layout_node.computed_values().column_gap()); case CSS::PropertyID::Cursor: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().cursor())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().cursor())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::Display: return style_value_for_display(layout_node.display()); case CSS::PropertyID::FlexBasis: { switch (layout_node.computed_values().flex_basis().type) { case FlexBasis::Content: - return IdentifierStyleValue::create(CSS::ValueID::Content); + return IdentifierStyleValue::create(CSS::ValueID::Content).release_value_but_fixme_should_propagate_errors(); case FlexBasis::LengthPercentage: return style_value_for_length_percentage(*layout_node.computed_values().flex_basis().length_percentage); case FlexBasis::Auto: - return IdentifierStyleValue::create(CSS::ValueID::Auto); + return IdentifierStyleValue::create(CSS::ValueID::Auto).release_value_but_fixme_should_propagate_errors(); default: VERIFY_NOT_REACHED(); } break; case CSS::PropertyID::FlexDirection: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().flex_direction())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().flex_direction())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::FlexGrow: - return NumericStyleValue::create_float(layout_node.computed_values().flex_grow()); + return NumericStyleValue::create_float(layout_node.computed_values().flex_grow()).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::FlexShrink: - return NumericStyleValue::create_float(layout_node.computed_values().flex_shrink()); + return NumericStyleValue::create_float(layout_node.computed_values().flex_shrink()).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::FlexWrap: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().flex_wrap())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().flex_wrap())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::Float: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().float_())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().float_())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::FontSize: - return LengthStyleValue::create(Length::make_px(layout_node.computed_values().font_size())); + return LengthStyleValue::create(Length::make_px(layout_node.computed_values().font_size())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::FontVariant: { auto font_variant = layout_node.computed_values().font_variant(); switch (font_variant) { case FontVariant::Normal: - return IdentifierStyleValue::create(ValueID::Normal); + return IdentifierStyleValue::create(ValueID::Normal).release_value_but_fixme_should_propagate_errors(); case FontVariant::SmallCaps: - return IdentifierStyleValue::create(ValueID::SmallCaps); + return IdentifierStyleValue::create(ValueID::SmallCaps).release_value_but_fixme_should_propagate_errors(); } VERIFY_NOT_REACHED(); } case CSS::PropertyID::FontWeight: - return NumericStyleValue::create_integer(layout_node.computed_values().font_weight()); + return NumericStyleValue::create_integer(layout_node.computed_values().font_weight()).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::GridArea: { auto maybe_grid_row_start = property(CSS::PropertyID::GridRowStart); auto maybe_grid_column_start = property(CSS::PropertyID::GridColumnStart); @@ -447,7 +448,8 @@ RefPtr<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L grid_row_start.release_nonnull(), grid_column_start.release_nonnull(), grid_row_end.release_nonnull(), - grid_column_end.release_nonnull()); + grid_column_end.release_nonnull()) + .release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::GridColumn: { auto maybe_grid_column_end = property(CSS::PropertyID::GridColumnEnd); @@ -461,12 +463,12 @@ RefPtr<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L VERIFY(maybe_grid_column_start.value().value->is_grid_track_placement()); grid_column_start = maybe_grid_column_start.value().value->as_grid_track_placement(); } - return GridTrackPlacementShorthandStyleValue::create(grid_column_end.release_nonnull(), grid_column_start.release_nonnull()); + return GridTrackPlacementShorthandStyleValue::create(grid_column_end.release_nonnull(), grid_column_start.release_nonnull()).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::GridColumnEnd: - return GridTrackPlacementStyleValue::create(layout_node.computed_values().grid_column_end()); + return GridTrackPlacementStyleValue::create(layout_node.computed_values().grid_column_end()).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::GridColumnStart: - return GridTrackPlacementStyleValue::create(layout_node.computed_values().grid_column_start()); + return GridTrackPlacementStyleValue::create(layout_node.computed_values().grid_column_start()).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::GridRow: { auto maybe_grid_row_end = property(CSS::PropertyID::GridRowEnd); auto maybe_grid_row_start = property(CSS::PropertyID::GridRowStart); @@ -479,12 +481,12 @@ RefPtr<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L VERIFY(maybe_grid_row_start.value().value->is_grid_track_placement()); grid_row_start = maybe_grid_row_start.value().value->as_grid_track_placement(); } - return GridTrackPlacementShorthandStyleValue::create(grid_row_end.release_nonnull(), grid_row_start.release_nonnull()); + return GridTrackPlacementShorthandStyleValue::create(grid_row_end.release_nonnull(), grid_row_start.release_nonnull()).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::GridRowEnd: - return GridTrackPlacementStyleValue::create(layout_node.computed_values().grid_row_end()); + return GridTrackPlacementStyleValue::create(layout_node.computed_values().grid_row_end()).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::GridRowStart: - return GridTrackPlacementStyleValue::create(layout_node.computed_values().grid_row_start()); + return GridTrackPlacementStyleValue::create(layout_node.computed_values().grid_row_start()).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::GridTemplate: { auto maybe_grid_template_areas = property(CSS::PropertyID::GridTemplateAreas); auto maybe_grid_template_rows = property(CSS::PropertyID::GridTemplateRows); @@ -503,26 +505,26 @@ RefPtr<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L VERIFY(maybe_grid_template_columns.value().value->is_grid_track_size_list()); grid_template_columns = maybe_grid_template_columns.value().value->as_grid_track_size_list(); } - return GridTrackSizeListShorthandStyleValue::create(grid_template_areas.release_nonnull(), grid_template_rows.release_nonnull(), grid_template_columns.release_nonnull()); + return GridTrackSizeListShorthandStyleValue::create(grid_template_areas.release_nonnull(), grid_template_rows.release_nonnull(), grid_template_columns.release_nonnull()).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::GridTemplateColumns: - return GridTrackSizeListStyleValue::create(layout_node.computed_values().grid_template_columns()); + return GridTrackSizeListStyleValue::create(layout_node.computed_values().grid_template_columns()).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::GridTemplateRows: - return GridTrackSizeListStyleValue::create(layout_node.computed_values().grid_template_rows()); + return GridTrackSizeListStyleValue::create(layout_node.computed_values().grid_template_rows()).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::GridTemplateAreas: - return GridTemplateAreaStyleValue::create(layout_node.computed_values().grid_template_areas()); + return GridTemplateAreaStyleValue::create(layout_node.computed_values().grid_template_areas()).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::Height: return style_value_for_size(layout_node.computed_values().height()); case CSS::PropertyID::ImageRendering: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().image_rendering())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().image_rendering())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::JustifyContent: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().justify_content())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().justify_content())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::Left: return style_value_for_length_percentage(layout_node.computed_values().inset().left()); case CSS::PropertyID::LineHeight: - return LengthStyleValue::create(Length::make_px(layout_node.line_height())); + return LengthStyleValue::create(Length::make_px(layout_node.line_height())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::ListStyleType: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().list_style_type())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().list_style_type())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::Margin: { auto margin = layout_node.computed_values().margin(); auto values = StyleValueVector {}; @@ -530,7 +532,7 @@ RefPtr<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L values.append(style_value_for_length_percentage(margin.right())); values.append(style_value_for_length_percentage(margin.bottom())); values.append(style_value_for_length_percentage(margin.left())); - return StyleValueList::create(move(values), StyleValueList::Separator::Space); + return StyleValueList::create(move(values), StyleValueList::Separator::Space).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::MarginBottom: return style_value_for_length_percentage(layout_node.computed_values().margin().bottom()); @@ -549,13 +551,13 @@ RefPtr<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L case CSS::PropertyID::MinWidth: return style_value_for_size(layout_node.computed_values().min_width()); case CSS::PropertyID::Opacity: - return NumericStyleValue::create_float(layout_node.computed_values().opacity()); + return NumericStyleValue::create_float(layout_node.computed_values().opacity()).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::Order: - return NumericStyleValue::create_integer(layout_node.computed_values().order()); + return NumericStyleValue::create_integer(layout_node.computed_values().order()).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::OverflowX: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().overflow_x())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().overflow_x())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::OverflowY: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().overflow_y())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().overflow_y())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::Padding: { auto padding = layout_node.computed_values().padding(); auto values = StyleValueVector {}; @@ -563,7 +565,7 @@ RefPtr<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L values.append(style_value_for_length_percentage(padding.right())); values.append(style_value_for_length_percentage(padding.bottom())); values.append(style_value_for_length_percentage(padding.left())); - return StyleValueList::create(move(values), StyleValueList::Separator::Space); + return StyleValueList::create(move(values), StyleValueList::Separator::Space).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::PaddingBottom: return style_value_for_length_percentage(layout_node.computed_values().padding().bottom()); @@ -574,27 +576,27 @@ RefPtr<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L case CSS::PropertyID::PaddingTop: return style_value_for_length_percentage(layout_node.computed_values().padding().top()); case CSS::PropertyID::Position: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().position())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().position())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::Right: return style_value_for_length_percentage(layout_node.computed_values().inset().right()); case CSS::PropertyID::RowGap: return style_value_for_size(layout_node.computed_values().row_gap()); case CSS::PropertyID::TextAlign: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().text_align())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().text_align())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::TextDecorationLine: { auto text_decoration_lines = layout_node.computed_values().text_decoration_line(); if (text_decoration_lines.is_empty()) - return IdentifierStyleValue::create(ValueID::None); + return IdentifierStyleValue::create(ValueID::None).release_value_but_fixme_should_propagate_errors(); StyleValueVector style_values; for (auto const& line : text_decoration_lines) { - style_values.append(IdentifierStyleValue::create(to_value_id(line))); + style_values.append(IdentifierStyleValue::create(to_value_id(line)).release_value_but_fixme_should_propagate_errors()); } - return StyleValueList::create(move(style_values), StyleValueList::Separator::Space); + return StyleValueList::create(move(style_values), StyleValueList::Separator::Space).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::TextDecorationStyle: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().text_decoration_style())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().text_decoration_style())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::TextTransform: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().text_transform())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().text_transform())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::Top: return style_value_for_length_percentage(layout_node.computed_values().inset().top()); case CSS::PropertyID::Transform: { @@ -603,7 +605,7 @@ RefPtr<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L // https://www.w3.org/TR/css-transforms-1/#serialization-of-the-computed-value auto transformations = layout_node.computed_values().transformations(); if (transformations.is_empty()) - return IdentifierStyleValue::create(ValueID::None); + return IdentifierStyleValue::create(ValueID::None).release_value_but_fixme_should_propagate_errors(); // The transform matrix is held by the StackingContext, so we need to make sure we have one first. auto const* viewport = layout_node.document().layout_node(); @@ -620,37 +622,37 @@ RefPtr<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L StyleValueVector parameters; parameters.ensure_capacity(6); - parameters.append(NumericStyleValue::create_float(affine_matrix.a())); - parameters.append(NumericStyleValue::create_float(affine_matrix.b())); - parameters.append(NumericStyleValue::create_float(affine_matrix.c())); - parameters.append(NumericStyleValue::create_float(affine_matrix.d())); - parameters.append(NumericStyleValue::create_float(affine_matrix.e())); - parameters.append(NumericStyleValue::create_float(affine_matrix.f())); - - NonnullRefPtr<StyleValue> matrix_function = TransformationStyleValue::create(TransformFunction::Matrix, move(parameters)); + parameters.append(NumericStyleValue::create_float(affine_matrix.a()).release_value_but_fixme_should_propagate_errors()); + parameters.append(NumericStyleValue::create_float(affine_matrix.b()).release_value_but_fixme_should_propagate_errors()); + parameters.append(NumericStyleValue::create_float(affine_matrix.c()).release_value_but_fixme_should_propagate_errors()); + parameters.append(NumericStyleValue::create_float(affine_matrix.d()).release_value_but_fixme_should_propagate_errors()); + parameters.append(NumericStyleValue::create_float(affine_matrix.e()).release_value_but_fixme_should_propagate_errors()); + parameters.append(NumericStyleValue::create_float(affine_matrix.f()).release_value_but_fixme_should_propagate_errors()); + + NonnullRefPtr<StyleValue> matrix_function = TransformationStyleValue::create(TransformFunction::Matrix, move(parameters)).release_value_but_fixme_should_propagate_errors(); // Elsewhere we always store the transform property's value as a StyleValueList of TransformationStyleValues, // so this is just for consistency. StyleValueVector matrix_functions; matrix_functions.append(matrix_function); - return StyleValueList::create(move(matrix_functions), StyleValueList::Separator::Space); + return StyleValueList::create(move(matrix_functions), StyleValueList::Separator::Space).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::VerticalAlign: if (auto const* length_percentage = layout_node.computed_values().vertical_align().get_pointer<CSS::LengthPercentage>()) { return style_value_for_length_percentage(*length_percentage); } - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().vertical_align().get<CSS::VerticalAlign>())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().vertical_align().get<CSS::VerticalAlign>())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::WhiteSpace: - return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().white_space())); + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().white_space())).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::Width: return style_value_for_size(layout_node.computed_values().width()); case CSS::PropertyID::ZIndex: { auto maybe_z_index = layout_node.computed_values().z_index(); if (!maybe_z_index.has_value()) return {}; - return NumericStyleValue::create_integer(maybe_z_index.release_value()); + return NumericStyleValue::create_integer(maybe_z_index.release_value()).release_value_but_fixme_should_propagate_errors(); } case CSS::PropertyID::Invalid: - return IdentifierStyleValue::create(CSS::ValueID::Invalid); + return IdentifierStyleValue::create(CSS::ValueID::Invalid).release_value_but_fixme_should_propagate_errors(); case CSS::PropertyID::Custom: dbgln_if(LIBWEB_CSS_DEBUG, "Computed style for custom properties was requested (?)"); return {}; diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 07d8cbb25b..123f3d98b1 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -480,8 +480,8 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope y_positions.unchecked_append(layer); } } - style.set_property(CSS::PropertyID::BackgroundPositionX, StyleValueList::create(move(x_positions), values_list.separator())); - style.set_property(CSS::PropertyID::BackgroundPositionY, StyleValueList::create(move(y_positions), values_list.separator())); + style.set_property(CSS::PropertyID::BackgroundPositionX, StyleValueList::create(move(x_positions), values_list.separator()).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::BackgroundPositionY, StyleValueList::create(move(y_positions), values_list.separator()).release_value_but_fixme_should_propagate_errors()); } else { style.set_property(CSS::PropertyID::BackgroundPositionX, value); style.set_property(CSS::PropertyID::BackgroundPositionY, value); @@ -1363,8 +1363,8 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele FontCache::the().set(font_selector, *found_font); - style.set_property(CSS::PropertyID::FontSize, LengthStyleValue::create(CSS::Length::make_px(font_size_in_px))); - style.set_property(CSS::PropertyID::FontWeight, NumericStyleValue::create_integer(weight)); + style.set_property(CSS::PropertyID::FontSize, LengthStyleValue::create(CSS::Length::make_px(font_size_in_px)).release_value_but_fixme_should_propagate_errors()); + style.set_property(CSS::PropertyID::FontWeight, NumericStyleValue::create_integer(weight).release_value_but_fixme_should_propagate_errors()); style.set_computed_font(found_font.release_nonnull()); } @@ -1412,7 +1412,8 @@ void StyleComputer::absolutize_values(StyleProperties& style, DOM::Element const auto& line_height_value_slot = style.m_property_values[to_underlying(CSS::PropertyID::LineHeight)]; if (line_height_value_slot && line_height_value_slot->is_percentage()) { line_height_value_slot = LengthStyleValue::create( - Length::make_px(font_size * line_height_value_slot->as_percentage().percentage().as_fraction())); + Length::make_px(font_size * line_height_value_slot->as_percentage().percentage().as_fraction())) + .release_value_but_fixme_should_propagate_errors(); } auto line_height = style.line_height(viewport_rect(), font_metrics, root_font_metrics); @@ -1420,7 +1421,7 @@ void StyleComputer::absolutize_values(StyleProperties& style, DOM::Element const // 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 && line_height_value_slot->is_length()) - line_height_value_slot = LengthStyleValue::create(Length::make_px(line_height)); + line_height_value_slot = LengthStyleValue::create(Length::make_px(line_height)).release_value_but_fixme_should_propagate_errors(); for (size_t i = 0; i < style.m_property_values.size(); ++i) { auto& value_slot = style.m_property_values[i]; @@ -1519,7 +1520,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)); + style.set_property(CSS::PropertyID::Display, DisplayStyleValue::create(new_display).release_value_but_fixme_should_propagate_errors()); } NonnullRefPtr<StyleProperties> StyleComputer::create_document_style() const @@ -1528,9 +1529,9 @@ NonnullRefPtr<StyleProperties> StyleComputer::create_document_style() const compute_font(style, nullptr, {}); compute_defaulted_values(style, nullptr, {}); absolutize_values(style, nullptr, {}); - style->set_property(CSS::PropertyID::Width, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().width()))); - style->set_property(CSS::PropertyID::Height, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().height()))); - style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Block))); + style->set_property(CSS::PropertyID::Width, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().width())).release_value_but_fixme_should_propagate_errors()); + style->set_property(CSS::PropertyID::Height, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().height())).release_value_but_fixme_should_propagate_errors()); + style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Block)).release_value_but_fixme_should_propagate_errors()); return style; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.h index 13554bb877..e4437a7609 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<AngleStyleValue> { public: - static ValueComparingNonnullRefPtr<AngleStyleValue> create(Angle angle) + static ErrorOr<ValueComparingNonnullRefPtr<AngleStyleValue>> create(Angle angle) { - return adopt_ref(*new AngleStyleValue(move(angle))); + return adopt_nonnull_ref_or_enomem(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 aea654e6e9..a3ea5c8df4 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<BackgroundRepeatStyleValue> { public: - static ValueComparingNonnullRefPtr<BackgroundRepeatStyleValue> create(Repeat repeat_x, Repeat repeat_y) + static ErrorOr<ValueComparingNonnullRefPtr<BackgroundRepeatStyleValue>> create(Repeat repeat_x, Repeat repeat_y) { - return adopt_ref(*new BackgroundRepeatStyleValue(repeat_x, repeat_y)); + return adopt_nonnull_ref_or_enomem(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 a01a79eed0..593979e685 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<BackgroundSizeStyleValue> { public: - static ValueComparingNonnullRefPtr<BackgroundSizeStyleValue> create(LengthPercentage size_x, LengthPercentage size_y) + static ErrorOr<ValueComparingNonnullRefPtr<BackgroundSizeStyleValue>> create(LengthPercentage size_x, LengthPercentage size_y) { - return adopt_ref(*new BackgroundSizeStyleValue(size_x, size_y)); + return adopt_nonnull_ref_or_enomem(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 21e90f736c..797776dea7 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<BackgroundStyleValue> { public: - static ValueComparingNonnullRefPtr<BackgroundStyleValue> create( + static ErrorOr<ValueComparingNonnullRefPtr<BackgroundStyleValue>> create( ValueComparingNonnullRefPtr<StyleValue const> color, ValueComparingNonnullRefPtr<StyleValue const> image, ValueComparingNonnullRefPtr<StyleValue const> position, @@ -25,7 +25,7 @@ public: ValueComparingNonnullRefPtr<StyleValue const> origin, ValueComparingNonnullRefPtr<StyleValue const> clip) { - return adopt_ref(*new BackgroundStyleValue(move(color), move(image), move(position), move(size), move(repeat), move(attachment), move(origin), move(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))); } virtual ~BackgroundStyleValue() override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/BorderRadiusShorthandStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/BorderRadiusShorthandStyleValue.h index 504f455a0e..ee76105b66 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<BorderRadiusShorthandStyleValue> { public: - static ValueComparingNonnullRefPtr<BorderRadiusShorthandStyleValue> create( + static ErrorOr<ValueComparingNonnullRefPtr<BorderRadiusShorthandStyleValue>> create( ValueComparingNonnullRefPtr<BorderRadiusStyleValue const> top_left, ValueComparingNonnullRefPtr<BorderRadiusStyleValue const> top_right, ValueComparingNonnullRefPtr<BorderRadiusStyleValue const> bottom_right, ValueComparingNonnullRefPtr<BorderRadiusStyleValue const> bottom_left) { - return adopt_ref(*new BorderRadiusShorthandStyleValue(move(top_left), move(top_right), move(bottom_right), move(bottom_left))); + return adopt_nonnull_ref_or_enomem(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.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/BorderRadiusStyleValue.cpp index 0ade945a95..1a06acc9de 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/BorderRadiusStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/BorderRadiusStyleValue.cpp @@ -28,7 +28,7 @@ ValueComparingNonnullRefPtr<StyleValue const> BorderRadiusStyleValue::absolutize absolutized_horizontal_radius = m_properties.horizontal_radius.length().absolutized(viewport_rect, font_metrics, root_font_metrics); if (!m_properties.vertical_radius.is_percentage()) absolutized_vertical_radius = m_properties.vertical_radius.length().absolutized(viewport_rect, font_metrics, root_font_metrics); - return BorderRadiusStyleValue::create(absolutized_horizontal_radius, absolutized_vertical_radius); + return BorderRadiusStyleValue::create(absolutized_horizontal_radius, absolutized_vertical_radius).release_value_but_fixme_should_propagate_errors(); } } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/BorderRadiusStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/BorderRadiusStyleValue.h index 85ccc0aa39..2287390ed5 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<BorderRadiusStyleValue> { public: - static ValueComparingNonnullRefPtr<BorderRadiusStyleValue> create(LengthPercentage const& horizontal_radius, LengthPercentage const& vertical_radius) + static ErrorOr<ValueComparingNonnullRefPtr<BorderRadiusStyleValue>> create(LengthPercentage const& horizontal_radius, LengthPercentage const& vertical_radius) { - return adopt_ref(*new BorderRadiusStyleValue(horizontal_radius, vertical_radius)); + return adopt_nonnull_ref_or_enomem(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 1a5e035996..fffb42a633 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<BorderStyleValue> { public: - static ValueComparingNonnullRefPtr<BorderStyleValue> create( + static ErrorOr<ValueComparingNonnullRefPtr<BorderStyleValue>> create( ValueComparingNonnullRefPtr<StyleValue> border_width, ValueComparingNonnullRefPtr<StyleValue> border_style, ValueComparingNonnullRefPtr<StyleValue> border_color) { - return adopt_ref(*new BorderStyleValue(move(border_width), move(border_style), move(border_color))); + return adopt_nonnull_ref_or_enomem(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 11b601ee5a..b7cb9cb232 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h @@ -64,9 +64,9 @@ public: Value m_value; }; - static ValueComparingNonnullRefPtr<CalculatedStyleValue> create(NonnullOwnPtr<CalculationNode> calculation, ResolvedType resolved_type) + static ErrorOr<ValueComparingNonnullRefPtr<CalculatedStyleValue>> create(NonnullOwnPtr<CalculationNode> calculation, ResolvedType resolved_type) { - return adopt_ref(*new CalculatedStyleValue(move(calculation), resolved_type)); + return adopt_nonnull_ref_or_enomem(new (nothrow) CalculatedStyleValue(move(calculation), resolved_type)); } ErrorOr<String> to_string() const override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ColorStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/ColorStyleValue.cpp index 180adcc922..c4de19cca2 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ColorStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ColorStyleValue.cpp @@ -12,24 +12,24 @@ namespace Web::CSS { -ValueComparingNonnullRefPtr<ColorStyleValue> ColorStyleValue::create(Color color) +ErrorOr<ValueComparingNonnullRefPtr<ColorStyleValue>> ColorStyleValue::create(Color color) { if (color.value() == 0) { - static auto transparent = adopt_ref(*new ColorStyleValue(color)); + static auto transparent = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ColorStyleValue(color))); return transparent; } if (color == Color::from_rgb(0x000000)) { - static auto black = adopt_ref(*new ColorStyleValue(color)); + static auto black = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ColorStyleValue(color))); return black; } if (color == Color::from_rgb(0xffffff)) { - static auto white = adopt_ref(*new ColorStyleValue(color)); + static auto white = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ColorStyleValue(color))); return white; } - return adopt_ref(*new ColorStyleValue(color)); + return adopt_nonnull_ref_or_enomem(new (nothrow) ColorStyleValue(color)); } ErrorOr<String> ColorStyleValue::to_string() const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ColorStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/ColorStyleValue.h index 3e1c83c8b0..50a623f059 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<ColorStyleValue> { public: - static ValueComparingNonnullRefPtr<ColorStyleValue> create(Color color); + static ErrorOr<ValueComparingNonnullRefPtr<ColorStyleValue>> create(Color color); virtual ~ColorStyleValue() override = default; Color color() const { return m_color; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ConicGradientStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/ConicGradientStyleValue.h index 5223e78ff4..7b40ffcae1 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 ValueComparingNonnullRefPtr<ConicGradientStyleValue> create(Angle from_angle, PositionValue position, Vector<AngularColorStopListElement> color_stop_list, GradientRepeating repeating) + static ErrorOr<ValueComparingNonnullRefPtr<ConicGradientStyleValue>> create(Angle from_angle, PositionValue position, Vector<AngularColorStopListElement> color_stop_list, GradientRepeating repeating) { VERIFY(color_stop_list.size() >= 2); - return adopt_ref(*new ConicGradientStyleValue(from_angle, position, move(color_stop_list), repeating)); + return adopt_nonnull_ref_or_enomem(new (nothrow) ConicGradientStyleValue(from_angle, position, move(color_stop_list), repeating)); } virtual ErrorOr<String> to_string() const override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ContentStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/ContentStyleValue.h index c628c0b0ee..763fa96232 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<ContentStyleValue> { public: - static ValueComparingNonnullRefPtr<ContentStyleValue> create(ValueComparingNonnullRefPtr<StyleValueList> content, ValueComparingRefPtr<StyleValueList> alt_text) + static ErrorOr<ValueComparingNonnullRefPtr<ContentStyleValue>> create(ValueComparingNonnullRefPtr<StyleValueList> content, ValueComparingRefPtr<StyleValueList> alt_text) { - return adopt_ref(*new ContentStyleValue(move(content), move(alt_text))); + return adopt_nonnull_ref_or_enomem(new (nothrow) ContentStyleValue(move(content), move(alt_text))); } virtual ~ContentStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/DisplayStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/DisplayStyleValue.cpp index 2214855244..da78f1e030 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/DisplayStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/DisplayStyleValue.cpp @@ -8,9 +8,9 @@ namespace Web::CSS { -ValueComparingNonnullRefPtr<DisplayStyleValue> DisplayStyleValue::create(Display const& display) +ErrorOr<ValueComparingNonnullRefPtr<DisplayStyleValue>> DisplayStyleValue::create(Display const& display) { - return adopt_ref(*new DisplayStyleValue(display)); + return adopt_nonnull_ref_or_enomem(new (nothrow) DisplayStyleValue(display)); } } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/DisplayStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/DisplayStyleValue.h index 474af6a20c..856008bdcf 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<DisplayStyleValue> { public: - static ValueComparingNonnullRefPtr<DisplayStyleValue> create(Display const&); + static ErrorOr<ValueComparingNonnullRefPtr<DisplayStyleValue>> create(Display const&); virtual ~DisplayStyleValue() override = default; virtual ErrorOr<String> to_string() const override { return m_display.to_string(); } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/EdgeStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/EdgeStyleValue.h index ca23e9174d..af5c10e4a3 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<EdgeStyleValue> { public: - static ValueComparingNonnullRefPtr<EdgeStyleValue> create(PositionEdge edge, LengthPercentage const& offset) + static ErrorOr<ValueComparingNonnullRefPtr<EdgeStyleValue>> create(PositionEdge edge, LengthPercentage const& offset) { - return adopt_ref(*new EdgeStyleValue(edge, offset)); + return adopt_nonnull_ref_or_enomem(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 b93ba81265..5c4257d4ee 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.h @@ -70,11 +70,11 @@ using FilterFunction = Variant<Filter::Blur, Filter::DropShadow, Filter::HueRota class FilterValueListStyleValue final : public StyleValueWithDefaultOperators<FilterValueListStyleValue> { public: - static ValueComparingNonnullRefPtr<FilterValueListStyleValue> create( + static ErrorOr<ValueComparingNonnullRefPtr<FilterValueListStyleValue>> create( Vector<FilterFunction> filter_value_list) { VERIFY(filter_value_list.size() >= 1); - return adopt_ref(*new FilterValueListStyleValue(move(filter_value_list))); + return adopt_nonnull_ref_or_enomem(new (nothrow) FilterValueListStyleValue(move(filter_value_list))); } Vector<FilterFunction> 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 18dc960664..3f5e7dea6f 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<FlexFlowStyleValue> { public: - static ValueComparingNonnullRefPtr<FlexFlowStyleValue> create(ValueComparingNonnullRefPtr<StyleValue> flex_direction, ValueComparingNonnullRefPtr<StyleValue> flex_wrap) + static ErrorOr<ValueComparingNonnullRefPtr<FlexFlowStyleValue>> create(ValueComparingNonnullRefPtr<StyleValue> flex_direction, ValueComparingNonnullRefPtr<StyleValue> flex_wrap) { - return adopt_ref(*new FlexFlowStyleValue(move(flex_direction), move(flex_wrap))); + return adopt_nonnull_ref_or_enomem(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 18c8591060..4059dfe3b2 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<FlexStyleValue> { public: - static ValueComparingNonnullRefPtr<FlexStyleValue> create( + static ErrorOr<ValueComparingNonnullRefPtr<FlexStyleValue>> create( ValueComparingNonnullRefPtr<StyleValue> grow, ValueComparingNonnullRefPtr<StyleValue> shrink, ValueComparingNonnullRefPtr<StyleValue> basis) { - return adopt_ref(*new FlexStyleValue(move(grow), move(shrink), move(basis))); + return adopt_nonnull_ref_or_enomem(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 024463f74b..94f7470ccd 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/FontStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/FontStyleValue.h @@ -15,9 +15,15 @@ namespace Web::CSS { class FontStyleValue final : public StyleValueWithDefaultOperators<FontStyleValue> { public: - static ValueComparingNonnullRefPtr<FontStyleValue> create(ValueComparingNonnullRefPtr<StyleValue> font_stretch, ValueComparingNonnullRefPtr<StyleValue> font_style, ValueComparingNonnullRefPtr<StyleValue> font_weight, ValueComparingNonnullRefPtr<StyleValue> font_size, ValueComparingNonnullRefPtr<StyleValue> line_height, ValueComparingNonnullRefPtr<StyleValue> font_families) + static ErrorOr<ValueComparingNonnullRefPtr<FontStyleValue>> create( + ValueComparingNonnullRefPtr<StyleValue> font_stretch, + ValueComparingNonnullRefPtr<StyleValue> font_style, + ValueComparingNonnullRefPtr<StyleValue> font_weight, + ValueComparingNonnullRefPtr<StyleValue> font_size, + ValueComparingNonnullRefPtr<StyleValue> line_height, + ValueComparingNonnullRefPtr<StyleValue> font_families) { - return adopt_ref(*new FontStyleValue(move(font_stretch), move(font_style), move(font_weight), move(font_size), move(line_height), move(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))); } virtual ~FontStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/FrequencyStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/FrequencyStyleValue.h index 37fd341486..fb05ba069c 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<FrequencyStyleValue> { public: - static ValueComparingNonnullRefPtr<FrequencyStyleValue> create(Frequency frequency) + static ErrorOr<ValueComparingNonnullRefPtr<FrequencyStyleValue>> create(Frequency frequency) { - return adopt_ref(*new FrequencyStyleValue(move(frequency))); + return adopt_nonnull_ref_or_enomem(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 863067a51c..6713fcc9a7 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.cpp @@ -12,18 +12,22 @@ namespace Web::CSS { -ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue> GridAreaShorthandStyleValue::create( +ErrorOr<ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue>> GridAreaShorthandStyleValue::create( ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> column_start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_end, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> column_end) { - return adopt_ref(*new GridAreaShorthandStyleValue(row_start, column_start, row_end, column_end)); + return adopt_nonnull_ref_or_enomem(new (nothrow) GridAreaShorthandStyleValue(row_start, column_start, row_end, column_end)); } -ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue> GridAreaShorthandStyleValue::create(GridTrackPlacement row_start, GridTrackPlacement column_start, GridTrackPlacement row_end, GridTrackPlacement column_end) +ErrorOr<ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue>> GridAreaShorthandStyleValue::create(GridTrackPlacement row_start, GridTrackPlacement column_start, GridTrackPlacement row_end, GridTrackPlacement column_end) { - return adopt_ref(*new GridAreaShorthandStyleValue(GridTrackPlacementStyleValue::create(row_start), GridTrackPlacementStyleValue::create(column_start), GridTrackPlacementStyleValue::create(row_end), GridTrackPlacementStyleValue::create(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)))); } ErrorOr<String> GridAreaShorthandStyleValue::to_string() const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/GridAreaShorthandStyleValue.h index 9f63da82ff..c22d6f7217 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<GridAreaShorthandStyleValue> { public: - static ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue> create( + static ErrorOr<ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue>> create( ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> column_start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_end, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> column_end); - static ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue> create(GridTrackPlacement row_start, GridTrackPlacement column_start, GridTrackPlacement row_end, GridTrackPlacement column_end); + static ErrorOr<ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue>> 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 4177bef427..a12b171abc 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.cpp @@ -11,9 +11,9 @@ namespace Web::CSS { -ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue> GridTemplateAreaStyleValue::create(Vector<Vector<String>> grid_template_area) +ErrorOr<ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue>> GridTemplateAreaStyleValue::create(Vector<Vector<String>> grid_template_area) { - return adopt_ref(*new GridTemplateAreaStyleValue(grid_template_area)); + return adopt_nonnull_ref_or_enomem(new (nothrow) GridTemplateAreaStyleValue(grid_template_area)); } ErrorOr<String> GridTemplateAreaStyleValue::to_string() const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTemplateAreaStyleValue.h index 75dfbcca83..2b72dca462 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<GridTemplateAreaStyleValue> { public: - static ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue> create(Vector<Vector<String>> grid_template_area); + static ErrorOr<ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue>> create(Vector<Vector<String>> grid_template_area); virtual ~GridTemplateAreaStyleValue() override = default; Vector<Vector<String>> 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 52e7713fc4..babb00ff02 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.cpp @@ -12,14 +12,16 @@ namespace Web::CSS { -ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue> GridTrackPlacementShorthandStyleValue::create(ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> end) +ErrorOr<ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue>> GridTrackPlacementShorthandStyleValue::create(ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> end) { - return adopt_ref(*new GridTrackPlacementShorthandStyleValue(move(start), move(end))); + return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackPlacementShorthandStyleValue(move(start), move(end))); } -ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue> GridTrackPlacementShorthandStyleValue::create(GridTrackPlacement start) +ErrorOr<ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue>> GridTrackPlacementShorthandStyleValue::create(GridTrackPlacement start) { - return adopt_ref(*new GridTrackPlacementShorthandStyleValue(GridTrackPlacementStyleValue::create(start), GridTrackPlacementStyleValue::create(GridTrackPlacement::make_auto()))); + return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackPlacementShorthandStyleValue( + TRY(GridTrackPlacementStyleValue::create(start)), + TRY(GridTrackPlacementStyleValue::create(GridTrackPlacement::make_auto())))); } ErrorOr<String> GridTrackPlacementShorthandStyleValue::to_string() const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementShorthandStyleValue.h index c9345eaa91..2d327a5661 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<GridTrackPlacementShorthandStyleValue> { public: - static ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue> create(ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> end); - static ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue> create(GridTrackPlacement start); + static ErrorOr<ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue>> create(ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> end); + static ErrorOr<ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue>> 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 ea5f8461f2..4ff810dc00 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.cpp @@ -11,9 +11,9 @@ namespace Web::CSS { -ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue> GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement grid_track_placement) +ErrorOr<ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue>> GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement grid_track_placement) { - return adopt_ref(*new GridTrackPlacementStyleValue(grid_track_placement)); + return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackPlacementStyleValue(grid_track_placement)); } ErrorOr<String> GridTrackPlacementStyleValue::to_string() const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackPlacementStyleValue.h index 743ea62c4f..c931a96332 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<GridTrackPlacementStyleValue> { public: - static ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue> create(GridTrackPlacement grid_track_placement); + static ErrorOr<ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue>> 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 e967b379ef..db83e24c00 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListShorthandStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListShorthandStyleValue.cpp @@ -9,12 +9,12 @@ namespace Web::CSS { -ValueComparingNonnullRefPtr<GridTrackSizeListShorthandStyleValue> GridTrackSizeListShorthandStyleValue::create( +ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListShorthandStyleValue>> GridTrackSizeListShorthandStyleValue::create( ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue const> areas, ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue const> rows, ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue const> columns) { - return adopt_ref(*new GridTrackSizeListShorthandStyleValue(move(areas), move(rows), move(columns))); + return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackSizeListShorthandStyleValue(move(areas), move(rows), move(columns))); } ErrorOr<String> GridTrackSizeListShorthandStyleValue::to_string() const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListShorthandStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListShorthandStyleValue.h index e84348b7f5..fe315bc6a4 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<GridTrackSizeListShorthandStyleValue> { public: - static ValueComparingNonnullRefPtr<GridTrackSizeListShorthandStyleValue> create( + static ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListShorthandStyleValue>> create( ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue const> areas, ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue const> rows, ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue const> columns); diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.cpp index be0cd8962a..d32262e6b0 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.cpp @@ -16,14 +16,14 @@ ErrorOr<String> GridTrackSizeListStyleValue::to_string() const return m_grid_track_size_list.to_string(); } -ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue> GridTrackSizeListStyleValue::create(CSS::GridTrackSizeList grid_track_size_list) +ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue>> GridTrackSizeListStyleValue::create(CSS::GridTrackSizeList grid_track_size_list) { - return adopt_ref(*new GridTrackSizeListStyleValue(grid_track_size_list)); + return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackSizeListStyleValue(grid_track_size_list)); } -ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue> GridTrackSizeListStyleValue::make_auto() +ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue>> GridTrackSizeListStyleValue::make_auto() { - return adopt_ref(*new GridTrackSizeListStyleValue(CSS::GridTrackSizeList())); + return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackSizeListStyleValue(CSS::GridTrackSizeList())); } } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.h index 26ac4c56a1..db0ffe2be7 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/GridTrackSizeListStyleValue.h @@ -16,10 +16,10 @@ namespace Web::CSS { class GridTrackSizeListStyleValue final : public StyleValueWithDefaultOperators<GridTrackSizeListStyleValue> { public: - static ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue> create(CSS::GridTrackSizeList grid_track_size_list); + static ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue>> create(CSS::GridTrackSizeList grid_track_size_list); virtual ~GridTrackSizeListStyleValue() override = default; - static ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue> make_auto(); + static ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue>> make_auto(); 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 9d85aa5aec..a7cc592b59 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<IdentifierStyleValue> { public: - static ValueComparingNonnullRefPtr<IdentifierStyleValue> create(ValueID id) + static ErrorOr<ValueComparingNonnullRefPtr<IdentifierStyleValue>> create(ValueID id) { - return adopt_ref(*new IdentifierStyleValue(id)); + return adopt_nonnull_ref_or_enomem(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 b51d36d387..53c4d89484 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ImageStyleValue.h @@ -20,7 +20,10 @@ class ImageStyleValue final : public AbstractImageStyleValue , public ImageResourceClient { public: - static ValueComparingNonnullRefPtr<ImageStyleValue> create(AK::URL const& url) { return adopt_ref(*new ImageStyleValue(url)); } + static ErrorOr<ValueComparingNonnullRefPtr<ImageStyleValue>> create(AK::URL const& url) + { + return adopt_nonnull_ref_or_enomem(new (nothrow) ImageStyleValue(url)); + } virtual ~ImageStyleValue() override = default; virtual ErrorOr<String> to_string() const override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/InheritStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/InheritStyleValue.h index 8debaae03d..74e5e523c8 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<InheritStyleValue> { public: - static ValueComparingNonnullRefPtr<InheritStyleValue> the() + static ErrorOr<ValueComparingNonnullRefPtr<InheritStyleValue>> the() { - static ValueComparingNonnullRefPtr<InheritStyleValue> instance = adopt_ref(*new InheritStyleValue); + static ValueComparingNonnullRefPtr<InheritStyleValue> instance = TRY(adopt_nonnull_ref_or_enomem(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 d26089e8d3..6457a6ea72 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<InitialStyleValue> { public: - static ValueComparingNonnullRefPtr<InitialStyleValue> the() + static ErrorOr<ValueComparingNonnullRefPtr<InitialStyleValue>> the() { - static ValueComparingNonnullRefPtr<InitialStyleValue> instance = adopt_ref(*new InitialStyleValue); + static ValueComparingNonnullRefPtr<InitialStyleValue> instance = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) InitialStyleValue)); return instance; } virtual ~InitialStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/LengthStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/LengthStyleValue.cpp index 0ae4990c92..0442a4913f 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/LengthStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/LengthStyleValue.cpp @@ -11,26 +11,26 @@ namespace Web::CSS { -ValueComparingNonnullRefPtr<LengthStyleValue> LengthStyleValue::create(Length const& length) +ErrorOr<ValueComparingNonnullRefPtr<LengthStyleValue>> LengthStyleValue::create(Length const& length) { VERIFY(!length.is_auto()); if (length.is_px()) { if (length.raw_value() == 0) { - static auto value = adopt_ref(*new LengthStyleValue(CSS::Length::make_px(0))); + static auto value = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) LengthStyleValue(CSS::Length::make_px(0)))); return value; } if (length.raw_value() == 1) { - static auto value = adopt_ref(*new LengthStyleValue(CSS::Length::make_px(1))); + static auto value = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) LengthStyleValue(CSS::Length::make_px(1)))); return value; } } - return adopt_ref(*new LengthStyleValue(length)); + return adopt_nonnull_ref_or_enomem(new (nothrow) LengthStyleValue(length)); } ValueComparingNonnullRefPtr<StyleValue const> LengthStyleValue::absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const { if (auto length = m_length.absolutize(viewport_rect, font_metrics, root_font_metrics); length.has_value()) - return LengthStyleValue::create(length.release_value()); + return LengthStyleValue::create(length.release_value()).release_value_but_fixme_should_propagate_errors(); return *this; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/LengthStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/LengthStyleValue.h index e100f349e3..8fa8e3d54f 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<LengthStyleValue> { public: - static ValueComparingNonnullRefPtr<LengthStyleValue> create(Length const&); + static ErrorOr<ValueComparingNonnullRefPtr<LengthStyleValue>> 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 218b8bb3d4..4e1f2de70c 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/LinearGradientStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/LinearGradientStyleValue.h @@ -38,10 +38,10 @@ public: WebKit }; - static ValueComparingNonnullRefPtr<LinearGradientStyleValue> create(GradientDirection direction, Vector<LinearColorStopListElement> color_stop_list, GradientType type, GradientRepeating repeating) + static ErrorOr<ValueComparingNonnullRefPtr<LinearGradientStyleValue>> create(GradientDirection direction, Vector<LinearColorStopListElement> color_stop_list, GradientType type, GradientRepeating repeating) { VERIFY(color_stop_list.size() >= 2); - return adopt_ref(*new LinearGradientStyleValue(direction, move(color_stop_list), type, repeating)); + return adopt_nonnull_ref_or_enomem(new (nothrow) LinearGradientStyleValue(direction, move(color_stop_list), type, repeating)); } virtual ErrorOr<String> to_string() const override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ListStyleStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/ListStyleStyleValue.h index 7fca0868c3..a6d6d5dbfd 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<ListStyleStyleValue> { public: - static ValueComparingNonnullRefPtr<ListStyleStyleValue> create( + static ErrorOr<ValueComparingNonnullRefPtr<ListStyleStyleValue>> create( ValueComparingNonnullRefPtr<StyleValue> position, ValueComparingNonnullRefPtr<StyleValue> image, ValueComparingNonnullRefPtr<StyleValue> style_type) { - return adopt_ref(*new ListStyleStyleValue(move(position), move(image), move(style_type))); + return adopt_nonnull_ref_or_enomem(new (nothrow) ListStyleStyleValue(move(position), move(image), move(style_type))); } virtual ~ListStyleStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/NumericStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/NumericStyleValue.h index 268b91eddc..59e6b86063 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/NumericStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/NumericStyleValue.h @@ -15,14 +15,14 @@ namespace Web::CSS { class NumericStyleValue : public StyleValueWithDefaultOperators<NumericStyleValue> { public: - static ValueComparingNonnullRefPtr<NumericStyleValue> create_float(float value) + static ErrorOr<ValueComparingNonnullRefPtr<NumericStyleValue>> create_float(float value) { - return adopt_ref(*new NumericStyleValue(value)); + return adopt_nonnull_ref_or_enomem(new (nothrow) NumericStyleValue(value)); } - static ValueComparingNonnullRefPtr<NumericStyleValue> create_integer(i64 value) + static ErrorOr<ValueComparingNonnullRefPtr<NumericStyleValue>> create_integer(i64 value) { - return adopt_ref(*new NumericStyleValue(value)); + return adopt_nonnull_ref_or_enomem(new (nothrow) NumericStyleValue(value)); } virtual bool has_length() const override { return to_number() == 0; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/OverflowStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/OverflowStyleValue.h index d7f2540eaa..9dae744d05 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<OverflowStyleValue> { public: - static ValueComparingNonnullRefPtr<OverflowStyleValue> create(ValueComparingNonnullRefPtr<StyleValue> overflow_x, ValueComparingNonnullRefPtr<StyleValue> overflow_y) + static ErrorOr<ValueComparingNonnullRefPtr<OverflowStyleValue>> create(ValueComparingNonnullRefPtr<StyleValue> overflow_x, ValueComparingNonnullRefPtr<StyleValue> overflow_y) { - return adopt_ref(*new OverflowStyleValue(move(overflow_x), move(overflow_y))); + return adopt_nonnull_ref_or_enomem(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 e1af6a9ca0..5ad055a3c5 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<PercentageStyleValue> { public: - static ValueComparingNonnullRefPtr<PercentageStyleValue> create(Percentage percentage) + static ErrorOr<ValueComparingNonnullRefPtr<PercentageStyleValue>> create(Percentage percentage) { - return adopt_ref(*new PercentageStyleValue(move(percentage))); + return adopt_nonnull_ref_or_enomem(new (nothrow) PercentageStyleValue(move(percentage))); } virtual ~PercentageStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/PositionStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/PositionStyleValue.h index 028a75d079..05bd39f391 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<PositionStyleValue> { public: - static ValueComparingNonnullRefPtr<PositionStyleValue> create(ValueComparingNonnullRefPtr<StyleValue> egde_x, ValueComparingNonnullRefPtr<StyleValue> edge_y) + static ErrorOr<ValueComparingNonnullRefPtr<PositionStyleValue>> create(ValueComparingNonnullRefPtr<StyleValue> egde_x, ValueComparingNonnullRefPtr<StyleValue> edge_y) { - return adopt_ref(*new PositionStyleValue(move(egde_x), move(edge_y))); + return adopt_nonnull_ref_or_enomem(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 aae9e8c864..96aec112a1 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<Extent, CircleSize, EllipseSize>; - static ValueComparingNonnullRefPtr<RadialGradientStyleValue> create(EndingShape ending_shape, Size size, PositionValue position, Vector<LinearColorStopListElement> color_stop_list, GradientRepeating repeating) + static ErrorOr<ValueComparingNonnullRefPtr<RadialGradientStyleValue>> create(EndingShape ending_shape, Size size, PositionValue position, Vector<LinearColorStopListElement> color_stop_list, GradientRepeating repeating) { VERIFY(color_stop_list.size() >= 2); - return adopt_ref(*new RadialGradientStyleValue(ending_shape, size, position, move(color_stop_list), repeating)); + return adopt_nonnull_ref_or_enomem(new (nothrow) RadialGradientStyleValue(ending_shape, size, position, move(color_stop_list), repeating)); } virtual ErrorOr<String> to_string() const override; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.cpp index 3282f056ab..d2d88ebb33 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.cpp @@ -11,9 +11,9 @@ namespace Web::CSS { -ValueComparingNonnullRefPtr<RectStyleValue> RectStyleValue::create(EdgeRect rect) +ErrorOr<ValueComparingNonnullRefPtr<RectStyleValue>> RectStyleValue::create(EdgeRect rect) { - return adopt_ref(*new RectStyleValue(rect)); + return adopt_nonnull_ref_or_enomem(new (nothrow) RectStyleValue(move(rect))); } ErrorOr<String> RectStyleValue::to_string() const diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/RectStyleValue.h index 645013079c..488b1820c1 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<RectStyleValue> { public: - static ValueComparingNonnullRefPtr<RectStyleValue> create(EdgeRect rect); + static ErrorOr<ValueComparingNonnullRefPtr<RectStyleValue>> create(EdgeRect rect); virtual ~RectStyleValue() override = default; EdgeRect rect() const { return m_rect; } @@ -28,7 +28,7 @@ public: private: explicit RectStyleValue(EdgeRect rect) : StyleValueWithDefaultOperators(Type::Rect) - , m_rect(rect) + , m_rect(move(rect)) { } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ResolutionStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/ResolutionStyleValue.h index f609db9176..172e67be0f 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<ResolutionStyleValue> { public: - static ValueComparingNonnullRefPtr<ResolutionStyleValue> create(Resolution resolution) + static ErrorOr<ValueComparingNonnullRefPtr<ResolutionStyleValue>> create(Resolution resolution) { - return adopt_ref(*new ResolutionStyleValue(move(resolution))); + return adopt_nonnull_ref_or_enomem(new (nothrow) ResolutionStyleValue(move(resolution))); } virtual ~ResolutionStyleValue() override = default; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.cpp index 1b75767c2f..a6ccadf9eb 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.cpp @@ -26,7 +26,7 @@ ValueComparingNonnullRefPtr<StyleValue const> ShadowStyleValue::absolutized(CSSP auto absolutized_offset_y = m_properties.offset_y.absolutized(viewport_rect, font_metrics, root_font_metrics); auto absolutized_blur_radius = m_properties.blur_radius.absolutized(viewport_rect, font_metrics, root_font_metrics); auto absolutized_spread_distance = m_properties.spread_distance.absolutized(viewport_rect, font_metrics, root_font_metrics); - return ShadowStyleValue::create(m_properties.color, absolutized_offset_x, absolutized_offset_y, absolutized_blur_radius, absolutized_spread_distance, m_properties.placement); + return ShadowStyleValue::create(m_properties.color, absolutized_offset_x, absolutized_offset_y, absolutized_blur_radius, absolutized_spread_distance, m_properties.placement).release_value_but_fixme_should_propagate_errors(); } } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.h index 3f1afae91b..e934e82490 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/ShadowStyleValue.h @@ -22,9 +22,9 @@ enum class ShadowPlacement { class ShadowStyleValue final : public StyleValueWithDefaultOperators<ShadowStyleValue> { public: - static ValueComparingNonnullRefPtr<ShadowStyleValue> create(Color color, Length const& offset_x, Length const& offset_y, Length const& blur_radius, Length const& spread_distance, ShadowPlacement placement) + static ErrorOr<ValueComparingNonnullRefPtr<ShadowStyleValue>> create(Color color, Length const& offset_x, Length const& offset_y, Length const& blur_radius, Length const& spread_distance, ShadowPlacement placement) { - return adopt_ref(*new ShadowStyleValue(color, offset_x, offset_y, blur_radius, spread_distance, placement)); + return adopt_nonnull_ref_or_enomem(new (nothrow) ShadowStyleValue(color, offset_x, offset_y, blur_radius, 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 0650fa4e4a..13b23b60cd 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<StringStyleValue> { public: - static ValueComparingNonnullRefPtr<StringStyleValue> create(String const& string) + static ErrorOr<ValueComparingNonnullRefPtr<StringStyleValue>> create(String const& string) { - return adopt_ref(*new StringStyleValue(string)); + return adopt_nonnull_ref_or_enomem(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 1ab22f6a7f..c2e76a527e 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/StyleValueList.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/StyleValueList.h @@ -19,7 +19,10 @@ public: Space, Comma, }; - static ValueComparingNonnullRefPtr<StyleValueList> create(StyleValueVector&& values, Separator separator) { return adopt_ref(*new StyleValueList(move(values), separator)); } + static ErrorOr<ValueComparingNonnullRefPtr<StyleValueList>> create(StyleValueVector&& values, Separator separator) + { + return adopt_nonnull_ref_or_enomem(new (nothrow) StyleValueList(move(values), separator)); + } size_t size() const { return m_properties.values.size(); } StyleValueVector const& values() const { return m_properties.values; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/TextDecorationStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/TextDecorationStyleValue.h index b3a6ace4bc..89c31d5296 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<TextDecorationStyleValue> { public: - static ValueComparingNonnullRefPtr<TextDecorationStyleValue> create( + static ErrorOr<ValueComparingNonnullRefPtr<TextDecorationStyleValue>> create( ValueComparingNonnullRefPtr<StyleValue> line, ValueComparingNonnullRefPtr<StyleValue> thickness, ValueComparingNonnullRefPtr<StyleValue> style, ValueComparingNonnullRefPtr<StyleValue> color) { - return adopt_ref(*new TextDecorationStyleValue(move(line), move(thickness), move(style), move(color))); + return adopt_nonnull_ref_or_enomem(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 8cc83ad118..fd60795191 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<TimeStyleValue> { public: - static ValueComparingNonnullRefPtr<TimeStyleValue> create(Time time) + static ErrorOr<ValueComparingNonnullRefPtr<TimeStyleValue>> create(Time time) { - return adopt_ref(*new TimeStyleValue(move(time))); + return adopt_nonnull_ref_or_enomem(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 c7986a7df9..68bfbfba37 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<TransformationStyleValue> { public: - static ValueComparingNonnullRefPtr<TransformationStyleValue> create(CSS::TransformFunction transform_function, StyleValueVector&& values) + static ErrorOr<ValueComparingNonnullRefPtr<TransformationStyleValue>> create(CSS::TransformFunction transform_function, StyleValueVector&& values) { - return adopt_ref(*new TransformationStyleValue(transform_function, move(values))); + return adopt_nonnull_ref_or_enomem(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 e0c3766344..dc25d8a5b8 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<URLStyleValue> { public: - static ValueComparingNonnullRefPtr<URLStyleValue> create(AK::URL const& url) + static ErrorOr<ValueComparingNonnullRefPtr<URLStyleValue>> create(AK::URL const& url) { - return adopt_ref(*new URLStyleValue(url)); + return adopt_nonnull_ref_or_enomem(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 4fa6e1cf08..03aa437319 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 ValueComparingNonnullRefPtr<UnresolvedStyleValue> create(Vector<Parser::ComponentValue>&& values, bool contains_var_or_attr) + static ErrorOr<ValueComparingNonnullRefPtr<UnresolvedStyleValue>> create(Vector<Parser::ComponentValue>&& values, bool contains_var_or_attr) { - return adopt_ref(*new UnresolvedStyleValue(move(values), contains_var_or_attr)); + return adopt_nonnull_ref_or_enomem(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 28aba45ff3..2d527f72ce 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<UnsetStyleValue> { public: - static ValueComparingNonnullRefPtr<UnsetStyleValue> the() + static ErrorOr<ValueComparingNonnullRefPtr<UnsetStyleValue>> the() { - static ValueComparingNonnullRefPtr<UnsetStyleValue> instance = adopt_ref(*new UnsetStyleValue); + static ValueComparingNonnullRefPtr<UnsetStyleValue> instance = TRY(adopt_nonnull_ref_or_enomem(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 8d9582eb03..af3878235f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp @@ -34,11 +34,11 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co if (name.equals_ignoring_ascii_case("bgcolor"sv)) { auto color = Color::from_string(value); if (color.has_value()) - style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value())); + style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors()); } else if (name.equals_ignoring_ascii_case("text"sv)) { auto color = Color::from_string(value); if (color.has_value()) - style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value())); + style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors()); } else if (name.equals_ignoring_ascii_case("background"sv)) { VERIFY(m_background_style_value); style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value); @@ -62,7 +62,7 @@ void HTMLBodyElement::parse_attribute(DeprecatedFlyString const& name, Deprecate 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)); + m_background_style_value = CSS::ImageStyleValue::create(document().parse_url(value)).release_value_but_fixme_should_propagate_errors(); m_background_style_value->on_animate = [this] { if (layout_node()) { layout_node()->set_needs_display(); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp index 3d16e37e1d..9eefb37610 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 if (name.equals_ignoring_ascii_case("color"sv)) { auto color = Color::from_string(value); if (color.has_value()) - style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value())); + style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors()); } }); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp index 43726420fe..ce132ae7c9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp @@ -32,13 +32,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)); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Left).release_value_but_fixme_should_propagate_errors()); else if (value == "right"sv) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Right)); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Right).release_value_but_fixme_should_propagate_errors()); else if (value == "center"sv) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Center)); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Center).release_value_but_fixme_should_propagate_errors()); else if (value == "justify"sv) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify)); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify).release_value_but_fixme_should_propagate_errors()); } }); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 0e20666d64..7cc0d5ba35 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -78,7 +78,7 @@ JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS:: // AD-HOC: We rewrite `display: inline` to `display: inline-block`. // This is required for the internal shadow tree to work correctly in layout. if (style->display().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))); + style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::InlineBlock)).release_value_but_fixme_should_propagate_errors()); 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 f102be7a6e..6c7ff94696 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp @@ -32,7 +32,7 @@ void HTMLMarqueeElement::apply_presentational_hints(CSS::StyleProperties& style) if (name == HTML::AttributeNames::bgcolor) { auto color = Color::from_string(value); if (color.has_value()) - style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value())); + style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors()); } }); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp index d484027d62..3c1e3ae52a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp @@ -32,13 +32,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)); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Left).release_value_but_fixme_should_propagate_errors()); else if (value == "right"sv) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Right)); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Right).release_value_but_fixme_should_propagate_errors()); else if (value == "center"sv) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Center)); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Center).release_value_but_fixme_should_propagate_errors()); else if (value == "justify"sv) - style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify)); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify).release_value_but_fixme_should_propagate_errors()); } }); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp index 916b36087d..89770cb3bd 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp @@ -31,7 +31,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)); + style.set_property(CSS::PropertyID::WhiteSpace, CSS::IdentifierStyleValue::create(CSS::ValueID::PreWrap).release_value_but_fixme_should_propagate_errors()); }); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp index 0b393f9e35..022e22089a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp @@ -32,7 +32,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)); + style.set_property(CSS::PropertyID::CaptionSide, CSS::IdentifierStyleValue::create(CSS::ValueID::Bottom).release_value_but_fixme_should_propagate_errors()); } }); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp index df6b0bde96..9be2a2729b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp @@ -34,12 +34,12 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl if (name == HTML::AttributeNames::bgcolor) { auto color = Color::from_string(value); if (color.has_value()) - style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value())); + style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors()); return; } 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)); + style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebCenter).release_value_but_fixme_should_propagate_errors()); } else { if (auto parsed_value = parse_css_value(CSS::Parser::ParsingContext { document() }, value.view(), CSS::PropertyID::TextAlign)) style.set_property(CSS::PropertyID::TextAlign, parsed_value.release_nonnull()); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp index 417fd6f0e8..f26458ccfc 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 if (name == HTML::AttributeNames::bgcolor) { auto color = Color::from_string(value); if (color.has_value()) - style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value())); + style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors()); return; } }); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp index c4b5b6eba6..ce93fc463d 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp @@ -3830,14 +3830,14 @@ static RefPtr<CSS::StyleValue> parse_current_dimension_value(float value, Utf8Vi { // 1. If position is past the end of input, then return value as a length. if (position == input.end()) - return CSS::LengthStyleValue::create(CSS::Length::make_px(value)); + return CSS::LengthStyleValue::create(CSS::Length::make_px(value)).release_value_but_fixme_should_propagate_errors(); // 2. If the code point at position within input is U+0025 (%), then return value as a percentage. if (*position == '%') - return CSS::PercentageStyleValue::create(CSS::Percentage(value)); + return CSS::PercentageStyleValue::create(CSS::Percentage(value)).release_value_but_fixme_should_propagate_errors(); // 3. Return value as a length. - return CSS::LengthStyleValue::create(CSS::Length::make_px(value)); + return CSS::LengthStyleValue::create(CSS::Length::make_px(value)).release_value_but_fixme_should_propagate_errors(); } // https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-dimension-values @@ -3871,7 +3871,7 @@ RefPtr<CSS::StyleValue> parse_dimension_value(StringView string) // 6. If position is past the end of input, then return value as a length. if (position == input.end()) - return CSS::LengthStyleValue::create(CSS::Length::make_px(*integer_value)); + return CSS::LengthStyleValue::create(CSS::Length::make_px(*integer_value)).release_value_but_fixme_should_propagate_errors(); float value = *integer_value; @@ -3902,7 +3902,7 @@ RefPtr<CSS::StyleValue> parse_dimension_value(StringView string) // 4. If position is past the end of input, then return value as a length. if (position == input.end()) - return CSS::LengthStyleValue::create(CSS::Length::make_px(value)); + return CSS::LengthStyleValue::create(CSS::Length::make_px(value)).release_value_but_fixme_should_propagate_errors(); // 5. If the code point at position within input is not an ASCII digit, then break. if (!is_ascii_digit(*position)) diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp index 88b57ef8c1..77a86795a7 100644 --- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp @@ -293,11 +293,11 @@ ErrorOr<void> TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder:: auto& progress = static_cast<HTML::HTMLProgressElement&>(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))); + 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()); 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))); + 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()); auto position = progress.position(); - value_style->set_property(CSS::PropertyID::Width, CSS::PercentageStyleValue::create(CSS::Percentage(position >= 0 ? round_to<int>(100 * position) : 0))); + value_style->set_property(CSS::PropertyID::Width, CSS::PercentageStyleValue::create(CSS::Percentage(position >= 0 ? round_to<int>(100 * position) : 0)).release_value_but_fixme_should_propagate_errors()); 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 956610d6b4..c9a037876c 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -338,7 +338,7 @@ Gfx::FloatMatrix4x4 StackingContext::get_transformation_matrix(CSS::Transformati return Gfx::rotation_matrix({ 0.0f, 0.0f, 1.0f }, value(0)); break; default: - dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Unhandled transformation function {}", CSS::TransformationStyleValue::create(transformation.function, {})->to_string()); + dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Unhandled transformation function {}", MUST(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 1bf9adfb17..b44a78e2f0 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp @@ -54,7 +54,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 })); + style.set_property(CSS::PropertyID::Width, CSS::PercentageStyleValue::create(CSS::Percentage { 100 }).release_value_but_fixme_should_propagate_errors()); } // Height defaults to 100% @@ -65,7 +65,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 })); + style.set_property(CSS::PropertyID::Height, CSS::PercentageStyleValue::create(CSS::Percentage { 100 }).release_value_but_fixme_should_propagate_errors()); } } |