1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:27:35 +00:00

LibWeb: Propagate errors from StyleValue construction

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

View file

@ -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); auto url = parse_url_function(component_value, allowed_data_url_type);
if (!url.has_value()) if (!url.has_value())
return {}; return {};
return URLStyleValue::create(*url); return URLStyleValue::create(*url).release_value_but_fixme_should_propagate_errors();
} }
template<typename TElement> template<typename TElement>
@ -2621,7 +2621,7 @@ RefPtr<StyleValue> Parser::parse_linear_gradient_function(ComponentValue const&
if (!color_stops.has_value()) if (!color_stops.has_value())
return {}; 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) 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()) if (!color_stops.has_value())
return {}; 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) 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()) if (!color_stops.has_value())
return {}; 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) 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)) { if (component_value.is(Token::Type::Ident)) {
auto ident = component_value.token().ident(); auto ident = component_value.token().ident();
if (ident.equals_ignoring_ascii_case("inherit"sv)) 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)) 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)) 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 // 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())); 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) RefPtr<StyleValue> Parser::parse_dynamic_value(ComponentValue const& component_value)
@ -3690,17 +3690,17 @@ RefPtr<StyleValue> Parser::parse_dimension_value(ComponentValue const& component
return {}; return {};
if (dimension->is_angle()) 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()) 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()) 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()) 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()) 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()) if (dimension->is_time())
return TimeStyleValue::create(dimension->time()); return TimeStyleValue::create(dimension->time()).release_value_but_fixme_should_propagate_errors();
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();
} }
@ -3709,8 +3709,8 @@ RefPtr<StyleValue> Parser::parse_numeric_value(ComponentValue const& component_v
if (component_value.is(Token::Type::Number)) { if (component_value.is(Token::Type::Number)) {
auto const& number = component_value.token(); auto const& number = component_value.token();
if (number.number().is_integer()) if (number.number().is_integer())
return NumericStyleValue::create_integer(number.to_integer()); return NumericStyleValue::create_integer(number.to_integer()).release_value_but_fixme_should_propagate_errors();
return NumericStyleValue::create_float(number.number_value()); return NumericStyleValue::create_float(number.number_value()).release_value_but_fixme_should_propagate_errors();
} }
return {}; return {};
@ -3721,7 +3721,7 @@ RefPtr<StyleValue> Parser::parse_identifier_value(ComponentValue const& componen
if (component_value.is(Token::Type::Ident)) { if (component_value.is(Token::Type::Ident)) {
auto value_id = value_id_from_string(component_value.token().ident()); auto value_id = value_id_from_string(component_value.token().ident());
if (value_id != ValueID::Invalid) if (value_id != ValueID::Invalid)
return IdentifierStyleValue::create(value_id); return IdentifierStyleValue::create(value_id).release_value_but_fixme_should_propagate_errors();
} }
return {}; 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) 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); auto color = parse_color(component_value);
if (color.has_value()) if (color.has_value())
return ColorStyleValue::create(color.value()); return ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors();
return {}; 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) RefPtr<StyleValue> Parser::parse_string_value(ComponentValue const& component_value)
{ {
if (component_value.is(Token::Type::String)) 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 {}; return {};
} }
@ -4044,7 +4044,7 @@ RefPtr<StyleValue> Parser::parse_image_value(ComponentValue const& component_val
{ {
auto url = parse_url_function(component_value, AllowedDataUrlType::Image); auto url = parse_url_function(component_value, AllowedDataUrlType::Image);
if (url.has_value()) 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); auto linear_gradient = parse_linear_gradient_function(component_value);
if (linear_gradient) if (linear_gradient)
return linear_gradient; return linear_gradient;
@ -4076,7 +4076,7 @@ RefPtr<StyleValue> Parser::parse_comma_separated_value_list(Vector<ComponentValu
return {}; 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) 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); background_color = property_initial_value(m_context.realm(), PropertyID::BackgroundColor);
return BackgroundStyleValue::create( return BackgroundStyleValue::create(
background_color.release_nonnull(), background_color.release_nonnull(),
StyleValueList::create(move(background_images), 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), StyleValueList::create(move(background_positions), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors(),
StyleValueList::create(move(background_sizes), StyleValueList::Separator::Comma), StyleValueList::create(move(background_sizes), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors(),
StyleValueList::create(move(background_repeats), StyleValueList::Separator::Comma), StyleValueList::create(move(background_repeats), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors(),
StyleValueList::create(move(background_attachments), StyleValueList::Separator::Comma), StyleValueList::create(move(background_attachments), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors(),
StyleValueList::create(move(background_origins), StyleValueList::Separator::Comma), StyleValueList::create(move(background_origins), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors(),
StyleValueList::create(move(background_clips), StyleValueList::Separator::Comma)); 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) if (!background_color)
@ -4284,7 +4285,8 @@ RefPtr<StyleValue> Parser::parse_background_value(Vector<ComponentValue> const&
background_repeat.release_nonnull(), background_repeat.release_nonnull(),
background_attachment.release_nonnull(), background_attachment.release_nonnull(),
background_origin.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) static Optional<PositionEdge> identifier_to_edge(ValueID identifier)
@ -4456,8 +4458,9 @@ RefPtr<StyleValue> Parser::parse_single_background_position_value(TokenStream<Co
transaction.commit(); transaction.commit();
return PositionStyleValue::create( return PositionStyleValue::create(
EdgeStyleValue::create(horizontal->edge, horizontal->offset), EdgeStyleValue::create(horizontal->edge, horizontal->offset).release_value_but_fixme_should_propagate_errors(),
EdgeStyleValue::create(vertical->edge, vertical->offset)); 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) 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(); auto identifier = value->to_identifier();
if (identifier == ValueID::Center) { if (identifier == ValueID::Center) {
transaction.commit(); 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()) { if (auto edge = identifier_to_edge(identifier); edge.has_value()) {
relative_edge = *edge; 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()); value = parse_value(tokens.peek_token());
if (!value) { if (!value) {
transaction.commit(); 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(); 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); auto offset = style_value_to_length_percentage(value);
if (offset.has_value()) { if (offset.has_value()) {
transaction.commit(); transaction.commit();
return EdgeStyleValue::create(relative_edge, *offset); return EdgeStyleValue::create(relative_edge, *offset).release_value_but_fixme_should_propagate_errors();
} }
return {}; return {};
@ -4550,7 +4553,8 @@ RefPtr<StyleValue> Parser::parse_single_background_repeat_value(TokenStream<Comp
transaction.commit(); transaction.commit();
return BackgroundRepeatStyleValue::create( return BackgroundRepeatStyleValue::create(
value_id == ValueID::RepeatX ? Repeat::Repeat : Repeat::NoRepeat, 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()); 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)) { if (!maybe_y_value || !property_accepts_value(PropertyID::BackgroundRepeat, *maybe_y_value)) {
// We don't have a second value, so use x for both // We don't have a second value, so use x for both
transaction.commit(); 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(); tokens.next_token();
auto y_value = maybe_y_value.release_nonnull(); auto y_value = maybe_y_value.release_nonnull();
@ -4575,7 +4579,7 @@ RefPtr<StyleValue> Parser::parse_single_background_repeat_value(TokenStream<Comp
return nullptr; return nullptr;
transaction.commit(); 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) 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; return nullptr;
transaction.commit(); 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(); tokens.next_token();
@ -4621,7 +4625,7 @@ RefPtr<StyleValue> Parser::parse_single_background_size_value(TokenStream<Compon
return nullptr; return nullptr;
transaction.commit(); 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) 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) if (!border_color)
border_color = property_initial_value(m_context.realm(), PropertyID::BorderColor); border_color = property_initial_value(m_context.realm(), PropertyID::BorderColor);
return BorderStyleValue::create(border_width.release_nonnull(), border_style.release_nonnull(), border_color.release_nonnull()); 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) 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 horizontal = parse_dimension(component_values[0]);
auto vertical = parse_dimension(component_values[1]); auto vertical = parse_dimension(component_values[1]);
if (horizontal.has_value() && horizontal->is_length_percentage() && vertical.has_value() && vertical->is_length_percentage()) 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; return nullptr;
} }
@ -4684,7 +4688,7 @@ RefPtr<StyleValue> Parser::parse_border_radius_value(Vector<ComponentValue> cons
if (component_values.size() == 1) { if (component_values.size() == 1) {
auto radius = parse_dimension(component_values[0]); auto radius = parse_dimension(component_values[0]);
if (radius.has_value() && radius->is_length_percentage()) 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; return nullptr;
} }
@ -4761,15 +4765,19 @@ RefPtr<StyleValue> Parser::parse_border_radius_shorthand_value(Vector<ComponentV
return nullptr; return nullptr;
auto top_left_radius = BorderRadiusStyleValue::create(top_left(horizontal_radii), 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), 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), 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), 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) 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; placement = ShadowPlacement::Outer;
transaction.commit(); 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) 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; RefPtr<StyleValueList> alt_text;
if (!alt_text_values.is_empty()) 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 // 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); display = parse_multi_component_display(component_values);
if (display.has_value()) if (display.has_value())
return DisplayStyleValue::create(display.value()); return DisplayStyleValue::create(display.value()).release_value_but_fixme_should_propagate_errors();
return {}; return {};
} }
@ -5279,7 +5287,7 @@ RefPtr<StyleValue> Parser::parse_filter_value_list_value(Vector<ComponentValue>
if (filter_value_list.is_empty()) if (filter_value_list.is_empty())
return {}; 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) 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)) { if (property_accepts_value(PropertyID::FlexGrow, *value)) {
// NOTE: The spec says that flex-basis should be 0 here, but other engines currently use 0%. // 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 // https://github.com/w3c/csswg-drafts/issues/5742
auto zero_percent = NumericStyleValue::create_integer(0); auto zero_percent = NumericStyleValue::create_integer(0).release_value_but_fixme_should_propagate_errors();
auto one = NumericStyleValue::create_integer(1); auto one = NumericStyleValue::create_integer(1).release_value_but_fixme_should_propagate_errors();
return FlexStyleValue::create(*value, one, zero_percent); return FlexStyleValue::create(*value, one, zero_percent).release_value_but_fixme_should_propagate_errors();
} }
if (property_accepts_value(PropertyID::FlexBasis, *value)) { if (property_accepts_value(PropertyID::FlexBasis, *value)) {
auto one = NumericStyleValue::create_integer(1); auto one = NumericStyleValue::create_integer(1).release_value_but_fixme_should_propagate_errors();
return FlexStyleValue::create(one, one, *value); return FlexStyleValue::create(one, one, *value).release_value_but_fixme_should_propagate_errors();
} }
if (value->is_identifier() && property_accepts_value(PropertyID::Flex, *value)) { if (value->is_identifier() && property_accepts_value(PropertyID::Flex, *value)) {
switch (value->to_identifier()) { switch (value->to_identifier()) {
case ValueID::None: { case ValueID::None: {
auto zero = NumericStyleValue::create_integer(0); auto zero = NumericStyleValue::create_integer(0).release_value_but_fixme_should_propagate_errors();
return FlexStyleValue::create(zero, zero, IdentifierStyleValue::create(ValueID::Auto)); return FlexStyleValue::create(zero, zero, IdentifierStyleValue::create(ValueID::Auto).release_value_but_fixme_should_propagate_errors()).release_value_but_fixme_should_propagate_errors();
} }
default: default:
return value; 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. // 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 (value->has_number() && value->to_number() == 0) {
if (flex_grow && flex_shrink && !flex_basis) { 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; continue;
} }
} }
@ -5367,7 +5375,7 @@ RefPtr<StyleValue> Parser::parse_flex_value(Vector<ComponentValue> const& compon
if (!flex_basis) if (!flex_basis)
flex_basis = property_initial_value(m_context.realm(), PropertyID::FlexBasis); 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) 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) if (!flex_wrap)
flex_wrap = property_initial_value(m_context.realm(), PropertyID::FlexWrap); flex_wrap = property_initial_value(m_context.realm(), PropertyID::FlexWrap);
return FlexFlowStyleValue::create(flex_direction.release_nonnull(), flex_wrap.release_nonnull()); 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) 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) if (!line_height)
line_height = property_initial_value(m_context.realm(), PropertyID::LineHeight); line_height = property_initial_value(m_context.realm(), PropertyID::LineHeight);
return FontStyleValue::create(font_stretch.release_nonnull(), font_style.release_nonnull(), font_weight.release_nonnull(), font_size.release_nonnull(), line_height.release_nonnull(), font_families.release_nonnull()); 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) 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; return nullptr;
if (!is_comma_or_eof(i + 1)) if (!is_comma_or_eof(i + 1))
return nullptr; 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++; i++;
continue; continue;
} }
@ -5575,7 +5583,7 @@ RefPtr<StyleValue> Parser::parse_font_family_value(Vector<ComponentValue> const&
if (part.is(Token::Type::Comma)) { if (part.is(Token::Type::Comma)) {
if (current_name_parts.is_empty()) if (current_name_parts.is_empty())
return nullptr; 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(); current_name_parts.clear();
// Can't have a trailing comma // Can't have a trailing comma
if (i + 1 == component_values.size()) 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()) { 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(); current_name_parts.clear();
} }
if (font_families.is_empty()) if (font_families.is_empty())
return nullptr; 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) 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 (found_nones == 2) {
if (list_image || list_type) if (list_image || list_type)
return nullptr; 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_image = none;
list_type = none; list_type = none;
} else if (found_nones == 1) { } else if (found_nones == 1) {
if (list_image && list_type) if (list_image && list_type)
return nullptr; return nullptr;
auto none = IdentifierStyleValue::create(ValueID::None); auto none = IdentifierStyleValue::create(ValueID::None).release_value_but_fixme_should_propagate_errors();
if (!list_image) if (!list_image)
list_image = none; list_image = none;
if (!list_type) if (!list_type)
@ -5850,7 +5858,7 @@ RefPtr<StyleValue> Parser::parse_list_style_value(Vector<ComponentValue> const&
if (!list_type) if (!list_type)
list_type = property_initial_value(m_context.realm(), PropertyID::ListStyleType); list_type = property_initial_value(m_context.realm(), PropertyID::ListStyleType);
return ListStyleStyleValue::create(list_position.release_nonnull(), list_image.release_nonnull(), list_type.release_nonnull()); 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) 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; return nullptr;
auto value = maybe_value.release_nonnull(); auto value = maybe_value.release_nonnull();
if (property_accepts_value(PropertyID::Overflow, *value)) 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; 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)) { if (!property_accepts_value(PropertyID::OverflowX, x_value) || !property_accepts_value(PropertyID::OverflowY, y_value)) {
return nullptr; 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; return nullptr;
@ -5938,7 +5946,7 @@ RefPtr<StyleValue> Parser::parse_text_decoration_value(Vector<ComponentValue> co
if (!decoration_color) if (!decoration_color)
decoration_color = property_initial_value(m_context.realm(), PropertyID::TextDecorationColor); decoration_color = property_initial_value(m_context.realm(), PropertyID::TextDecorationColor);
return TextDecorationStyleValue::create(decoration_line.release_nonnull(), decoration_thickness.release_nonnull(), decoration_style.release_nonnull(), decoration_color.release_nonnull()); 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) 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()) if (style_values.is_empty())
return nullptr; 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) 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(); tokens.skip_whitespace();
if (tokens.has_next_token()) if (tokens.has_next_token())
return nullptr; return nullptr;
return IdentifierStyleValue::create(ValueID::None); return IdentifierStyleValue::create(ValueID::None).release_value_but_fixme_should_propagate_errors();
} }
if (!part.is_function()) 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()) { if (maybe_calc_value && maybe_calc_value->resolves_to_angle()) {
values.append(maybe_calc_value.release_nonnull()); values.append(maybe_calc_value.release_nonnull());
} else if (value.is(Token::Type::Number) && value.token().number_value() == 0) { } 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 { } else {
auto dimension_value = parse_dimension_value(value); auto dimension_value = parse_dimension_value(value);
if (!dimension_value || !dimension_value->is_angle()) if (!dimension_value || !dimension_value->is_angle())
@ -6105,9 +6113,9 @@ RefPtr<StyleValue> Parser::parse_transform_value(Vector<ComponentValue> const& c
return nullptr; 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 // 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()) if (value->is_length())
return AxisOffset { Axis::None, value->as_length() }; return AxisOffset { Axis::None, value->as_length() };
if (value->has_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()) { if (value->is_identifier()) {
switch (value->to_identifier()) { switch (value->to_identifier()) {
case ValueID::Top: 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: 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: 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: 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: 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: default:
return {}; return {};
} }
@ -6155,7 +6163,7 @@ RefPtr<StyleValue> Parser::parse_transform_origin_value(Vector<ComponentValue> c
StyleValueVector values; StyleValueVector values;
values.append(x_value); values.append(x_value);
values.append(y_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()) { switch (component_values.size()) {
@ -6168,9 +6176,9 @@ RefPtr<StyleValue> Parser::parse_transform_origin_value(Vector<ComponentValue> c
switch (single_value->axis) { switch (single_value->axis) {
case Axis::None: case Axis::None:
case Axis::X: 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: 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(); VERIFY_NOT_REACHED();
} }
@ -6439,11 +6447,11 @@ RefPtr<StyleValue> Parser::parse_grid_track_size_list(Vector<ComponentValue> con
auto token = tokens.next_token(); auto token = tokens.next_token();
if (token.is_block()) { if (token.is_block()) {
if (last_object_was_line_names && !allow_separate_line_name_blocks) 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; last_object_was_line_names = true;
Vector<String> line_names; Vector<String> line_names;
if (!token.block().is_square()) 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() }; TokenStream block_tokens { token.block().values() };
while (block_tokens.has_next_token()) { while (block_tokens.has_next_token()) {
auto current_block_token = block_tokens.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; last_object_was_line_names = false;
auto track_sizing_function = parse_track_sizing_function(token); auto track_sizing_function = parse_track_sizing_function(token);
if (!track_sizing_function.has_value()) 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 // FIXME: Handle multiple repeat values (should combine them here, or remove
// any other ones if the first one is auto-fill, etc.) // any other ones if the first one is auto-fill, etc.)
track_list.append(track_sizing_function.value()); 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()) while (line_names_list.size() <= track_list.size())
line_names_list.append({}); 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) 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 (!tokens.has_next_token()) {
if (is_auto(current_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)) 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)) 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)) { if (is_line_name(current_token)) {
auto maybe_string = String::from_utf8(current_token.ident()); auto maybe_string = String::from_utf8(current_token.ident());
if (!maybe_string.is_error()) 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 {}; return {};
} }
@ -6564,8 +6572,8 @@ RefPtr<StyleValue> Parser::parse_grid_track_placement(Vector<ComponentValue> con
span_or_position_value = 1; span_or_position_value = 1;
if (!line_name_value.is_empty()) 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(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)); 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) 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); auto parsed_start_value = parse_grid_track_placement(track_start_placement_tokens);
if (parsed_start_value && track_end_placement_tokens.is_empty()) 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); auto parsed_end_value = parse_grid_track_placement(track_end_placement_tokens);
if (parsed_start_value && parsed_end_value) 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 {}; return {};
} }
@ -6649,7 +6657,8 @@ RefPtr<StyleValue> Parser::parse_grid_track_size_list_shorthand_value(Vector<Com
return GridTrackSizeListShorthandStyleValue::create( return GridTrackSizeListShorthandStyleValue::create(
parsed_template_areas_values.release_nonnull()->as_grid_template_area(), parsed_template_areas_values.release_nonnull()->as_grid_template_area(),
parsed_template_rows_values.release_nonnull()->as_grid_track_size_list(), 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) 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 else
column_end = row_end; 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) 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)); 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) 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) 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()) if (component_values.is_empty())
return ParseError::SyntaxError; return ParseError::SyntaxError;
@ -6992,7 +7001,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
parsed_values.append(parsed_value.release_nonnull()); parsed_values.append(parsed_value.release_nonnull());
} }
if (!parsed_values.is_empty() && parsed_values.size() <= property_maximum_value_count(property_id)) 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; return ParseError::SyntaxError;

View file

@ -81,77 +81,77 @@ static NonnullRefPtr<StyleValue const> style_value_for_background_property(Layou
StyleValueVector values; StyleValueVector values;
for (auto const& layer : background_layers) for (auto const& layer : background_layers)
values.append(callback(layer)); 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) static RefPtr<StyleValue> style_value_for_display(CSS::Display display)
{ {
if (display.is_none()) 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()) { if (display.is_outside_and_inside()) {
StyleValueVector values; StyleValueVector values;
switch (display.outside()) { switch (display.outside()) {
case CSS::Display::Outside::Inline: 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; break;
case CSS::Display::Outside::Block: 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; break;
case CSS::Display::Outside::RunIn: 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; break;
} }
switch (display.inside()) { switch (display.inside()) {
case CSS::Display::Inside::Flow: 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; break;
case CSS::Display::Inside::FlowRoot: 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; break;
case CSS::Display::Inside::Table: 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; break;
case CSS::Display::Inside::Flex: 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; break;
case CSS::Display::Inside::Grid: 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; break;
case CSS::Display::Inside::Ruby: 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; 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()) { if (display.is_internal()) {
switch (display.internal()) { switch (display.internal()) {
case CSS::Display::Internal::TableRowGroup: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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) static NonnullRefPtr<StyleValue const> style_value_for_length_percentage(LengthPercentage const& length_percentage)
{ {
if (length_percentage.is_auto()) 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()) 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()) 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(); return length_percentage.calculated();
} }
static NonnullRefPtr<StyleValue const> style_value_for_size(CSS::Size const& size) static NonnullRefPtr<StyleValue const> style_value_for_size(CSS::Size const& size)
{ {
if (size.is_none()) 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()) 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()) 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()) 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()) if (size.is_calculated())
return size.calculated(); return size.calculated();
if (size.is_min_content()) 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()) 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>) // FIXME: Support fit-content(<length>)
TODO(); TODO();
} }
@ -210,88 +210,89 @@ RefPtr<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L
auto maybe_background_clip = property(CSS::PropertyID::BackgroundClip); auto maybe_background_clip = property(CSS::PropertyID::BackgroundClip);
return BackgroundStyleValue::create( return BackgroundStyleValue::create(
value_or_default(maybe_background_color, InitialStyleValue::the()), 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)), 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)), EdgeStyleValue::create(PositionEdge::Top, Length::make_px(0)))), 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)), 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)), 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)), 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)), 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))); 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: case CSS::PropertyID::BackgroundAttachment:
return style_value_for_background_property( return style_value_for_background_property(
layout_node, layout_node,
[](auto& layer) { return IdentifierStyleValue::create(to_value_id(layer.attachment)); }, [](auto& layer) { return IdentifierStyleValue::create(to_value_id(layer.attachment)).release_value_but_fixme_should_propagate_errors(); },
[] { return IdentifierStyleValue::create(CSS::ValueID::Scroll); }); [] { return IdentifierStyleValue::create(CSS::ValueID::Scroll).release_value_but_fixme_should_propagate_errors(); });
case CSS::PropertyID::BackgroundClip: case CSS::PropertyID::BackgroundClip:
return style_value_for_background_property( return style_value_for_background_property(
layout_node, layout_node,
[](auto& layer) { return IdentifierStyleValue::create(to_value_id(layer.clip)); }, [](auto& layer) { return IdentifierStyleValue::create(to_value_id(layer.clip)).release_value_but_fixme_should_propagate_errors(); },
[] { return IdentifierStyleValue::create(CSS::ValueID::BorderBox); }); [] { return IdentifierStyleValue::create(CSS::ValueID::BorderBox).release_value_but_fixme_should_propagate_errors(); });
case PropertyID::BackgroundColor: 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: case CSS::PropertyID::BackgroundImage:
return style_value_for_background_property( return style_value_for_background_property(
layout_node, layout_node,
[](auto& layer) -> NonnullRefPtr<StyleValue const> { [](auto& layer) -> NonnullRefPtr<StyleValue const> {
if (layer.background_image) if (layer.background_image)
return *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: case CSS::PropertyID::BackgroundOrigin:
return style_value_for_background_property( return style_value_for_background_property(
layout_node, layout_node,
[](auto& layer) { return IdentifierStyleValue::create(to_value_id(layer.origin)); }, [](auto& layer) { return IdentifierStyleValue::create(to_value_id(layer.origin)).release_value_but_fixme_should_propagate_errors(); },
[] { return IdentifierStyleValue::create(CSS::ValueID::PaddingBox); }); [] { return IdentifierStyleValue::create(CSS::ValueID::PaddingBox).release_value_but_fixme_should_propagate_errors(); });
case CSS::PropertyID::BackgroundRepeat: case CSS::PropertyID::BackgroundRepeat:
return style_value_for_background_property( return style_value_for_background_property(
layout_node, layout_node,
[](auto& layer) { [](auto& layer) {
StyleValueVector repeat { StyleValueVector repeat {
IdentifierStyleValue::create(to_value_id(layer.repeat_x)), IdentifierStyleValue::create(to_value_id(layer.repeat_x)).release_value_but_fixme_should_propagate_errors(),
IdentifierStyleValue::create(to_value_id(layer.repeat_y)), 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: { case CSS::PropertyID::BorderBottom: {
auto border = layout_node.computed_values().border_bottom(); auto border = layout_node.computed_values().border_bottom();
auto width = LengthStyleValue::create(Length::make_px(border.width)); 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)); auto style = IdentifierStyleValue::create(to_value_id(border.line_style)).release_value_but_fixme_should_propagate_errors();
auto color = ColorStyleValue::create(border.color); auto color = ColorStyleValue::create(border.color).release_value_but_fixme_should_propagate_errors();
return BorderStyleValue::create(width, style, color); return BorderStyleValue::create(width, style, color).release_value_but_fixme_should_propagate_errors();
} }
case CSS::PropertyID::BorderBottomColor: 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: { case CSS::PropertyID::BorderBottomLeftRadius: {
auto const& border_radius = layout_node.computed_values().border_bottom_left_radius(); 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: { case CSS::PropertyID::BorderBottomRightRadius: {
auto const& border_radius = layout_node.computed_values().border_bottom_right_radius(); 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: 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: 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: 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: { case CSS::PropertyID::BorderLeft: {
auto border = layout_node.computed_values().border_left(); auto border = layout_node.computed_values().border_left();
auto width = LengthStyleValue::create(Length::make_px(border.width)); 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)); auto style = IdentifierStyleValue::create(to_value_id(border.line_style)).release_value_but_fixme_should_propagate_errors();
auto color = ColorStyleValue::create(border.color); auto color = ColorStyleValue::create(border.color).release_value_but_fixme_should_propagate_errors();
return BorderStyleValue::create(width, style, color); return BorderStyleValue::create(width, style, color).release_value_but_fixme_should_propagate_errors();
} }
case CSS::PropertyID::BorderLeftColor: 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: 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: 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: { case CSS::PropertyID::BorderRadius: {
auto maybe_top_left_radius = property(CSS::PropertyID::BorderTopLeftRadius); auto maybe_top_left_radius = property(CSS::PropertyID::BorderTopLeftRadius);
auto maybe_top_right_radius = property(CSS::PropertyID::BorderTopRightRadius); 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(); 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: { case CSS::PropertyID::BorderRight: {
auto border = layout_node.computed_values().border_right(); auto border = layout_node.computed_values().border_right();
auto width = LengthStyleValue::create(Length::make_px(border.width)); 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)); auto style = IdentifierStyleValue::create(to_value_id(border.line_style)).release_value_but_fixme_should_propagate_errors();
auto color = ColorStyleValue::create(border.color); auto color = ColorStyleValue::create(border.color).release_value_but_fixme_should_propagate_errors();
return BorderStyleValue::create(width, style, color); return BorderStyleValue::create(width, style, color).release_value_but_fixme_should_propagate_errors();
} }
case CSS::PropertyID::BorderRightColor: 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: 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: 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: { case CSS::PropertyID::BorderTop: {
auto border = layout_node.computed_values().border_top(); auto border = layout_node.computed_values().border_top();
auto width = LengthStyleValue::create(Length::make_px(border.width)); 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)); auto style = IdentifierStyleValue::create(to_value_id(border.line_style)).release_value_but_fixme_should_propagate_errors();
auto color = ColorStyleValue::create(border.color); auto color = ColorStyleValue::create(border.color).release_value_but_fixme_should_propagate_errors();
return BorderStyleValue::create(width, style, color); return BorderStyleValue::create(width, style, color).release_value_but_fixme_should_propagate_errors();
} }
case CSS::PropertyID::BorderTopColor: 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: { case CSS::PropertyID::BorderTopLeftRadius: {
auto const& border_radius = layout_node.computed_values().border_top_left_radius(); 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: { case CSS::PropertyID::BorderTopRightRadius: {
auto const& border_radius = layout_node.computed_values().border_top_right_radius(); 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: 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: 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: { case CSS::PropertyID::BoxShadow: {
auto box_shadow_layers = layout_node.computed_values().box_shadow(); auto box_shadow_layers = layout_node.computed_values().box_shadow();
if (box_shadow_layers.is_empty()) 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) 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; StyleValueVector box_shadow;
box_shadow.ensure_capacity(box_shadow_layers.size()); box_shadow.ensure_capacity(box_shadow_layers.size());
for (auto const& layer : box_shadow_layers) for (auto const& layer : box_shadow_layers)
box_shadow.append(make_box_shadow_style_value(layer)); 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); return StyleValueList::create(move(box_shadow), StyleValueList::Separator::Comma).release_value_but_fixme_should_propagate_errors();
} }
case CSS::PropertyID::BoxSizing: 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: case CSS::PropertyID::Bottom:
return style_value_for_length_percentage(layout_node.computed_values().inset().bottom()); return style_value_for_length_percentage(layout_node.computed_values().inset().bottom());
case CSS::PropertyID::Clear: 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: 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: 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: case CSS::PropertyID::ColumnGap:
return style_value_for_size(layout_node.computed_values().column_gap()); return style_value_for_size(layout_node.computed_values().column_gap());
case CSS::PropertyID::Cursor: 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: case CSS::PropertyID::Display:
return style_value_for_display(layout_node.display()); return style_value_for_display(layout_node.display());
case CSS::PropertyID::FlexBasis: { case CSS::PropertyID::FlexBasis: {
switch (layout_node.computed_values().flex_basis().type) { switch (layout_node.computed_values().flex_basis().type) {
case FlexBasis::Content: 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: case FlexBasis::LengthPercentage:
return style_value_for_length_percentage(*layout_node.computed_values().flex_basis().length_percentage); return style_value_for_length_percentage(*layout_node.computed_values().flex_basis().length_percentage);
case FlexBasis::Auto: case FlexBasis::Auto:
return IdentifierStyleValue::create(CSS::ValueID::Auto); return IdentifierStyleValue::create(CSS::ValueID::Auto).release_value_but_fixme_should_propagate_errors();
default: default:
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();
} }
break; break;
case CSS::PropertyID::FlexDirection: 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: 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: 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: 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: 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: 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: { case CSS::PropertyID::FontVariant: {
auto font_variant = layout_node.computed_values().font_variant(); auto font_variant = layout_node.computed_values().font_variant();
switch (font_variant) { switch (font_variant) {
case FontVariant::Normal: case FontVariant::Normal:
return IdentifierStyleValue::create(ValueID::Normal); return IdentifierStyleValue::create(ValueID::Normal).release_value_but_fixme_should_propagate_errors();
case FontVariant::SmallCaps: case FontVariant::SmallCaps:
return IdentifierStyleValue::create(ValueID::SmallCaps); return IdentifierStyleValue::create(ValueID::SmallCaps).release_value_but_fixme_should_propagate_errors();
} }
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();
} }
case CSS::PropertyID::FontWeight: 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: { case CSS::PropertyID::GridArea: {
auto maybe_grid_row_start = property(CSS::PropertyID::GridRowStart); auto maybe_grid_row_start = property(CSS::PropertyID::GridRowStart);
auto maybe_grid_column_start = property(CSS::PropertyID::GridColumnStart); 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_row_start.release_nonnull(),
grid_column_start.release_nonnull(), grid_column_start.release_nonnull(),
grid_row_end.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: { case CSS::PropertyID::GridColumn: {
auto maybe_grid_column_end = property(CSS::PropertyID::GridColumnEnd); 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()); VERIFY(maybe_grid_column_start.value().value->is_grid_track_placement());
grid_column_start = maybe_grid_column_start.value().value->as_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: 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: 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: { case CSS::PropertyID::GridRow: {
auto maybe_grid_row_end = property(CSS::PropertyID::GridRowEnd); auto maybe_grid_row_end = property(CSS::PropertyID::GridRowEnd);
auto maybe_grid_row_start = property(CSS::PropertyID::GridRowStart); 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()); VERIFY(maybe_grid_row_start.value().value->is_grid_track_placement());
grid_row_start = maybe_grid_row_start.value().value->as_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: 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: 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: { case CSS::PropertyID::GridTemplate: {
auto maybe_grid_template_areas = property(CSS::PropertyID::GridTemplateAreas); auto maybe_grid_template_areas = property(CSS::PropertyID::GridTemplateAreas);
auto maybe_grid_template_rows = property(CSS::PropertyID::GridTemplateRows); 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()); 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(); 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: 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: 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: 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: case CSS::PropertyID::Height:
return style_value_for_size(layout_node.computed_values().height()); return style_value_for_size(layout_node.computed_values().height());
case CSS::PropertyID::ImageRendering: 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: 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: case CSS::PropertyID::Left:
return style_value_for_length_percentage(layout_node.computed_values().inset().left()); return style_value_for_length_percentage(layout_node.computed_values().inset().left());
case CSS::PropertyID::LineHeight: 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: 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: { case CSS::PropertyID::Margin: {
auto margin = layout_node.computed_values().margin(); auto margin = layout_node.computed_values().margin();
auto values = StyleValueVector {}; 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.right()));
values.append(style_value_for_length_percentage(margin.bottom())); values.append(style_value_for_length_percentage(margin.bottom()));
values.append(style_value_for_length_percentage(margin.left())); 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: case CSS::PropertyID::MarginBottom:
return style_value_for_length_percentage(layout_node.computed_values().margin().bottom()); 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: case CSS::PropertyID::MinWidth:
return style_value_for_size(layout_node.computed_values().min_width()); return style_value_for_size(layout_node.computed_values().min_width());
case CSS::PropertyID::Opacity: 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: 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: 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: 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: { case CSS::PropertyID::Padding: {
auto padding = layout_node.computed_values().padding(); auto padding = layout_node.computed_values().padding();
auto values = StyleValueVector {}; 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.right()));
values.append(style_value_for_length_percentage(padding.bottom())); values.append(style_value_for_length_percentage(padding.bottom()));
values.append(style_value_for_length_percentage(padding.left())); 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: case CSS::PropertyID::PaddingBottom:
return style_value_for_length_percentage(layout_node.computed_values().padding().bottom()); 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: case CSS::PropertyID::PaddingTop:
return style_value_for_length_percentage(layout_node.computed_values().padding().top()); return style_value_for_length_percentage(layout_node.computed_values().padding().top());
case CSS::PropertyID::Position: 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: case CSS::PropertyID::Right:
return style_value_for_length_percentage(layout_node.computed_values().inset().right()); return style_value_for_length_percentage(layout_node.computed_values().inset().right());
case CSS::PropertyID::RowGap: case CSS::PropertyID::RowGap:
return style_value_for_size(layout_node.computed_values().row_gap()); return style_value_for_size(layout_node.computed_values().row_gap());
case CSS::PropertyID::TextAlign: 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: { case CSS::PropertyID::TextDecorationLine: {
auto text_decoration_lines = layout_node.computed_values().text_decoration_line(); auto text_decoration_lines = layout_node.computed_values().text_decoration_line();
if (text_decoration_lines.is_empty()) 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; StyleValueVector style_values;
for (auto const& line : text_decoration_lines) { 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: 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: 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: case CSS::PropertyID::Top:
return style_value_for_length_percentage(layout_node.computed_values().inset().top()); return style_value_for_length_percentage(layout_node.computed_values().inset().top());
case CSS::PropertyID::Transform: { 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 // https://www.w3.org/TR/css-transforms-1/#serialization-of-the-computed-value
auto transformations = layout_node.computed_values().transformations(); auto transformations = layout_node.computed_values().transformations();
if (transformations.is_empty()) 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. // 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(); auto const* viewport = layout_node.document().layout_node();
@ -620,37 +622,37 @@ RefPtr<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L
StyleValueVector parameters; StyleValueVector parameters;
parameters.ensure_capacity(6); parameters.ensure_capacity(6);
parameters.append(NumericStyleValue::create_float(affine_matrix.a())); parameters.append(NumericStyleValue::create_float(affine_matrix.a()).release_value_but_fixme_should_propagate_errors());
parameters.append(NumericStyleValue::create_float(affine_matrix.b())); parameters.append(NumericStyleValue::create_float(affine_matrix.b()).release_value_but_fixme_should_propagate_errors());
parameters.append(NumericStyleValue::create_float(affine_matrix.c())); parameters.append(NumericStyleValue::create_float(affine_matrix.c()).release_value_but_fixme_should_propagate_errors());
parameters.append(NumericStyleValue::create_float(affine_matrix.d())); parameters.append(NumericStyleValue::create_float(affine_matrix.d()).release_value_but_fixme_should_propagate_errors());
parameters.append(NumericStyleValue::create_float(affine_matrix.e())); parameters.append(NumericStyleValue::create_float(affine_matrix.e()).release_value_but_fixme_should_propagate_errors());
parameters.append(NumericStyleValue::create_float(affine_matrix.f())); 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)); 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, // Elsewhere we always store the transform property's value as a StyleValueList of TransformationStyleValues,
// so this is just for consistency. // so this is just for consistency.
StyleValueVector matrix_functions; StyleValueVector matrix_functions;
matrix_functions.append(matrix_function); 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: case CSS::PropertyID::VerticalAlign:
if (auto const* length_percentage = layout_node.computed_values().vertical_align().get_pointer<CSS::LengthPercentage>()) { if (auto const* length_percentage = layout_node.computed_values().vertical_align().get_pointer<CSS::LengthPercentage>()) {
return style_value_for_length_percentage(*length_percentage); 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: 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: case CSS::PropertyID::Width:
return style_value_for_size(layout_node.computed_values().width()); return style_value_for_size(layout_node.computed_values().width());
case CSS::PropertyID::ZIndex: { case CSS::PropertyID::ZIndex: {
auto maybe_z_index = layout_node.computed_values().z_index(); auto maybe_z_index = layout_node.computed_values().z_index();
if (!maybe_z_index.has_value()) if (!maybe_z_index.has_value())
return {}; 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: 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: case CSS::PropertyID::Custom:
dbgln_if(LIBWEB_CSS_DEBUG, "Computed style for custom properties was requested (?)"); dbgln_if(LIBWEB_CSS_DEBUG, "Computed style for custom properties was requested (?)");
return {}; return {};

View file

@ -480,8 +480,8 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
y_positions.unchecked_append(layer); y_positions.unchecked_append(layer);
} }
} }
style.set_property(CSS::PropertyID::BackgroundPositionX, StyleValueList::create(move(x_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())); style.set_property(CSS::PropertyID::BackgroundPositionY, StyleValueList::create(move(y_positions), values_list.separator()).release_value_but_fixme_should_propagate_errors());
} else { } else {
style.set_property(CSS::PropertyID::BackgroundPositionX, value); style.set_property(CSS::PropertyID::BackgroundPositionX, value);
style.set_property(CSS::PropertyID::BackgroundPositionY, 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); 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::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)); 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()); 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)]; 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()) { if (line_height_value_slot && line_height_value_slot->is_percentage()) {
line_height_value_slot = LengthStyleValue::create( 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); 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) // 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()) 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) { for (size_t i = 0; i < style.m_property_values.size(); ++i) {
auto& value_slot = style.m_property_values[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) 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 NonnullRefPtr<StyleProperties> StyleComputer::create_document_style() const
@ -1528,9 +1529,9 @@ NonnullRefPtr<StyleProperties> StyleComputer::create_document_style() const
compute_font(style, nullptr, {}); compute_font(style, nullptr, {});
compute_defaulted_values(style, nullptr, {}); compute_defaulted_values(style, nullptr, {});
absolutize_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::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()))); 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))); 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; return style;
} }

View file

@ -16,9 +16,9 @@ namespace Web::CSS {
class AngleStyleValue : public StyleValueWithDefaultOperators<AngleStyleValue> { class AngleStyleValue : public StyleValueWithDefaultOperators<AngleStyleValue> {
public: 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; virtual ~AngleStyleValue() override;

View file

@ -16,9 +16,9 @@ namespace Web::CSS {
class BackgroundRepeatStyleValue final : public StyleValueWithDefaultOperators<BackgroundRepeatStyleValue> { class BackgroundRepeatStyleValue final : public StyleValueWithDefaultOperators<BackgroundRepeatStyleValue> {
public: 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; virtual ~BackgroundRepeatStyleValue() override;

View file

@ -18,9 +18,9 @@ namespace Web::CSS {
// NOTE: This is not used for identifier sizes, like `cover` and `contain`. // NOTE: This is not used for identifier sizes, like `cover` and `contain`.
class BackgroundSizeStyleValue final : public StyleValueWithDefaultOperators<BackgroundSizeStyleValue> { class BackgroundSizeStyleValue final : public StyleValueWithDefaultOperators<BackgroundSizeStyleValue> {
public: 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; virtual ~BackgroundSizeStyleValue() override;

View file

@ -15,7 +15,7 @@ namespace Web::CSS {
class BackgroundStyleValue final : public StyleValueWithDefaultOperators<BackgroundStyleValue> { class BackgroundStyleValue final : public StyleValueWithDefaultOperators<BackgroundStyleValue> {
public: public:
static ValueComparingNonnullRefPtr<BackgroundStyleValue> create( static ErrorOr<ValueComparingNonnullRefPtr<BackgroundStyleValue>> create(
ValueComparingNonnullRefPtr<StyleValue const> color, ValueComparingNonnullRefPtr<StyleValue const> color,
ValueComparingNonnullRefPtr<StyleValue const> image, ValueComparingNonnullRefPtr<StyleValue const> image,
ValueComparingNonnullRefPtr<StyleValue const> position, ValueComparingNonnullRefPtr<StyleValue const> position,
@ -25,7 +25,7 @@ public:
ValueComparingNonnullRefPtr<StyleValue const> origin, ValueComparingNonnullRefPtr<StyleValue const> origin,
ValueComparingNonnullRefPtr<StyleValue const> clip) 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; virtual ~BackgroundStyleValue() override;

View file

@ -16,13 +16,13 @@ namespace Web::CSS {
class BorderRadiusShorthandStyleValue final : public StyleValueWithDefaultOperators<BorderRadiusShorthandStyleValue> { class BorderRadiusShorthandStyleValue final : public StyleValueWithDefaultOperators<BorderRadiusShorthandStyleValue> {
public: public:
static ValueComparingNonnullRefPtr<BorderRadiusShorthandStyleValue> create( static ErrorOr<ValueComparingNonnullRefPtr<BorderRadiusShorthandStyleValue>> create(
ValueComparingNonnullRefPtr<BorderRadiusStyleValue const> top_left, ValueComparingNonnullRefPtr<BorderRadiusStyleValue const> top_left,
ValueComparingNonnullRefPtr<BorderRadiusStyleValue const> top_right, ValueComparingNonnullRefPtr<BorderRadiusStyleValue const> top_right,
ValueComparingNonnullRefPtr<BorderRadiusStyleValue const> bottom_right, ValueComparingNonnullRefPtr<BorderRadiusStyleValue const> bottom_right,
ValueComparingNonnullRefPtr<BorderRadiusStyleValue const> bottom_left) 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; virtual ~BorderRadiusShorthandStyleValue() override = default;

View file

@ -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); absolutized_horizontal_radius = m_properties.horizontal_radius.length().absolutized(viewport_rect, font_metrics, root_font_metrics);
if (!m_properties.vertical_radius.is_percentage()) if (!m_properties.vertical_radius.is_percentage())
absolutized_vertical_radius = m_properties.vertical_radius.length().absolutized(viewport_rect, font_metrics, root_font_metrics); 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();
} }
} }

View file

@ -17,9 +17,9 @@ namespace Web::CSS {
class BorderRadiusStyleValue final : public StyleValueWithDefaultOperators<BorderRadiusStyleValue> { class BorderRadiusStyleValue final : public StyleValueWithDefaultOperators<BorderRadiusStyleValue> {
public: 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; virtual ~BorderRadiusStyleValue() override = default;

View file

@ -15,12 +15,12 @@ namespace Web::CSS {
class BorderStyleValue final : public StyleValueWithDefaultOperators<BorderStyleValue> { class BorderStyleValue final : public StyleValueWithDefaultOperators<BorderStyleValue> {
public: public:
static ValueComparingNonnullRefPtr<BorderStyleValue> create( static ErrorOr<ValueComparingNonnullRefPtr<BorderStyleValue>> create(
ValueComparingNonnullRefPtr<StyleValue> border_width, ValueComparingNonnullRefPtr<StyleValue> border_width,
ValueComparingNonnullRefPtr<StyleValue> border_style, ValueComparingNonnullRefPtr<StyleValue> border_style,
ValueComparingNonnullRefPtr<StyleValue> border_color) 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; virtual ~BorderStyleValue() override;

View file

@ -64,9 +64,9 @@ public:
Value m_value; 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; ErrorOr<String> to_string() const override;

View file

@ -12,24 +12,24 @@
namespace Web::CSS { namespace Web::CSS {
ValueComparingNonnullRefPtr<ColorStyleValue> ColorStyleValue::create(Color color) ErrorOr<ValueComparingNonnullRefPtr<ColorStyleValue>> ColorStyleValue::create(Color color)
{ {
if (color.value() == 0) { 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; return transparent;
} }
if (color == Color::from_rgb(0x000000)) { 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; return black;
} }
if (color == Color::from_rgb(0xffffff)) { 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 white;
} }
return adopt_ref(*new ColorStyleValue(color)); return adopt_nonnull_ref_or_enomem(new (nothrow) ColorStyleValue(color));
} }
ErrorOr<String> ColorStyleValue::to_string() const ErrorOr<String> ColorStyleValue::to_string() const

View file

@ -16,7 +16,7 @@ namespace Web::CSS {
class ColorStyleValue : public StyleValueWithDefaultOperators<ColorStyleValue> { class ColorStyleValue : public StyleValueWithDefaultOperators<ColorStyleValue> {
public: public:
static ValueComparingNonnullRefPtr<ColorStyleValue> create(Color color); static ErrorOr<ValueComparingNonnullRefPtr<ColorStyleValue>> create(Color color);
virtual ~ColorStyleValue() override = default; virtual ~ColorStyleValue() override = default;
Color color() const { return m_color; } Color color() const { return m_color; }

View file

@ -18,10 +18,10 @@ namespace Web::CSS {
class ConicGradientStyleValue final : public AbstractImageStyleValue { class ConicGradientStyleValue final : public AbstractImageStyleValue {
public: 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); 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; virtual ErrorOr<String> to_string() const override;

View file

@ -15,9 +15,9 @@ namespace Web::CSS {
class ContentStyleValue final : public StyleValueWithDefaultOperators<ContentStyleValue> { class ContentStyleValue final : public StyleValueWithDefaultOperators<ContentStyleValue> {
public: 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; virtual ~ContentStyleValue() override = default;

View file

@ -8,9 +8,9 @@
namespace Web::CSS { 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));
} }
} }

View file

@ -13,7 +13,7 @@ namespace Web::CSS {
class DisplayStyleValue : public StyleValueWithDefaultOperators<DisplayStyleValue> { class DisplayStyleValue : public StyleValueWithDefaultOperators<DisplayStyleValue> {
public: public:
static ValueComparingNonnullRefPtr<DisplayStyleValue> create(Display const&); static ErrorOr<ValueComparingNonnullRefPtr<DisplayStyleValue>> create(Display const&);
virtual ~DisplayStyleValue() override = default; virtual ~DisplayStyleValue() override = default;
virtual ErrorOr<String> to_string() const override { return m_display.to_string(); } virtual ErrorOr<String> to_string() const override { return m_display.to_string(); }

View file

@ -14,9 +14,9 @@ namespace Web::CSS {
class EdgeStyleValue final : public StyleValueWithDefaultOperators<EdgeStyleValue> { class EdgeStyleValue final : public StyleValueWithDefaultOperators<EdgeStyleValue> {
public: 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; virtual ~EdgeStyleValue() override = default;

View file

@ -70,11 +70,11 @@ using FilterFunction = Variant<Filter::Blur, Filter::DropShadow, Filter::HueRota
class FilterValueListStyleValue final : public StyleValueWithDefaultOperators<FilterValueListStyleValue> { class FilterValueListStyleValue final : public StyleValueWithDefaultOperators<FilterValueListStyleValue> {
public: public:
static ValueComparingNonnullRefPtr<FilterValueListStyleValue> create( static ErrorOr<ValueComparingNonnullRefPtr<FilterValueListStyleValue>> create(
Vector<FilterFunction> filter_value_list) Vector<FilterFunction> filter_value_list)
{ {
VERIFY(filter_value_list.size() >= 1); 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; } Vector<FilterFunction> const& filter_value_list() const { return m_filter_value_list; }

View file

@ -15,9 +15,9 @@ namespace Web::CSS {
class FlexFlowStyleValue final : public StyleValueWithDefaultOperators<FlexFlowStyleValue> { class FlexFlowStyleValue final : public StyleValueWithDefaultOperators<FlexFlowStyleValue> {
public: 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; virtual ~FlexFlowStyleValue() override = default;

View file

@ -15,12 +15,12 @@ namespace Web::CSS {
class FlexStyleValue final : public StyleValueWithDefaultOperators<FlexStyleValue> { class FlexStyleValue final : public StyleValueWithDefaultOperators<FlexStyleValue> {
public: public:
static ValueComparingNonnullRefPtr<FlexStyleValue> create( static ErrorOr<ValueComparingNonnullRefPtr<FlexStyleValue>> create(
ValueComparingNonnullRefPtr<StyleValue> grow, ValueComparingNonnullRefPtr<StyleValue> grow,
ValueComparingNonnullRefPtr<StyleValue> shrink, ValueComparingNonnullRefPtr<StyleValue> shrink,
ValueComparingNonnullRefPtr<StyleValue> basis) 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; virtual ~FlexStyleValue() override = default;

View file

@ -15,9 +15,15 @@ namespace Web::CSS {
class FontStyleValue final : public StyleValueWithDefaultOperators<FontStyleValue> { class FontStyleValue final : public StyleValueWithDefaultOperators<FontStyleValue> {
public: 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; virtual ~FontStyleValue() override = default;

View file

@ -16,9 +16,9 @@ namespace Web::CSS {
class FrequencyStyleValue : public StyleValueWithDefaultOperators<FrequencyStyleValue> { class FrequencyStyleValue : public StyleValueWithDefaultOperators<FrequencyStyleValue> {
public: 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; virtual ~FrequencyStyleValue() override = default;

View file

@ -12,18 +12,22 @@
namespace Web::CSS { namespace Web::CSS {
ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue> GridAreaShorthandStyleValue::create( ErrorOr<ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue>> GridAreaShorthandStyleValue::create(
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_start,
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> column_start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> column_start,
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_end, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_end,
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> column_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 ErrorOr<String> GridAreaShorthandStyleValue::to_string() const

View file

@ -15,12 +15,12 @@ namespace Web::CSS {
class GridAreaShorthandStyleValue final : public StyleValueWithDefaultOperators<GridAreaShorthandStyleValue> { class GridAreaShorthandStyleValue final : public StyleValueWithDefaultOperators<GridAreaShorthandStyleValue> {
public: public:
static ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue> create( static ErrorOr<ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue>> create(
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_start,
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> column_start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> column_start,
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_end, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_end,
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> column_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; virtual ~GridAreaShorthandStyleValue() override = default;
auto row_start() const { return m_properties.row_start; } auto row_start() const { return m_properties.row_start; }

View file

@ -11,9 +11,9 @@
namespace Web::CSS { 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 ErrorOr<String> GridTemplateAreaStyleValue::to_string() const

View file

@ -15,7 +15,7 @@ namespace Web::CSS {
class GridTemplateAreaStyleValue final : public StyleValueWithDefaultOperators<GridTemplateAreaStyleValue> { class GridTemplateAreaStyleValue final : public StyleValueWithDefaultOperators<GridTemplateAreaStyleValue> {
public: 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; virtual ~GridTemplateAreaStyleValue() override = default;
Vector<Vector<String>> const& grid_template_area() const { return m_grid_template_area; } Vector<Vector<String>> const& grid_template_area() const { return m_grid_template_area; }

View file

@ -12,14 +12,16 @@
namespace Web::CSS { 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 ErrorOr<String> GridTrackPlacementShorthandStyleValue::to_string() const

View file

@ -15,8 +15,8 @@ namespace Web::CSS {
class GridTrackPlacementShorthandStyleValue final : public StyleValueWithDefaultOperators<GridTrackPlacementShorthandStyleValue> { class GridTrackPlacementShorthandStyleValue final : public StyleValueWithDefaultOperators<GridTrackPlacementShorthandStyleValue> {
public: public:
static ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue> create(ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> end); static ErrorOr<ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue>> create(ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> end);
static ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue> create(GridTrackPlacement start); static ErrorOr<ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue>> create(GridTrackPlacement start);
virtual ~GridTrackPlacementShorthandStyleValue() override = default; virtual ~GridTrackPlacementShorthandStyleValue() override = default;
auto start() const { return m_properties.start; } auto start() const { return m_properties.start; }

View file

@ -11,9 +11,9 @@
namespace Web::CSS { 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 ErrorOr<String> GridTrackPlacementStyleValue::to_string() const

View file

@ -16,7 +16,7 @@ namespace Web::CSS {
class GridTrackPlacementStyleValue final : public StyleValueWithDefaultOperators<GridTrackPlacementStyleValue> { class GridTrackPlacementStyleValue final : public StyleValueWithDefaultOperators<GridTrackPlacementStyleValue> {
public: public:
static ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue> create(GridTrackPlacement grid_track_placement); static ErrorOr<ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue>> create(GridTrackPlacement grid_track_placement);
virtual ~GridTrackPlacementStyleValue() override = default; virtual ~GridTrackPlacementStyleValue() override = default;
GridTrackPlacement const& grid_track_placement() const { return m_grid_track_placement; } GridTrackPlacement const& grid_track_placement() const { return m_grid_track_placement; }

View file

@ -9,12 +9,12 @@
namespace Web::CSS { namespace Web::CSS {
ValueComparingNonnullRefPtr<GridTrackSizeListShorthandStyleValue> GridTrackSizeListShorthandStyleValue::create( ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListShorthandStyleValue>> GridTrackSizeListShorthandStyleValue::create(
ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue const> areas, ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue const> areas,
ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue const> rows, ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue const> rows,
ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue const> columns) 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 ErrorOr<String> GridTrackSizeListShorthandStyleValue::to_string() const

View file

@ -13,7 +13,7 @@ namespace Web::CSS {
class GridTrackSizeListShorthandStyleValue final : public StyleValueWithDefaultOperators<GridTrackSizeListShorthandStyleValue> { class GridTrackSizeListShorthandStyleValue final : public StyleValueWithDefaultOperators<GridTrackSizeListShorthandStyleValue> {
public: public:
static ValueComparingNonnullRefPtr<GridTrackSizeListShorthandStyleValue> create( static ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListShorthandStyleValue>> create(
ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue const> areas, ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue const> areas,
ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue const> rows, ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue const> rows,
ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue const> columns); ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue const> columns);

View file

@ -16,14 +16,14 @@ ErrorOr<String> GridTrackSizeListStyleValue::to_string() const
return m_grid_track_size_list.to_string(); 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()));
} }
} }

View file

@ -16,10 +16,10 @@ namespace Web::CSS {
class GridTrackSizeListStyleValue final : public StyleValueWithDefaultOperators<GridTrackSizeListStyleValue> { class GridTrackSizeListStyleValue final : public StyleValueWithDefaultOperators<GridTrackSizeListStyleValue> {
public: 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; 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; } CSS::GridTrackSizeList grid_track_size_list() const { return m_grid_track_size_list; }

View file

@ -16,9 +16,9 @@ namespace Web::CSS {
class IdentifierStyleValue final : public StyleValueWithDefaultOperators<IdentifierStyleValue> { class IdentifierStyleValue final : public StyleValueWithDefaultOperators<IdentifierStyleValue> {
public: 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; virtual ~IdentifierStyleValue() override = default;

View file

@ -20,7 +20,10 @@ class ImageStyleValue final
: public AbstractImageStyleValue : public AbstractImageStyleValue
, public ImageResourceClient { , public ImageResourceClient {
public: 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 ~ImageStyleValue() override = default;
virtual ErrorOr<String> to_string() const override; virtual ErrorOr<String> to_string() const override;

View file

@ -12,9 +12,9 @@ namespace Web::CSS {
class InheritStyleValue final : public StyleValueWithDefaultOperators<InheritStyleValue> { class InheritStyleValue final : public StyleValueWithDefaultOperators<InheritStyleValue> {
public: 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; return instance;
} }
virtual ~InheritStyleValue() override = default; virtual ~InheritStyleValue() override = default;

View file

@ -12,9 +12,9 @@ namespace Web::CSS {
class InitialStyleValue final : public StyleValueWithDefaultOperators<InitialStyleValue> { class InitialStyleValue final : public StyleValueWithDefaultOperators<InitialStyleValue> {
public: 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; return instance;
} }
virtual ~InitialStyleValue() override = default; virtual ~InitialStyleValue() override = default;

View file

@ -11,26 +11,26 @@
namespace Web::CSS { namespace Web::CSS {
ValueComparingNonnullRefPtr<LengthStyleValue> LengthStyleValue::create(Length const& length) ErrorOr<ValueComparingNonnullRefPtr<LengthStyleValue>> LengthStyleValue::create(Length const& length)
{ {
VERIFY(!length.is_auto()); VERIFY(!length.is_auto());
if (length.is_px()) { if (length.is_px()) {
if (length.raw_value() == 0) { 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; return value;
} }
if (length.raw_value() == 1) { 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 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 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()) 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; return *this;
} }

View file

@ -15,7 +15,7 @@ namespace Web::CSS {
class LengthStyleValue : public StyleValueWithDefaultOperators<LengthStyleValue> { class LengthStyleValue : public StyleValueWithDefaultOperators<LengthStyleValue> {
public: public:
static ValueComparingNonnullRefPtr<LengthStyleValue> create(Length const&); static ErrorOr<ValueComparingNonnullRefPtr<LengthStyleValue>> create(Length const&);
virtual ~LengthStyleValue() override = default; virtual ~LengthStyleValue() override = default;
Length const& length() const { return m_length; } Length const& length() const { return m_length; }

View file

@ -38,10 +38,10 @@ public:
WebKit 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); 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; virtual ErrorOr<String> to_string() const override;

View file

@ -15,12 +15,12 @@ namespace Web::CSS {
class ListStyleStyleValue final : public StyleValueWithDefaultOperators<ListStyleStyleValue> { class ListStyleStyleValue final : public StyleValueWithDefaultOperators<ListStyleStyleValue> {
public: public:
static ValueComparingNonnullRefPtr<ListStyleStyleValue> create( static ErrorOr<ValueComparingNonnullRefPtr<ListStyleStyleValue>> create(
ValueComparingNonnullRefPtr<StyleValue> position, ValueComparingNonnullRefPtr<StyleValue> position,
ValueComparingNonnullRefPtr<StyleValue> image, ValueComparingNonnullRefPtr<StyleValue> image,
ValueComparingNonnullRefPtr<StyleValue> style_type) 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; virtual ~ListStyleStyleValue() override = default;

View file

@ -15,14 +15,14 @@ namespace Web::CSS {
class NumericStyleValue : public StyleValueWithDefaultOperators<NumericStyleValue> { class NumericStyleValue : public StyleValueWithDefaultOperators<NumericStyleValue> {
public: 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; } virtual bool has_length() const override { return to_number() == 0; }

View file

@ -15,9 +15,9 @@ namespace Web::CSS {
class OverflowStyleValue final : public StyleValueWithDefaultOperators<OverflowStyleValue> { class OverflowStyleValue final : public StyleValueWithDefaultOperators<OverflowStyleValue> {
public: 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; virtual ~OverflowStyleValue() override = default;

View file

@ -16,9 +16,9 @@ namespace Web::CSS {
class PercentageStyleValue final : public StyleValueWithDefaultOperators<PercentageStyleValue> { class PercentageStyleValue final : public StyleValueWithDefaultOperators<PercentageStyleValue> {
public: 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; virtual ~PercentageStyleValue() override = default;

View file

@ -17,9 +17,9 @@ namespace Web::CSS {
class PositionStyleValue final : public StyleValueWithDefaultOperators<PositionStyleValue> { class PositionStyleValue final : public StyleValueWithDefaultOperators<PositionStyleValue> {
public: 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; virtual ~PositionStyleValue() override = default;

View file

@ -44,10 +44,10 @@ public:
using Size = Variant<Extent, CircleSize, EllipseSize>; 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); 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; virtual ErrorOr<String> to_string() const override;

View file

@ -11,9 +11,9 @@
namespace Web::CSS { 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 ErrorOr<String> RectStyleValue::to_string() const

View file

@ -16,7 +16,7 @@ namespace Web::CSS {
class RectStyleValue : public StyleValueWithDefaultOperators<RectStyleValue> { class RectStyleValue : public StyleValueWithDefaultOperators<RectStyleValue> {
public: public:
static ValueComparingNonnullRefPtr<RectStyleValue> create(EdgeRect rect); static ErrorOr<ValueComparingNonnullRefPtr<RectStyleValue>> create(EdgeRect rect);
virtual ~RectStyleValue() override = default; virtual ~RectStyleValue() override = default;
EdgeRect rect() const { return m_rect; } EdgeRect rect() const { return m_rect; }
@ -28,7 +28,7 @@ public:
private: private:
explicit RectStyleValue(EdgeRect rect) explicit RectStyleValue(EdgeRect rect)
: StyleValueWithDefaultOperators(Type::Rect) : StyleValueWithDefaultOperators(Type::Rect)
, m_rect(rect) , m_rect(move(rect))
{ {
} }

View file

@ -13,9 +13,9 @@ namespace Web::CSS {
class ResolutionStyleValue : public StyleValueWithDefaultOperators<ResolutionStyleValue> { class ResolutionStyleValue : public StyleValueWithDefaultOperators<ResolutionStyleValue> {
public: 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; virtual ~ResolutionStyleValue() override = default;

View file

@ -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_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_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); 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();
} }
} }

View file

@ -22,9 +22,9 @@ enum class ShadowPlacement {
class ShadowStyleValue final : public StyleValueWithDefaultOperators<ShadowStyleValue> { class ShadowStyleValue final : public StyleValueWithDefaultOperators<ShadowStyleValue> {
public: 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; virtual ~ShadowStyleValue() override = default;

View file

@ -13,9 +13,9 @@ namespace Web::CSS {
class StringStyleValue : public StyleValueWithDefaultOperators<StringStyleValue> { class StringStyleValue : public StyleValueWithDefaultOperators<StringStyleValue> {
public: 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; virtual ~StringStyleValue() override = default;

View file

@ -19,7 +19,10 @@ public:
Space, Space,
Comma, 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(); } size_t size() const { return m_properties.values.size(); }
StyleValueVector const& values() const { return m_properties.values; } StyleValueVector const& values() const { return m_properties.values; }

View file

@ -15,13 +15,13 @@ namespace Web::CSS {
class TextDecorationStyleValue final : public StyleValueWithDefaultOperators<TextDecorationStyleValue> { class TextDecorationStyleValue final : public StyleValueWithDefaultOperators<TextDecorationStyleValue> {
public: public:
static ValueComparingNonnullRefPtr<TextDecorationStyleValue> create( static ErrorOr<ValueComparingNonnullRefPtr<TextDecorationStyleValue>> create(
ValueComparingNonnullRefPtr<StyleValue> line, ValueComparingNonnullRefPtr<StyleValue> line,
ValueComparingNonnullRefPtr<StyleValue> thickness, ValueComparingNonnullRefPtr<StyleValue> thickness,
ValueComparingNonnullRefPtr<StyleValue> style, ValueComparingNonnullRefPtr<StyleValue> style,
ValueComparingNonnullRefPtr<StyleValue> color) 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; virtual ~TextDecorationStyleValue() override = default;

View file

@ -16,9 +16,9 @@ namespace Web::CSS {
class TimeStyleValue : public StyleValueWithDefaultOperators<TimeStyleValue> { class TimeStyleValue : public StyleValueWithDefaultOperators<TimeStyleValue> {
public: 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; virtual ~TimeStyleValue() override = default;

View file

@ -16,9 +16,9 @@ namespace Web::CSS {
class TransformationStyleValue final : public StyleValueWithDefaultOperators<TransformationStyleValue> { class TransformationStyleValue final : public StyleValueWithDefaultOperators<TransformationStyleValue> {
public: 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; virtual ~TransformationStyleValue() override = default;

View file

@ -14,9 +14,9 @@ namespace Web::CSS {
class URLStyleValue final : public StyleValueWithDefaultOperators<URLStyleValue> { class URLStyleValue final : public StyleValueWithDefaultOperators<URLStyleValue> {
public: 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; virtual ~URLStyleValue() override = default;

View file

@ -17,9 +17,9 @@ namespace Web::CSS {
class UnresolvedStyleValue final : public StyleValue { class UnresolvedStyleValue final : public StyleValue {
public: 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; virtual ~UnresolvedStyleValue() override = default;

View file

@ -15,9 +15,9 @@ namespace Web::CSS {
class UnsetStyleValue final : public StyleValueWithDefaultOperators<UnsetStyleValue> { class UnsetStyleValue final : public StyleValueWithDefaultOperators<UnsetStyleValue> {
public: 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; return instance;
} }
virtual ~UnsetStyleValue() override = default; virtual ~UnsetStyleValue() override = default;

View file

@ -34,11 +34,11 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
if (name.equals_ignoring_ascii_case("bgcolor"sv)) { if (name.equals_ignoring_ascii_case("bgcolor"sv)) {
auto color = Color::from_string(value); auto color = Color::from_string(value);
if (color.has_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)) { } else if (name.equals_ignoring_ascii_case("text"sv)) {
auto color = Color::from_string(value); auto color = Color::from_string(value);
if (color.has_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)) { } else if (name.equals_ignoring_ascii_case("background"sv)) {
VERIFY(m_background_style_value); VERIFY(m_background_style_value);
style.set_property(CSS::PropertyID::BackgroundImage, *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()) if (color.has_value())
document().set_visited_link_color(color.value()); document().set_visited_link_color(color.value());
} else if (name.equals_ignoring_ascii_case("background"sv)) { } 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] { m_background_style_value->on_animate = [this] {
if (layout_node()) { if (layout_node()) {
layout_node()->set_needs_display(); layout_node()->set_needs_display();

View file

@ -32,7 +32,7 @@ void HTMLFontElement::apply_presentational_hints(CSS::StyleProperties& style) co
if (name.equals_ignoring_ascii_case("color"sv)) { if (name.equals_ignoring_ascii_case("color"sv)) {
auto color = Color::from_string(value); auto color = Color::from_string(value);
if (color.has_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());
} }
}); });
} }

View file

@ -32,13 +32,13 @@ void HTMLHeadingElement::apply_presentational_hints(CSS::StyleProperties& style)
for_each_attribute([&](auto& name, auto& value) { for_each_attribute([&](auto& name, auto& value) {
if (name.equals_ignoring_ascii_case("align"sv)) { if (name.equals_ignoring_ascii_case("align"sv)) {
if (value == "left"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) 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) 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) 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());
} }
}); });
} }

View file

@ -78,7 +78,7 @@ JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::
// AD-HOC: We rewrite `display: inline` to `display: inline-block`. // AD-HOC: We rewrite `display: inline` to `display: inline-block`.
// This is required for the internal shadow tree to work correctly in layout. // This is required for the internal shadow tree to work correctly in layout.
if (style->display().is_inline_outside() && style->display().is_flow_inside()) 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); return Element::create_layout_node_for_display_type(document(), style->display(), style, this);
} }

View file

@ -32,7 +32,7 @@ void HTMLMarqueeElement::apply_presentational_hints(CSS::StyleProperties& style)
if (name == HTML::AttributeNames::bgcolor) { if (name == HTML::AttributeNames::bgcolor) {
auto color = Color::from_string(value); auto color = Color::from_string(value);
if (color.has_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());
} }
}); });
} }

View file

@ -32,13 +32,13 @@ void HTMLParagraphElement::apply_presentational_hints(CSS::StyleProperties& styl
for_each_attribute([&](auto& name, auto& value) { for_each_attribute([&](auto& name, auto& value) {
if (name.equals_ignoring_ascii_case("align"sv)) { if (name.equals_ignoring_ascii_case("align"sv)) {
if (value == "left"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) 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) 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) 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());
} }
}); });
} }

View file

@ -31,7 +31,7 @@ void HTMLPreElement::apply_presentational_hints(CSS::StyleProperties& style) con
for_each_attribute([&](auto const& name, auto const&) { for_each_attribute([&](auto const& name, auto const&) {
if (name.equals_ignoring_ascii_case(HTML::AttributeNames::wrap)) 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());
}); });
} }

View file

@ -32,7 +32,7 @@ void HTMLTableCaptionElement::apply_presentational_hints(CSS::StyleProperties& s
for_each_attribute([&](auto& name, auto& value) { for_each_attribute([&](auto& name, auto& value) {
if (name.equals_ignoring_ascii_case("align"sv)) { if (name.equals_ignoring_ascii_case("align"sv)) {
if (value == "bottom"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());
} }
}); });
} }

View file

@ -34,12 +34,12 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl
if (name == HTML::AttributeNames::bgcolor) { if (name == HTML::AttributeNames::bgcolor) {
auto color = Color::from_string(value); auto color = Color::from_string(value);
if (color.has_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; return;
} }
if (name == HTML::AttributeNames::align) { if (name == HTML::AttributeNames::align) {
if (value.equals_ignoring_ascii_case("center"sv) || value.equals_ignoring_ascii_case("middle"sv)) { 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 { } else {
if (auto parsed_value = parse_css_value(CSS::Parser::ParsingContext { document() }, value.view(), CSS::PropertyID::TextAlign)) 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()); style.set_property(CSS::PropertyID::TextAlign, parsed_value.release_nonnull());

View file

@ -56,7 +56,7 @@ void HTMLTableElement::apply_presentational_hints(CSS::StyleProperties& style) c
if (name == HTML::AttributeNames::bgcolor) { if (name == HTML::AttributeNames::bgcolor) {
auto color = Color::from_string(value); auto color = Color::from_string(value);
if (color.has_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; return;
} }
}); });

View file

@ -3830,14 +3830,14 @@ static RefPtr<CSS::StyleValue> parse_current_dimension_value(float value, Utf8Vi
{ {
// 1. If position is past the end of input, then return value as a length. // 1. If position is past the end of input, then return value as a length.
if (position == input.end()) 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. // 2. If the code point at position within input is U+0025 (%), then return value as a percentage.
if (*position == '%') 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. // 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 // 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. // 6. If position is past the end of input, then return value as a length.
if (position == input.end()) 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; 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. // 4. If position is past the end of input, then return value as a length.
if (position == input.end()) 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. // 5. If the code point at position within input is not an ASCII digit, then break.
if (!is_ascii_digit(*position)) if (!is_ascii_digit(*position))

View file

@ -293,11 +293,11 @@ ErrorOr<void> TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::
auto& progress = static_cast<HTML::HTMLProgressElement&>(dom_node); auto& progress = static_cast<HTML::HTMLProgressElement&>(dom_node);
if (!progress.using_system_appearance()) { if (!progress.using_system_appearance()) {
auto bar_style = TRY(style_computer.compute_style(progress, CSS::Selector::PseudoElement::ProgressBar)); 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)); 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(); 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 bar_display = bar_style->display();
auto value_display = value_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); auto progress_bar = DOM::Element::create_layout_node_for_display_type(document, bar_display, bar_style, nullptr);

View file

@ -338,7 +338,7 @@ Gfx::FloatMatrix4x4 StackingContext::get_transformation_matrix(CSS::Transformati
return Gfx::rotation_matrix({ 0.0f, 0.0f, 1.0f }, value(0)); return Gfx::rotation_matrix({ 0.0f, 0.0f, 1.0f }, value(0));
break; break;
default: 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(); return Gfx::FloatMatrix4x4::identity();
} }

View file

@ -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%. // If the `width` attribute is an empty string, it defaults to 100%.
// This matches WebKit and Blink, but not Firefox. The spec is unclear. // This matches WebKit and Blink, but not Firefox. The spec is unclear.
// FIXME: Figure out what to do here. // 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% // 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%. // If the `height` attribute is an empty string, it defaults to 100%.
// This matches WebKit and Blink, but not Firefox. The spec is unclear. // This matches WebKit and Blink, but not Firefox. The spec is unclear.
// FIXME: Figure out what to do here. // 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());
} }
} }