mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 10:18:15 +09:00
LibWeb: Make StyleValue constructors infallible
This commit is contained in:
parent
b2b99aba95
commit
8a8cc18cf4
Notes:
sideshowbarker
2024-07-17 06:51:40 +09:00
Author: https://github.com/AtkinsSJ
Commit: 8a8cc18cf4
Pull-request: https://github.com/SerenityOS/serenity/pull/20663
86 changed files with 352 additions and 352 deletions
|
@ -2692,9 +2692,9 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_aspect_ratio_value(Vector<ComponentVal
|
|||
}
|
||||
|
||||
if (auto_value && ratio_value) {
|
||||
return TRY(StyleValueList::create(
|
||||
return StyleValueList::create(
|
||||
StyleValueVector { auto_value.release_nonnull(), ratio_value.release_nonnull() },
|
||||
StyleValueList::Separator::Space));
|
||||
StyleValueList::Separator::Space);
|
||||
}
|
||||
|
||||
if (ratio_value)
|
||||
|
@ -2890,13 +2890,13 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_background_value(Vector<ComponentValue
|
|||
background_color = initial_background_color;
|
||||
return BackgroundStyleValue::create(
|
||||
background_color.release_nonnull(),
|
||||
TRY(StyleValueList::create(move(background_images), StyleValueList::Separator::Comma)),
|
||||
TRY(StyleValueList::create(move(background_positions), StyleValueList::Separator::Comma)),
|
||||
TRY(StyleValueList::create(move(background_sizes), StyleValueList::Separator::Comma)),
|
||||
TRY(StyleValueList::create(move(background_repeats), StyleValueList::Separator::Comma)),
|
||||
TRY(StyleValueList::create(move(background_attachments), StyleValueList::Separator::Comma)),
|
||||
TRY(StyleValueList::create(move(background_origins), StyleValueList::Separator::Comma)),
|
||||
TRY(StyleValueList::create(move(background_clips), StyleValueList::Separator::Comma)));
|
||||
StyleValueList::create(move(background_images), StyleValueList::Separator::Comma),
|
||||
StyleValueList::create(move(background_positions), StyleValueList::Separator::Comma),
|
||||
StyleValueList::create(move(background_sizes), StyleValueList::Separator::Comma),
|
||||
StyleValueList::create(move(background_repeats), StyleValueList::Separator::Comma),
|
||||
StyleValueList::create(move(background_attachments), StyleValueList::Separator::Comma),
|
||||
StyleValueList::create(move(background_origins), StyleValueList::Separator::Comma),
|
||||
StyleValueList::create(move(background_clips), StyleValueList::Separator::Comma));
|
||||
}
|
||||
|
||||
if (!background_color)
|
||||
|
@ -3096,8 +3096,8 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_single_background_position_value(Token
|
|||
|
||||
transaction.commit();
|
||||
return PositionStyleValue::create(
|
||||
TRY(EdgeStyleValue::create(horizontal->edge, horizontal->offset)),
|
||||
TRY(EdgeStyleValue::create(vertical->edge, vertical->offset)));
|
||||
EdgeStyleValue::create(horizontal->edge, horizontal->offset),
|
||||
EdgeStyleValue::create(vertical->edge, vertical->offset));
|
||||
}
|
||||
|
||||
ErrorOr<RefPtr<StyleValue>> Parser::parse_single_background_position_x_or_y_value(TokenStream<ComponentValue>& tokens, PropertyID property)
|
||||
|
@ -3398,14 +3398,14 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_border_radius_shorthand_value(Vector<C
|
|||
|| (reading_vertical && vertical_radii.is_empty()))
|
||||
return nullptr;
|
||||
|
||||
auto top_left_radius = TRY(BorderRadiusStyleValue::create(top_left(horizontal_radii),
|
||||
vertical_radii.is_empty() ? top_left(horizontal_radii) : top_left(vertical_radii)));
|
||||
auto top_right_radius = TRY(BorderRadiusStyleValue::create(top_right(horizontal_radii),
|
||||
vertical_radii.is_empty() ? top_right(horizontal_radii) : top_right(vertical_radii)));
|
||||
auto bottom_right_radius = TRY(BorderRadiusStyleValue::create(bottom_right(horizontal_radii),
|
||||
vertical_radii.is_empty() ? bottom_right(horizontal_radii) : bottom_right(vertical_radii)));
|
||||
auto bottom_left_radius = TRY(BorderRadiusStyleValue::create(bottom_left(horizontal_radii),
|
||||
vertical_radii.is_empty() ? bottom_left(horizontal_radii) : bottom_left(vertical_radii)));
|
||||
auto top_left_radius = BorderRadiusStyleValue::create(top_left(horizontal_radii),
|
||||
vertical_radii.is_empty() ? top_left(horizontal_radii) : top_left(vertical_radii));
|
||||
auto top_right_radius = BorderRadiusStyleValue::create(top_right(horizontal_radii),
|
||||
vertical_radii.is_empty() ? top_right(horizontal_radii) : top_right(vertical_radii));
|
||||
auto bottom_right_radius = BorderRadiusStyleValue::create(bottom_right(horizontal_radii),
|
||||
vertical_radii.is_empty() ? bottom_right(horizontal_radii) : bottom_right(vertical_radii));
|
||||
auto bottom_left_radius = BorderRadiusStyleValue::create(bottom_left(horizontal_radii),
|
||||
vertical_radii.is_empty() ? bottom_left(horizontal_radii) : bottom_left(vertical_radii));
|
||||
|
||||
return BorderRadiusShorthandStyleValue::create(move(top_left_radius), move(top_right_radius), move(bottom_right_radius), move(bottom_left_radius));
|
||||
}
|
||||
|
@ -3520,9 +3520,9 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_single_shadow_value(TokenStream<Compon
|
|||
|
||||
// Other lengths default to 0
|
||||
if (!blur_radius)
|
||||
blur_radius = TRY(LengthStyleValue::create(Length::make_px(0)));
|
||||
blur_radius = LengthStyleValue::create(Length::make_px(0));
|
||||
if (!spread_distance)
|
||||
spread_distance = TRY(LengthStyleValue::create(Length::make_px(0)));
|
||||
spread_distance = LengthStyleValue::create(Length::make_px(0));
|
||||
|
||||
// Placement is outer by default
|
||||
if (!placement.has_value())
|
||||
|
@ -3590,9 +3590,9 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_content_value(Vector<ComponentValue> c
|
|||
|
||||
RefPtr<StyleValueList> alt_text;
|
||||
if (!alt_text_values.is_empty())
|
||||
alt_text = TRY(StyleValueList::create(move(alt_text_values), StyleValueList::Separator::Space));
|
||||
alt_text = StyleValueList::create(move(alt_text_values), StyleValueList::Separator::Space);
|
||||
|
||||
return ContentStyleValue::create(TRY(StyleValueList::create(move(content_values), StyleValueList::Separator::Space)), move(alt_text));
|
||||
return ContentStyleValue::create(StyleValueList::create(move(content_values), StyleValueList::Separator::Space), move(alt_text));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/css-display-3/#the-display-properties
|
||||
|
@ -3949,18 +3949,18 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_flex_value(Vector<ComponentValue> cons
|
|||
case PropertyID::FlexGrow: {
|
||||
// NOTE: The spec says that flex-basis should be 0 here, but other engines currently use 0%.
|
||||
// https://github.com/w3c/csswg-drafts/issues/5742
|
||||
auto flex_basis = TRY(PercentageStyleValue::create(Percentage(0)));
|
||||
auto one = TRY(NumberStyleValue::create(1));
|
||||
auto flex_basis = PercentageStyleValue::create(Percentage(0));
|
||||
auto one = NumberStyleValue::create(1);
|
||||
return FlexStyleValue::create(*value, one, flex_basis);
|
||||
}
|
||||
case PropertyID::FlexBasis: {
|
||||
auto one = TRY(NumberStyleValue::create(1));
|
||||
auto one = NumberStyleValue::create(1);
|
||||
return FlexStyleValue::create(one, one, *value);
|
||||
}
|
||||
case PropertyID::Flex: {
|
||||
if (value->is_identifier() && value->to_identifier() == ValueID::None) {
|
||||
auto zero = TRY(NumberStyleValue::create(0));
|
||||
return FlexStyleValue::create(zero, zero, TRY(IdentifierStyleValue::create(ValueID::Auto)));
|
||||
auto zero = NumberStyleValue::create(0);
|
||||
return FlexStyleValue::create(zero, zero, IdentifierStyleValue::create(ValueID::Auto));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -4014,7 +4014,7 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_flex_value(Vector<ComponentValue> cons
|
|||
if (!flex_basis) {
|
||||
// NOTE: The spec says that flex-basis should be 0 here, but other engines currently use 0%.
|
||||
// https://github.com/w3c/csswg-drafts/issues/5742
|
||||
flex_basis = TRY(PercentageStyleValue::create(Percentage(0)));
|
||||
flex_basis = PercentageStyleValue::create(Percentage(0));
|
||||
}
|
||||
|
||||
return FlexStyleValue::create(flex_grow.release_nonnull(), flex_shrink.release_nonnull(), flex_basis.release_nonnull());
|
||||
|
@ -4204,7 +4204,7 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_font_family_value(TokenStream<Componen
|
|||
(void)tokens.next_token(); // String
|
||||
if (!next_is_comma_or_eof())
|
||||
return nullptr;
|
||||
TRY(font_families.try_append(TRY(StringStyleValue::create(TRY(String::from_utf8(peek.token().string()))))));
|
||||
TRY(font_families.try_append(StringStyleValue::create(TRY(String::from_utf8(peek.token().string())))));
|
||||
(void)tokens.next_token(); // Comma
|
||||
continue;
|
||||
}
|
||||
|
@ -4224,7 +4224,7 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_font_family_value(TokenStream<Componen
|
|||
(void)tokens.next_token(); // Ident
|
||||
if (!next_is_comma_or_eof())
|
||||
return nullptr;
|
||||
TRY(font_families.try_append(TRY(IdentifierStyleValue::create(maybe_ident.value()))));
|
||||
TRY(font_families.try_append(IdentifierStyleValue::create(maybe_ident.value())));
|
||||
(void)tokens.next_token(); // Comma
|
||||
continue;
|
||||
}
|
||||
|
@ -4236,7 +4236,7 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_font_family_value(TokenStream<Componen
|
|||
if (current_name_parts.is_empty())
|
||||
return nullptr;
|
||||
(void)tokens.next_token(); // Comma
|
||||
TRY(font_families.try_append(TRY(StringStyleValue::create(TRY(String::join(' ', current_name_parts))))));
|
||||
TRY(font_families.try_append(StringStyleValue::create(TRY(String::join(' ', current_name_parts)))));
|
||||
current_name_parts.clear();
|
||||
// Can't have a trailing comma
|
||||
if (!tokens.has_next_token())
|
||||
|
@ -4248,7 +4248,7 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_font_family_value(TokenStream<Componen
|
|||
}
|
||||
|
||||
if (!current_name_parts.is_empty()) {
|
||||
TRY(font_families.try_append(TRY(StringStyleValue::create(TRY(String::join(' ', current_name_parts))))));
|
||||
TRY(font_families.try_append(StringStyleValue::create(TRY(String::join(' ', current_name_parts)))));
|
||||
current_name_parts.clear();
|
||||
}
|
||||
|
||||
|
@ -4515,14 +4515,14 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_list_style_value(Vector<ComponentValue
|
|||
if (found_nones == 2) {
|
||||
if (list_image || list_type)
|
||||
return nullptr;
|
||||
auto none = TRY(IdentifierStyleValue::create(ValueID::None));
|
||||
auto none = IdentifierStyleValue::create(ValueID::None);
|
||||
list_image = none;
|
||||
list_type = none;
|
||||
|
||||
} else if (found_nones == 1) {
|
||||
if (list_image && list_type)
|
||||
return nullptr;
|
||||
auto none = TRY(IdentifierStyleValue::create(ValueID::None));
|
||||
auto none = IdentifierStyleValue::create(ValueID::None);
|
||||
if (!list_image)
|
||||
list_image = none;
|
||||
if (!list_type)
|
||||
|
@ -4762,21 +4762,21 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_easing_value(TokenStream<ComponentValu
|
|||
switch (function_metadata.parameters[argument_index].type) {
|
||||
case EasingFunctionParameterType::Number: {
|
||||
if (value.is(Token::Type::Number))
|
||||
values.append(TRY(NumberStyleValue::create(value.token().number().value())));
|
||||
values.append(NumberStyleValue::create(value.token().number().value()));
|
||||
else
|
||||
return nullptr;
|
||||
break;
|
||||
}
|
||||
case EasingFunctionParameterType::NumberZeroToOne: {
|
||||
if (value.is(Token::Type::Number) && value.token().number_value() >= 0 && value.token().number_value() <= 1)
|
||||
values.append(TRY(NumberStyleValue::create(value.token().number().value())));
|
||||
values.append(NumberStyleValue::create(value.token().number().value()));
|
||||
else
|
||||
return nullptr;
|
||||
break;
|
||||
}
|
||||
case EasingFunctionParameterType::Integer: {
|
||||
if (value.is(Token::Type::Number) && value.token().number().is_integer())
|
||||
values.append(TRY(IntegerStyleValue::create(value.token().number().integer_value())));
|
||||
values.append(IntegerStyleValue::create(value.token().number().integer_value()));
|
||||
else
|
||||
return nullptr;
|
||||
break;
|
||||
|
@ -4860,7 +4860,7 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_transform_value(Vector<ComponentValue>
|
|||
if (maybe_calc_value && maybe_calc_value->resolves_to_angle()) {
|
||||
values.append(maybe_calc_value.release_nonnull());
|
||||
} else if (value.is(Token::Type::Number) && value.token().number_value() == 0) {
|
||||
values.append(TRY(AngleStyleValue::create(Angle::make_degrees(0))));
|
||||
values.append(AngleStyleValue::create(Angle::make_degrees(0)));
|
||||
} else {
|
||||
auto dimension_value = TRY(parse_dimension_value(value));
|
||||
if (!dimension_value || !dimension_value->is_angle())
|
||||
|
@ -4934,7 +4934,7 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_transform_value(Vector<ComponentValue>
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
transformations.append(TRY(TransformationStyleValue::create(function, move(values))));
|
||||
transformations.append(TransformationStyleValue::create(function, move(values)));
|
||||
}
|
||||
return StyleValueList::create(move(transformations), StyleValueList::Separator::Space);
|
||||
}
|
||||
|
@ -4954,7 +4954,7 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_transform_origin_value(Vector<Componen
|
|||
NonnullRefPtr<StyleValue> offset;
|
||||
};
|
||||
|
||||
auto to_axis_offset = [](RefPtr<StyleValue> value) -> ErrorOr<Optional<AxisOffset>> {
|
||||
auto to_axis_offset = [](RefPtr<StyleValue> value) -> Optional<AxisOffset> {
|
||||
if (value->is_percentage())
|
||||
return AxisOffset { Axis::None, value->as_percentage() };
|
||||
if (value->is_length())
|
||||
|
@ -4962,15 +4962,15 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_transform_origin_value(Vector<Componen
|
|||
if (value->is_identifier()) {
|
||||
switch (value->to_identifier()) {
|
||||
case ValueID::Top:
|
||||
return AxisOffset { Axis::Y, TRY(PercentageStyleValue::create(Percentage(0))) };
|
||||
return AxisOffset { Axis::Y, PercentageStyleValue::create(Percentage(0)) };
|
||||
case ValueID::Left:
|
||||
return AxisOffset { Axis::X, TRY(PercentageStyleValue::create(Percentage(0))) };
|
||||
return AxisOffset { Axis::X, PercentageStyleValue::create(Percentage(0)) };
|
||||
case ValueID::Center:
|
||||
return AxisOffset { Axis::None, TRY(PercentageStyleValue::create(Percentage(50))) };
|
||||
return AxisOffset { Axis::None, PercentageStyleValue::create(Percentage(50)) };
|
||||
case ValueID::Bottom:
|
||||
return AxisOffset { Axis::Y, TRY(PercentageStyleValue::create(Percentage(100))) };
|
||||
return AxisOffset { Axis::Y, PercentageStyleValue::create(Percentage(100)) };
|
||||
case ValueID::Right:
|
||||
return AxisOffset { Axis::X, TRY(PercentageStyleValue::create(Percentage(100))) };
|
||||
return AxisOffset { Axis::X, PercentageStyleValue::create(Percentage(100)) };
|
||||
default:
|
||||
return OptionalNone {};
|
||||
}
|
||||
|
@ -4978,7 +4978,7 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_transform_origin_value(Vector<Componen
|
|||
return OptionalNone {};
|
||||
};
|
||||
|
||||
auto make_list = [](NonnullRefPtr<StyleValue> const& x_value, NonnullRefPtr<StyleValue> const& y_value) -> ErrorOr<NonnullRefPtr<StyleValueList>> {
|
||||
auto make_list = [](NonnullRefPtr<StyleValue> const& x_value, NonnullRefPtr<StyleValue> const& y_value) -> NonnullRefPtr<StyleValueList> {
|
||||
StyleValueVector values;
|
||||
values.append(x_value);
|
||||
values.append(y_value);
|
||||
|
@ -4988,7 +4988,7 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_transform_origin_value(Vector<Componen
|
|||
auto tokens = TokenStream { component_values };
|
||||
switch (component_values.size()) {
|
||||
case 1: {
|
||||
auto single_value = TRY(to_axis_offset(TRY(parse_css_value_for_property(PropertyID::TransformOrigin, tokens))));
|
||||
auto single_value = to_axis_offset(TRY(parse_css_value_for_property(PropertyID::TransformOrigin, tokens)));
|
||||
if (!single_value.has_value())
|
||||
return nullptr;
|
||||
// If only one value is specified, the second value is assumed to be center.
|
||||
|
@ -4996,15 +4996,15 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_transform_origin_value(Vector<Componen
|
|||
switch (single_value->axis) {
|
||||
case Axis::None:
|
||||
case Axis::X:
|
||||
return make_list(single_value->offset, TRY(PercentageStyleValue::create(Percentage(50))));
|
||||
return make_list(single_value->offset, PercentageStyleValue::create(Percentage(50)));
|
||||
case Axis::Y:
|
||||
return make_list(TRY(PercentageStyleValue::create(Percentage(50))), single_value->offset);
|
||||
return make_list(PercentageStyleValue::create(Percentage(50)), single_value->offset);
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
case 2: {
|
||||
auto first_value = TRY(to_axis_offset(TRY(parse_css_value_for_property(PropertyID::TransformOrigin, tokens))));
|
||||
auto second_value = TRY(to_axis_offset(TRY(parse_css_value_for_property(PropertyID::TransformOrigin, tokens))));
|
||||
auto first_value = to_axis_offset(TRY(parse_css_value_for_property(PropertyID::TransformOrigin, tokens)));
|
||||
auto second_value = to_axis_offset(TRY(parse_css_value_for_property(PropertyID::TransformOrigin, tokens)));
|
||||
if (!first_value.has_value() || !second_value.has_value())
|
||||
return nullptr;
|
||||
|
||||
|
@ -5685,7 +5685,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
|
|||
}
|
||||
|
||||
if (property_id == PropertyID::Custom || contains_var_or_attr)
|
||||
return FIXME_TRY(UnresolvedStyleValue::create(move(component_values), contains_var_or_attr));
|
||||
return UnresolvedStyleValue::create(move(component_values), contains_var_or_attr);
|
||||
|
||||
if (component_values.is_empty())
|
||||
return ParseError::SyntaxError;
|
||||
|
@ -5904,7 +5904,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
|
|||
return *parsed_values.take_first();
|
||||
|
||||
if (!parsed_values.is_empty() && parsed_values.size() <= property_maximum_value_count(property_id))
|
||||
return FIXME_TRY(StyleValueList::create(move(parsed_values), StyleValueList::Separator::Space));
|
||||
return StyleValueList::create(move(parsed_values), StyleValueList::Separator::Space);
|
||||
}
|
||||
|
||||
// We have multiple values, but the property claims to accept only a single one, check if it's a shorthand property.
|
||||
|
@ -5956,10 +5956,10 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
|
|||
if (it.value.size() == 1)
|
||||
longhand_values.unchecked_append(it.value.take_first());
|
||||
else
|
||||
longhand_values.unchecked_append(FIXME_TRY(StyleValueList::create(move(it.value), StyleValueList::Separator::Space)));
|
||||
longhand_values.unchecked_append(StyleValueList::create(move(it.value), StyleValueList::Separator::Space));
|
||||
}
|
||||
|
||||
return { FIXME_TRY(CompositeStyleValue::create(move(longhand_properties), move(longhand_values))) };
|
||||
return { CompositeStyleValue::create(move(longhand_properties), move(longhand_values)) };
|
||||
#undef FIXME_TRY
|
||||
}
|
||||
|
||||
|
@ -6009,14 +6009,14 @@ ErrorOr<Parser::PropertyAndValue> Parser::parse_css_value_for_properties(Readonl
|
|||
if (ident.has_value()) {
|
||||
if (auto property = any_property_accepts_identifier(property_ids, ident.value()); property.has_value()) {
|
||||
(void)tokens.next_token();
|
||||
return PropertyAndValue { *property, TRY(IdentifierStyleValue::create(ident.value())) };
|
||||
return PropertyAndValue { *property, IdentifierStyleValue::create(ident.value()) };
|
||||
}
|
||||
}
|
||||
|
||||
// Custom idents
|
||||
if (auto property = any_property_accepts_type(property_ids, ValueType::CustomIdent); property.has_value()) {
|
||||
(void)tokens.next_token();
|
||||
return PropertyAndValue { *property, TRY(CustomIdentStyleValue::create(TRY(FlyString::from_utf8(peek_token.token().ident())))) };
|
||||
return PropertyAndValue { *property, CustomIdentStyleValue::create(TRY(FlyString::from_utf8(peek_token.token().ident()))) };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6064,7 +6064,7 @@ ErrorOr<Parser::PropertyAndValue> Parser::parse_css_value_for_properties(Readonl
|
|||
auto percentage = Percentage(peek_token.token().percentage());
|
||||
if (auto property = any_property_accepts_type(property_ids, ValueType::Percentage); property.has_value() && property_accepts_percentage(*property, percentage)) {
|
||||
(void)tokens.next_token();
|
||||
return PropertyAndValue { *property, TRY(PercentageStyleValue::create(percentage)) };
|
||||
return PropertyAndValue { *property, PercentageStyleValue::create(percentage) };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6077,7 +6077,7 @@ ErrorOr<Parser::PropertyAndValue> Parser::parse_css_value_for_properties(Readonl
|
|||
|
||||
if (peek_token.is(Token::Type::String)) {
|
||||
if (auto property = any_property_accepts_type(property_ids, ValueType::String); property.has_value())
|
||||
return PropertyAndValue { *property, TRY(StringStyleValue::create(TRY(String::from_utf8(tokens.next_token().token().string())))) };
|
||||
return PropertyAndValue { *property, StringStyleValue::create(TRY(String::from_utf8(tokens.next_token().token().string()))) };
|
||||
}
|
||||
|
||||
if (auto property = any_property_accepts_type(property_ids, ValueType::Url); property.has_value()) {
|
||||
|
@ -6102,35 +6102,35 @@ ErrorOr<Parser::PropertyAndValue> Parser::parse_css_value_for_properties(Readonl
|
|||
auto angle = dimension.angle();
|
||||
if (auto property = any_property_accepts_type(property_ids, ValueType::Angle); property.has_value() && property_accepts_angle(*property, angle)) {
|
||||
transaction.commit();
|
||||
return PropertyAndValue { *property, TRY(AngleStyleValue::create(angle)) };
|
||||
return PropertyAndValue { *property, AngleStyleValue::create(angle) };
|
||||
}
|
||||
}
|
||||
if (dimension.is_frequency()) {
|
||||
auto frequency = dimension.frequency();
|
||||
if (auto property = any_property_accepts_type(property_ids, ValueType::Frequency); property.has_value() && property_accepts_frequency(*property, frequency)) {
|
||||
transaction.commit();
|
||||
return PropertyAndValue { *property, TRY(FrequencyStyleValue::create(frequency)) };
|
||||
return PropertyAndValue { *property, FrequencyStyleValue::create(frequency) };
|
||||
}
|
||||
}
|
||||
if (dimension.is_length()) {
|
||||
auto length = dimension.length();
|
||||
if (auto property = any_property_accepts_type(property_ids, ValueType::Length); property.has_value() && property_accepts_length(*property, length)) {
|
||||
transaction.commit();
|
||||
return PropertyAndValue { *property, TRY(LengthStyleValue::create(length)) };
|
||||
return PropertyAndValue { *property, LengthStyleValue::create(length) };
|
||||
}
|
||||
}
|
||||
if (dimension.is_resolution()) {
|
||||
auto resolution = dimension.resolution();
|
||||
if (auto property = any_property_accepts_type(property_ids, ValueType::Resolution); property.has_value() && property_accepts_resolution(*property, resolution)) {
|
||||
transaction.commit();
|
||||
return PropertyAndValue { *property, TRY(ResolutionStyleValue::create(resolution)) };
|
||||
return PropertyAndValue { *property, ResolutionStyleValue::create(resolution) };
|
||||
}
|
||||
}
|
||||
if (dimension.is_time()) {
|
||||
auto time = dimension.time();
|
||||
if (auto property = any_property_accepts_type(property_ids, ValueType::Time); property.has_value() && property_accepts_time(*property, time)) {
|
||||
transaction.commit();
|
||||
return PropertyAndValue { *property, TRY(TimeStyleValue::create(time)) };
|
||||
return PropertyAndValue { *property, TimeStyleValue::create(time) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,33 +129,33 @@ static ErrorOr<RefPtr<StyleValue>> style_value_for_display(Display display)
|
|||
StyleValueVector values;
|
||||
switch (display.outside()) {
|
||||
case Display::Outside::Inline:
|
||||
TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::Inline))));
|
||||
TRY(values.try_append(IdentifierStyleValue::create(ValueID::Inline)));
|
||||
break;
|
||||
case Display::Outside::Block:
|
||||
TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::Block))));
|
||||
TRY(values.try_append(IdentifierStyleValue::create(ValueID::Block)));
|
||||
break;
|
||||
case Display::Outside::RunIn:
|
||||
TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::RunIn))));
|
||||
TRY(values.try_append(IdentifierStyleValue::create(ValueID::RunIn)));
|
||||
break;
|
||||
}
|
||||
switch (display.inside()) {
|
||||
case Display::Inside::Flow:
|
||||
TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::Flow))));
|
||||
TRY(values.try_append(IdentifierStyleValue::create(ValueID::Flow)));
|
||||
break;
|
||||
case Display::Inside::FlowRoot:
|
||||
TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::FlowRoot))));
|
||||
TRY(values.try_append(IdentifierStyleValue::create(ValueID::FlowRoot)));
|
||||
break;
|
||||
case Display::Inside::Table:
|
||||
TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::Table))));
|
||||
TRY(values.try_append(IdentifierStyleValue::create(ValueID::Table)));
|
||||
break;
|
||||
case Display::Inside::Flex:
|
||||
TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::Flex))));
|
||||
TRY(values.try_append(IdentifierStyleValue::create(ValueID::Flex)));
|
||||
break;
|
||||
case Display::Inside::Grid:
|
||||
TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::Grid))));
|
||||
TRY(values.try_append(IdentifierStyleValue::create(ValueID::Grid)));
|
||||
break;
|
||||
case Display::Inside::Ruby:
|
||||
TRY(values.try_append(TRY(IdentifierStyleValue::create(ValueID::Ruby))));
|
||||
TRY(values.try_append(IdentifierStyleValue::create(ValueID::Ruby)));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ static NonnullRefPtr<StyleValue const> value_or_default(Optional<StyleProperty>
|
|||
return default_style;
|
||||
}
|
||||
|
||||
static ErrorOr<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())
|
||||
return IdentifierStyleValue::create(ValueID::Auto);
|
||||
|
@ -212,7 +212,7 @@ static ErrorOr<NonnullRefPtr<StyleValue const>> style_value_for_length_percentag
|
|||
return length_percentage.calculated();
|
||||
}
|
||||
|
||||
static ErrorOr<NonnullRefPtr<StyleValue const>> style_value_for_size(Size const& size)
|
||||
static NonnullRefPtr<StyleValue const> style_value_for_size(Size const& size)
|
||||
{
|
||||
if (size.is_none())
|
||||
return IdentifierStyleValue::create(ValueID::None);
|
||||
|
@ -232,7 +232,7 @@ static ErrorOr<NonnullRefPtr<StyleValue const>> style_value_for_size(Size const&
|
|||
TODO();
|
||||
}
|
||||
|
||||
static ErrorOr<NonnullRefPtr<StyleValue const>> style_value_for_sided_shorthand(ValueComparingNonnullRefPtr<StyleValue const> top, ValueComparingNonnullRefPtr<StyleValue const> right, ValueComparingNonnullRefPtr<StyleValue const> bottom, ValueComparingNonnullRefPtr<StyleValue const> left)
|
||||
static NonnullRefPtr<StyleValue const> style_value_for_sided_shorthand(ValueComparingNonnullRefPtr<StyleValue const> top, ValueComparingNonnullRefPtr<StyleValue const> right, ValueComparingNonnullRefPtr<StyleValue const> bottom, ValueComparingNonnullRefPtr<StyleValue const> left)
|
||||
{
|
||||
bool top_and_bottom_same = top == bottom;
|
||||
bool left_and_right_same = left == right;
|
||||
|
@ -249,7 +249,7 @@ static ErrorOr<NonnullRefPtr<StyleValue const>> style_value_for_sided_shorthand(
|
|||
return StyleValueList::create(StyleValueVector { move(top), move(right), move(bottom), move(left) }, StyleValueList::Separator::Space);
|
||||
}
|
||||
|
||||
static ErrorOr<NonnullRefPtr<StyleValue const>> style_value_for_svg_paint(Optional<SVGPaint> const& maybe_paint)
|
||||
static NonnullRefPtr<StyleValue const> style_value_for_svg_paint(Optional<SVGPaint> const& maybe_paint)
|
||||
{
|
||||
if (!maybe_paint.has_value())
|
||||
return IdentifierStyleValue::create(ValueID::None);
|
||||
|
@ -269,29 +269,29 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
|||
case PropertyID::AccentColor: {
|
||||
auto accent_color = layout_node.computed_values().accent_color();
|
||||
if (accent_color.has_value())
|
||||
return TRY(ColorStyleValue::create(accent_color.value()));
|
||||
return TRY(IdentifierStyleValue::create(ValueID::Auto));
|
||||
return ColorStyleValue::create(accent_color.value());
|
||||
return IdentifierStyleValue::create(ValueID::Auto);
|
||||
}
|
||||
case PropertyID::AlignContent:
|
||||
return TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().align_content())));
|
||||
return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().align_content()));
|
||||
case PropertyID::AlignItems:
|
||||
return TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().align_items())));
|
||||
return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().align_items()));
|
||||
case PropertyID::AlignSelf:
|
||||
return TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().align_self())));
|
||||
return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().align_self()));
|
||||
case PropertyID::Appearance:
|
||||
return TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().appearance())));
|
||||
return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().appearance()));
|
||||
case PropertyID::AspectRatio: {
|
||||
auto aspect_ratio = layout_node.computed_values().aspect_ratio();
|
||||
if (aspect_ratio.use_natural_aspect_ratio_if_available && aspect_ratio.preferred_ratio.has_value()) {
|
||||
return TRY(StyleValueList::create(
|
||||
return StyleValueList::create(
|
||||
StyleValueVector {
|
||||
TRY(IdentifierStyleValue::create(ValueID::Auto)),
|
||||
TRY(RatioStyleValue::create(aspect_ratio.preferred_ratio.value())) },
|
||||
StyleValueList::Separator::Space));
|
||||
IdentifierStyleValue::create(ValueID::Auto),
|
||||
RatioStyleValue::create(aspect_ratio.preferred_ratio.value()) },
|
||||
StyleValueList::Separator::Space);
|
||||
}
|
||||
if (aspect_ratio.preferred_ratio.has_value())
|
||||
return TRY(RatioStyleValue::create(aspect_ratio.preferred_ratio.value()));
|
||||
return TRY(IdentifierStyleValue::create(ValueID::Auto));
|
||||
return RatioStyleValue::create(aspect_ratio.preferred_ratio.value());
|
||||
return IdentifierStyleValue::create(ValueID::Auto);
|
||||
}
|
||||
case PropertyID::Background: {
|
||||
auto maybe_background_color = property(PropertyID::BackgroundColor);
|
||||
|
@ -304,14 +304,14 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
|||
auto maybe_background_clip = property(PropertyID::BackgroundClip);
|
||||
|
||||
return BackgroundStyleValue::create(
|
||||
value_or_default(maybe_background_color, TRY(InitialStyleValue::the())),
|
||||
value_or_default(maybe_background_image, TRY(IdentifierStyleValue::create(ValueID::None))),
|
||||
value_or_default(maybe_background_position, TRY(PositionStyleValue::create(TRY(EdgeStyleValue::create(PositionEdge::Left, Length::make_px(0))), TRY(EdgeStyleValue::create(PositionEdge::Top, Length::make_px(0)))))),
|
||||
value_or_default(maybe_background_size, TRY(IdentifierStyleValue::create(ValueID::Auto))),
|
||||
value_or_default(maybe_background_repeat, TRY(BackgroundRepeatStyleValue::create(Repeat::Repeat, Repeat::Repeat))),
|
||||
value_or_default(maybe_background_attachment, TRY(IdentifierStyleValue::create(ValueID::Scroll))),
|
||||
value_or_default(maybe_background_origin, TRY(IdentifierStyleValue::create(ValueID::PaddingBox))),
|
||||
value_or_default(maybe_background_clip, TRY(IdentifierStyleValue::create(ValueID::BorderBox))));
|
||||
value_or_default(maybe_background_color, InitialStyleValue::the()),
|
||||
value_or_default(maybe_background_image, IdentifierStyleValue::create(ValueID::None)),
|
||||
value_or_default(maybe_background_position, PositionStyleValue::create(EdgeStyleValue::create(PositionEdge::Left, Length::make_px(0)), EdgeStyleValue::create(PositionEdge::Top, Length::make_px(0)))),
|
||||
value_or_default(maybe_background_size, IdentifierStyleValue::create(ValueID::Auto)),
|
||||
value_or_default(maybe_background_repeat, BackgroundRepeatStyleValue::create(Repeat::Repeat, Repeat::Repeat)),
|
||||
value_or_default(maybe_background_attachment, IdentifierStyleValue::create(ValueID::Scroll)),
|
||||
value_or_default(maybe_background_origin, IdentifierStyleValue::create(ValueID::PaddingBox)),
|
||||
value_or_default(maybe_background_clip, IdentifierStyleValue::create(ValueID::BorderBox)));
|
||||
}
|
||||
case PropertyID::BackgroundAttachment:
|
||||
return style_value_for_background_property(
|
||||
|
@ -344,13 +344,13 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
|||
layout_node,
|
||||
[](auto& layer) -> ErrorOr<NonnullRefPtr<StyleValue>> {
|
||||
return PositionStyleValue::create(
|
||||
TRY(EdgeStyleValue::create(layer.position_edge_x, layer.position_offset_x)),
|
||||
TRY(EdgeStyleValue::create(layer.position_edge_y, layer.position_offset_y)));
|
||||
EdgeStyleValue::create(layer.position_edge_x, layer.position_offset_x),
|
||||
EdgeStyleValue::create(layer.position_edge_y, layer.position_offset_y));
|
||||
},
|
||||
[]() -> ErrorOr<NonnullRefPtr<StyleValue>> {
|
||||
return PositionStyleValue::create(
|
||||
TRY(EdgeStyleValue::create(PositionEdge::Left, Percentage(0))),
|
||||
TRY(EdgeStyleValue::create(PositionEdge::Top, Percentage(0))));
|
||||
EdgeStyleValue::create(PositionEdge::Left, Percentage(0)),
|
||||
EdgeStyleValue::create(PositionEdge::Top, Percentage(0)));
|
||||
});
|
||||
case PropertyID::BackgroundPositionX:
|
||||
return style_value_for_background_property(
|
||||
|
@ -367,8 +367,8 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
|||
layout_node,
|
||||
[](auto& layer) -> ErrorOr<NonnullRefPtr<StyleValue const>> {
|
||||
StyleValueVector repeat {
|
||||
TRY(IdentifierStyleValue::create(to_value_id(layer.repeat_x))),
|
||||
TRY(IdentifierStyleValue::create(to_value_id(layer.repeat_y))),
|
||||
IdentifierStyleValue::create(to_value_id(layer.repeat_x)),
|
||||
IdentifierStyleValue::create(to_value_id(layer.repeat_y)),
|
||||
};
|
||||
return StyleValueList::create(move(repeat), StyleValueList::Separator::Space);
|
||||
},
|
||||
|
@ -396,16 +396,16 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
|||
// `border` only has a reasonable value if all four sides are the same.
|
||||
if (top != right || top != bottom || top != left)
|
||||
return nullptr;
|
||||
auto width = TRY(LengthStyleValue::create(Length::make_px(top.width)));
|
||||
auto style = TRY(IdentifierStyleValue::create(to_value_id(top.line_style)));
|
||||
auto color = TRY(ColorStyleValue::create(top.color));
|
||||
auto width = LengthStyleValue::create(Length::make_px(top.width));
|
||||
auto style = IdentifierStyleValue::create(to_value_id(top.line_style));
|
||||
auto color = ColorStyleValue::create(top.color);
|
||||
return BorderStyleValue::create(width, style, color);
|
||||
}
|
||||
case PropertyID::BorderBottom: {
|
||||
auto border = layout_node.computed_values().border_bottom();
|
||||
auto width = TRY(LengthStyleValue::create(Length::make_px(border.width)));
|
||||
auto style = TRY(IdentifierStyleValue::create(to_value_id(border.line_style)));
|
||||
auto color = TRY(ColorStyleValue::create(border.color));
|
||||
auto width = LengthStyleValue::create(Length::make_px(border.width));
|
||||
auto style = IdentifierStyleValue::create(to_value_id(border.line_style));
|
||||
auto color = ColorStyleValue::create(border.color);
|
||||
return BorderStyleValue::create(width, style, color);
|
||||
}
|
||||
case PropertyID::BorderBottomColor:
|
||||
|
@ -423,19 +423,19 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
|||
case PropertyID::BorderBottomWidth:
|
||||
return LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_bottom().width));
|
||||
case PropertyID::BorderColor: {
|
||||
auto top = TRY(ColorStyleValue::create(layout_node.computed_values().border_top().color));
|
||||
auto right = TRY(ColorStyleValue::create(layout_node.computed_values().border_right().color));
|
||||
auto bottom = TRY(ColorStyleValue::create(layout_node.computed_values().border_bottom().color));
|
||||
auto left = TRY(ColorStyleValue::create(layout_node.computed_values().border_left().color));
|
||||
auto top = ColorStyleValue::create(layout_node.computed_values().border_top().color);
|
||||
auto right = ColorStyleValue::create(layout_node.computed_values().border_right().color);
|
||||
auto bottom = ColorStyleValue::create(layout_node.computed_values().border_bottom().color);
|
||||
auto left = ColorStyleValue::create(layout_node.computed_values().border_left().color);
|
||||
return style_value_for_sided_shorthand(top, right, bottom, left);
|
||||
}
|
||||
case PropertyID::BorderCollapse:
|
||||
return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_collapse()));
|
||||
case PropertyID::BorderLeft: {
|
||||
auto border = layout_node.computed_values().border_left();
|
||||
auto width = TRY(LengthStyleValue::create(Length::make_px(border.width)));
|
||||
auto style = TRY(IdentifierStyleValue::create(to_value_id(border.line_style)));
|
||||
auto color = TRY(ColorStyleValue::create(border.color));
|
||||
auto width = LengthStyleValue::create(Length::make_px(border.width));
|
||||
auto style = IdentifierStyleValue::create(to_value_id(border.line_style));
|
||||
auto color = ColorStyleValue::create(border.color);
|
||||
return BorderStyleValue::create(width, style, color);
|
||||
}
|
||||
case PropertyID::BorderLeftColor:
|
||||
|
@ -471,9 +471,9 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
|||
}
|
||||
case PropertyID::BorderRight: {
|
||||
auto border = layout_node.computed_values().border_right();
|
||||
auto width = TRY(LengthStyleValue::create(Length::make_px(border.width)));
|
||||
auto style = TRY(IdentifierStyleValue::create(to_value_id(border.line_style)));
|
||||
auto color = TRY(ColorStyleValue::create(border.color));
|
||||
auto width = LengthStyleValue::create(Length::make_px(border.width));
|
||||
auto style = IdentifierStyleValue::create(to_value_id(border.line_style));
|
||||
auto color = ColorStyleValue::create(border.color);
|
||||
return BorderStyleValue::create(width, style, color);
|
||||
}
|
||||
case PropertyID::BorderRightColor:
|
||||
|
@ -489,23 +489,23 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
|||
return LengthStyleValue::create(horizontal);
|
||||
return StyleValueList::create(
|
||||
{
|
||||
TRY(LengthStyleValue::create(horizontal)),
|
||||
TRY(LengthStyleValue::create(vertical)),
|
||||
LengthStyleValue::create(horizontal),
|
||||
LengthStyleValue::create(vertical),
|
||||
},
|
||||
StyleValueList::Separator::Space);
|
||||
}
|
||||
case PropertyID::BorderStyle: {
|
||||
auto top = TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_top().line_style)));
|
||||
auto right = TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_right().line_style)));
|
||||
auto bottom = TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_bottom().line_style)));
|
||||
auto left = TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_left().line_style)));
|
||||
auto top = IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_top().line_style));
|
||||
auto right = IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_right().line_style));
|
||||
auto bottom = IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_bottom().line_style));
|
||||
auto left = IdentifierStyleValue::create(to_value_id(layout_node.computed_values().border_left().line_style));
|
||||
return style_value_for_sided_shorthand(top, right, bottom, left);
|
||||
}
|
||||
case PropertyID::BorderTop: {
|
||||
auto border = layout_node.computed_values().border_top();
|
||||
auto width = TRY(LengthStyleValue::create(Length::make_px(border.width)));
|
||||
auto style = TRY(IdentifierStyleValue::create(to_value_id(border.line_style)));
|
||||
auto color = TRY(ColorStyleValue::create(border.color));
|
||||
auto width = LengthStyleValue::create(Length::make_px(border.width));
|
||||
auto style = IdentifierStyleValue::create(to_value_id(border.line_style));
|
||||
auto color = ColorStyleValue::create(border.color);
|
||||
return BorderStyleValue::create(width, style, color);
|
||||
}
|
||||
case PropertyID::BorderTopColor:
|
||||
|
@ -523,10 +523,10 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
|||
case PropertyID::BorderTopWidth:
|
||||
return LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_top().width));
|
||||
case PropertyID::BorderWidth: {
|
||||
auto top = TRY(LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_top().width)));
|
||||
auto right = TRY(LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_right().width)));
|
||||
auto bottom = TRY(LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_bottom().width)));
|
||||
auto left = TRY(LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_left().width)));
|
||||
auto top = LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_top().width));
|
||||
auto right = LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_right().width));
|
||||
auto bottom = LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_bottom().width));
|
||||
auto left = LengthStyleValue::create(Length::make_px(layout_node.computed_values().border_left().width));
|
||||
return style_value_for_sided_shorthand(top, right, bottom, left);
|
||||
}
|
||||
case PropertyID::Bottom:
|
||||
|
@ -537,10 +537,10 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
|||
return nullptr;
|
||||
|
||||
auto make_box_shadow_style_value = [](ShadowData const& data) -> ErrorOr<NonnullRefPtr<ShadowStyleValue>> {
|
||||
auto offset_x = TRY(LengthStyleValue::create(data.offset_x));
|
||||
auto offset_y = TRY(LengthStyleValue::create(data.offset_y));
|
||||
auto blur_radius = TRY(LengthStyleValue::create(data.blur_radius));
|
||||
auto spread_distance = TRY(LengthStyleValue::create(data.spread_distance));
|
||||
auto offset_x = LengthStyleValue::create(data.offset_x);
|
||||
auto offset_y = LengthStyleValue::create(data.offset_y);
|
||||
auto blur_radius = LengthStyleValue::create(data.blur_radius);
|
||||
auto spread_distance = LengthStyleValue::create(data.spread_distance);
|
||||
return ShadowStyleValue::create(data.color, offset_x, offset_y, blur_radius, spread_distance, data.placement);
|
||||
};
|
||||
|
||||
|
@ -705,9 +705,9 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
|||
case PropertyID::JustifyContent:
|
||||
return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().justify_content()));
|
||||
case PropertyID::JustifyItems:
|
||||
return TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().justify_items())));
|
||||
return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().justify_items()));
|
||||
case PropertyID::JustifySelf:
|
||||
return TRY(IdentifierStyleValue::create(to_value_id(layout_node.computed_values().justify_self())));
|
||||
return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().justify_self()));
|
||||
case PropertyID::Left:
|
||||
return style_value_for_length_percentage(layout_node.computed_values().inset().left());
|
||||
case PropertyID::LineHeight:
|
||||
|
@ -716,10 +716,10 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
|||
return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().list_style_type()));
|
||||
case PropertyID::Margin: {
|
||||
auto margin = layout_node.computed_values().margin();
|
||||
auto top = TRY(style_value_for_length_percentage(margin.top()));
|
||||
auto right = TRY(style_value_for_length_percentage(margin.right()));
|
||||
auto bottom = TRY(style_value_for_length_percentage(margin.bottom()));
|
||||
auto left = TRY(style_value_for_length_percentage(margin.left()));
|
||||
auto top = style_value_for_length_percentage(margin.top());
|
||||
auto right = style_value_for_length_percentage(margin.right());
|
||||
auto bottom = style_value_for_length_percentage(margin.bottom());
|
||||
auto left = style_value_for_length_percentage(margin.left());
|
||||
return style_value_for_sided_shorthand(move(top), move(right), move(bottom), move(left));
|
||||
}
|
||||
case PropertyID::MarginBottom:
|
||||
|
@ -763,10 +763,10 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
|||
return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().overflow_y()));
|
||||
case PropertyID::Padding: {
|
||||
auto padding = layout_node.computed_values().padding();
|
||||
auto top = TRY(style_value_for_length_percentage(padding.top()));
|
||||
auto right = TRY(style_value_for_length_percentage(padding.right()));
|
||||
auto bottom = TRY(style_value_for_length_percentage(padding.bottom()));
|
||||
auto left = TRY(style_value_for_length_percentage(padding.left()));
|
||||
auto top = style_value_for_length_percentage(padding.top());
|
||||
auto right = style_value_for_length_percentage(padding.right());
|
||||
auto bottom = style_value_for_length_percentage(padding.bottom());
|
||||
auto left = style_value_for_length_percentage(padding.left());
|
||||
return style_value_for_sided_shorthand(move(top), move(right), move(bottom), move(left));
|
||||
}
|
||||
case PropertyID::PaddingBottom:
|
||||
|
@ -809,7 +809,7 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
|||
StyleValueVector style_values;
|
||||
TRY(style_values.try_ensure_capacity(text_decoration_lines.size()));
|
||||
for (auto const& line : text_decoration_lines) {
|
||||
style_values.unchecked_append(TRY(IdentifierStyleValue::create(to_value_id(line))));
|
||||
style_values.unchecked_append(IdentifierStyleValue::create(to_value_id(line)));
|
||||
}
|
||||
return StyleValueList::create(move(style_values), StyleValueList::Separator::Space);
|
||||
}
|
||||
|
@ -848,14 +848,14 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
|||
|
||||
StyleValueVector parameters;
|
||||
TRY(parameters.try_ensure_capacity(6));
|
||||
parameters.unchecked_append(TRY(NumberStyleValue::create(affine_matrix.a())));
|
||||
parameters.unchecked_append(TRY(NumberStyleValue::create(affine_matrix.b())));
|
||||
parameters.unchecked_append(TRY(NumberStyleValue::create(affine_matrix.c())));
|
||||
parameters.unchecked_append(TRY(NumberStyleValue::create(affine_matrix.d())));
|
||||
parameters.unchecked_append(TRY(NumberStyleValue::create(affine_matrix.e())));
|
||||
parameters.unchecked_append(TRY(NumberStyleValue::create(affine_matrix.f())));
|
||||
parameters.unchecked_append(NumberStyleValue::create(affine_matrix.a()));
|
||||
parameters.unchecked_append(NumberStyleValue::create(affine_matrix.b()));
|
||||
parameters.unchecked_append(NumberStyleValue::create(affine_matrix.c()));
|
||||
parameters.unchecked_append(NumberStyleValue::create(affine_matrix.d()));
|
||||
parameters.unchecked_append(NumberStyleValue::create(affine_matrix.e()));
|
||||
parameters.unchecked_append(NumberStyleValue::create(affine_matrix.f()));
|
||||
|
||||
NonnullRefPtr<StyleValue> matrix_function = TRY(TransformationStyleValue::create(TransformFunction::Matrix, move(parameters)));
|
||||
NonnullRefPtr<StyleValue> matrix_function = TransformationStyleValue::create(TransformFunction::Matrix, move(parameters));
|
||||
// Elsewhere we always store the transform property's value as a StyleValueList of TransformationStyleValues,
|
||||
// so this is just for consistency.
|
||||
StyleValueVector matrix_functions { matrix_function };
|
||||
|
|
|
@ -688,8 +688,8 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
|
|||
y_positions.unchecked_append(layer);
|
||||
}
|
||||
}
|
||||
set_longhand_property(CSS::PropertyID::BackgroundPositionX, StyleValueList::create(move(x_positions), values_list.separator()).release_value_but_fixme_should_propagate_errors());
|
||||
set_longhand_property(CSS::PropertyID::BackgroundPositionY, StyleValueList::create(move(y_positions), values_list.separator()).release_value_but_fixme_should_propagate_errors());
|
||||
set_longhand_property(CSS::PropertyID::BackgroundPositionX, StyleValueList::create(move(x_positions), values_list.separator()));
|
||||
set_longhand_property(CSS::PropertyID::BackgroundPositionY, StyleValueList::create(move(y_positions), values_list.separator()));
|
||||
} else {
|
||||
set_longhand_property(CSS::PropertyID::BackgroundPositionX, value);
|
||||
set_longhand_property(CSS::PropertyID::BackgroundPositionY, value);
|
||||
|
@ -2320,8 +2320,8 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
|
|||
|
||||
auto found_font = compute_font_for_style_values(element, pseudo_element, font_family, font_size, font_style, font_weight, font_stretch);
|
||||
|
||||
style.set_property(CSS::PropertyID::FontSize, LengthStyleValue::create(CSS::Length::make_px(found_font->pixel_size())).release_value_but_fixme_should_propagate_errors(), nullptr);
|
||||
style.set_property(CSS::PropertyID::FontWeight, NumberStyleValue::create(font_weight->to_font_weight()).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::FontSize, LengthStyleValue::create(CSS::Length::make_px(found_font->pixel_size())), nullptr);
|
||||
style.set_property(CSS::PropertyID::FontWeight, NumberStyleValue::create(font_weight->to_font_weight()));
|
||||
|
||||
style.set_computed_font(found_font.release_nonnull());
|
||||
|
||||
|
@ -2370,8 +2370,8 @@ ErrorOr<void> StyleComputer::absolutize_values(StyleProperties& style, DOM::Elem
|
|||
// because most percentages are relative to containing block metrics.
|
||||
auto line_height_value_slot = style.m_property_values[to_underlying(CSS::PropertyID::LineHeight)].map([](auto& x) -> auto& { return x.style; });
|
||||
if (line_height_value_slot.has_value() && (*line_height_value_slot)->is_percentage()) {
|
||||
*line_height_value_slot = TRY(LengthStyleValue::create(
|
||||
Length::make_px(font_size * static_cast<double>((*line_height_value_slot)->as_percentage().percentage().as_fraction()))));
|
||||
*line_height_value_slot = LengthStyleValue::create(
|
||||
Length::make_px(font_size * static_cast<double>((*line_height_value_slot)->as_percentage().percentage().as_fraction())));
|
||||
}
|
||||
|
||||
auto line_height = style.line_height(viewport_rect(), font_metrics, m_root_element_font_metrics);
|
||||
|
@ -2379,7 +2379,7 @@ ErrorOr<void> StyleComputer::absolutize_values(StyleProperties& style, DOM::Elem
|
|||
|
||||
// NOTE: line-height might be using lh which should be resolved against the parent line height (like we did here already)
|
||||
if (line_height_value_slot.has_value() && (*line_height_value_slot)->is_length())
|
||||
(*line_height_value_slot) = TRY(LengthStyleValue::create(Length::make_px(line_height)));
|
||||
(*line_height_value_slot) = LengthStyleValue::create(Length::make_px(line_height));
|
||||
|
||||
for (size_t i = 0; i < style.m_property_values.size(); ++i) {
|
||||
auto& value_slot = style.m_property_values[i];
|
||||
|
@ -2479,7 +2479,7 @@ void StyleComputer::transform_box_type_if_needed(StyleProperties& style, DOM::El
|
|||
}
|
||||
|
||||
if (new_display != display)
|
||||
style.set_property(CSS::PropertyID::Display, DisplayStyleValue::create(new_display).release_value_but_fixme_should_propagate_errors(), style.property_source_declaration(CSS::PropertyID::Display));
|
||||
style.set_property(CSS::PropertyID::Display, DisplayStyleValue::create(new_display), style.property_source_declaration(CSS::PropertyID::Display));
|
||||
}
|
||||
|
||||
NonnullRefPtr<StyleProperties> StyleComputer::create_document_style() const
|
||||
|
@ -2488,9 +2488,9 @@ NonnullRefPtr<StyleProperties> StyleComputer::create_document_style() const
|
|||
compute_font(style, nullptr, {});
|
||||
compute_defaulted_values(style, nullptr, {});
|
||||
absolutize_values(style, nullptr, {}).release_value_but_fixme_should_propagate_errors();
|
||||
style->set_property(CSS::PropertyID::Width, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().width())).release_value_but_fixme_should_propagate_errors(), nullptr);
|
||||
style->set_property(CSS::PropertyID::Height, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().height())).release_value_but_fixme_should_propagate_errors(), nullptr);
|
||||
style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Block)).release_value_but_fixme_should_propagate_errors(), nullptr);
|
||||
style->set_property(CSS::PropertyID::Width, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().width())), nullptr);
|
||||
style->set_property(CSS::PropertyID::Height, CSS::LengthStyleValue::create(CSS::Length::make_px(viewport_rect().height())), nullptr);
|
||||
style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Block)), nullptr);
|
||||
return style;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ namespace Web::CSS {
|
|||
|
||||
class AngleStyleValue : public StyleValueWithDefaultOperators<AngleStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<AngleStyleValue>> create(Angle angle)
|
||||
static ValueComparingNonnullRefPtr<AngleStyleValue> create(Angle angle)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) AngleStyleValue(move(angle)));
|
||||
return adopt_ref(*new (nothrow) AngleStyleValue(move(angle)));
|
||||
}
|
||||
virtual ~AngleStyleValue() override;
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ namespace Web::CSS {
|
|||
|
||||
class BackgroundRepeatStyleValue final : public StyleValueWithDefaultOperators<BackgroundRepeatStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<BackgroundRepeatStyleValue>> create(Repeat repeat_x, Repeat repeat_y)
|
||||
static ValueComparingNonnullRefPtr<BackgroundRepeatStyleValue> create(Repeat repeat_x, Repeat repeat_y)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) BackgroundRepeatStyleValue(repeat_x, repeat_y));
|
||||
return adopt_ref(*new (nothrow) BackgroundRepeatStyleValue(repeat_x, repeat_y));
|
||||
}
|
||||
virtual ~BackgroundRepeatStyleValue() override;
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ namespace Web::CSS {
|
|||
// NOTE: This is not used for identifier sizes, like `cover` and `contain`.
|
||||
class BackgroundSizeStyleValue final : public StyleValueWithDefaultOperators<BackgroundSizeStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<BackgroundSizeStyleValue>> create(LengthPercentage size_x, LengthPercentage size_y)
|
||||
static ValueComparingNonnullRefPtr<BackgroundSizeStyleValue> create(LengthPercentage size_x, LengthPercentage size_y)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) BackgroundSizeStyleValue(size_x, size_y));
|
||||
return adopt_ref(*new (nothrow) BackgroundSizeStyleValue(size_x, size_y));
|
||||
}
|
||||
virtual ~BackgroundSizeStyleValue() override;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Web::CSS {
|
|||
|
||||
class BackgroundStyleValue final : public StyleValueWithDefaultOperators<BackgroundStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<BackgroundStyleValue>> create(
|
||||
static ValueComparingNonnullRefPtr<BackgroundStyleValue> create(
|
||||
ValueComparingNonnullRefPtr<StyleValue const> color,
|
||||
ValueComparingNonnullRefPtr<StyleValue const> image,
|
||||
ValueComparingNonnullRefPtr<StyleValue const> position,
|
||||
|
@ -25,7 +25,7 @@ public:
|
|||
ValueComparingNonnullRefPtr<StyleValue const> origin,
|
||||
ValueComparingNonnullRefPtr<StyleValue const> clip)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) BackgroundStyleValue(move(color), move(image), move(position), move(size), move(repeat), move(attachment), move(origin), move(clip)));
|
||||
return adopt_ref(*new (nothrow) BackgroundStyleValue(move(color), move(image), move(position), move(size), move(repeat), move(attachment), move(origin), move(clip)));
|
||||
}
|
||||
virtual ~BackgroundStyleValue() override;
|
||||
|
||||
|
|
|
@ -16,13 +16,13 @@ namespace Web::CSS {
|
|||
|
||||
class BorderRadiusShorthandStyleValue final : public StyleValueWithDefaultOperators<BorderRadiusShorthandStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<BorderRadiusShorthandStyleValue>> create(
|
||||
static ValueComparingNonnullRefPtr<BorderRadiusShorthandStyleValue> create(
|
||||
ValueComparingNonnullRefPtr<BorderRadiusStyleValue const> top_left,
|
||||
ValueComparingNonnullRefPtr<BorderRadiusStyleValue const> top_right,
|
||||
ValueComparingNonnullRefPtr<BorderRadiusStyleValue const> bottom_right,
|
||||
ValueComparingNonnullRefPtr<BorderRadiusStyleValue const> bottom_left)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) BorderRadiusShorthandStyleValue(move(top_left), move(top_right), move(bottom_right), move(bottom_left)));
|
||||
return adopt_ref(*new (nothrow) BorderRadiusShorthandStyleValue(move(top_left), move(top_right), move(bottom_right), move(bottom_left)));
|
||||
}
|
||||
virtual ~BorderRadiusShorthandStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ namespace Web::CSS {
|
|||
|
||||
class BorderRadiusStyleValue final : public StyleValueWithDefaultOperators<BorderRadiusStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<BorderRadiusStyleValue>> create(LengthPercentage const& horizontal_radius, LengthPercentage const& vertical_radius)
|
||||
static ValueComparingNonnullRefPtr<BorderRadiusStyleValue> create(LengthPercentage const& horizontal_radius, LengthPercentage const& vertical_radius)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) BorderRadiusStyleValue(horizontal_radius, vertical_radius));
|
||||
return adopt_ref(*new (nothrow) BorderRadiusStyleValue(horizontal_radius, vertical_radius));
|
||||
}
|
||||
virtual ~BorderRadiusStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -15,12 +15,12 @@ namespace Web::CSS {
|
|||
|
||||
class BorderStyleValue final : public StyleValueWithDefaultOperators<BorderStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<BorderStyleValue>> create(
|
||||
static ValueComparingNonnullRefPtr<BorderStyleValue> create(
|
||||
ValueComparingNonnullRefPtr<StyleValue> border_width,
|
||||
ValueComparingNonnullRefPtr<StyleValue> border_style,
|
||||
ValueComparingNonnullRefPtr<StyleValue> border_color)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) BorderStyleValue(move(border_width), move(border_style), move(border_color)));
|
||||
return adopt_ref(*new (nothrow) BorderStyleValue(move(border_width), move(border_style), move(border_color)));
|
||||
}
|
||||
virtual ~BorderStyleValue() override;
|
||||
|
||||
|
|
|
@ -66,9 +66,9 @@ public:
|
|||
Value m_value;
|
||||
};
|
||||
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<CalculatedStyleValue>> create(NonnullOwnPtr<CalculationNode> calculation, CSSNumericType resolved_type)
|
||||
static ValueComparingNonnullRefPtr<CalculatedStyleValue> create(NonnullOwnPtr<CalculationNode> calculation, CSSNumericType resolved_type)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) CalculatedStyleValue(move(calculation), resolved_type));
|
||||
return adopt_ref(*new (nothrow) CalculatedStyleValue(move(calculation), resolved_type));
|
||||
}
|
||||
|
||||
ErrorOr<String> to_string() const override;
|
||||
|
|
|
@ -12,24 +12,24 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
ErrorOr<ValueComparingNonnullRefPtr<ColorStyleValue>> ColorStyleValue::create(Color color)
|
||||
ValueComparingNonnullRefPtr<ColorStyleValue> ColorStyleValue::create(Color color)
|
||||
{
|
||||
if (color.value() == 0) {
|
||||
static auto transparent = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ColorStyleValue(color)));
|
||||
static auto transparent = adopt_ref(*new (nothrow) ColorStyleValue(color));
|
||||
return transparent;
|
||||
}
|
||||
|
||||
if (color == Color::from_rgb(0x000000)) {
|
||||
static auto black = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ColorStyleValue(color)));
|
||||
static auto black = adopt_ref(*new (nothrow) ColorStyleValue(color));
|
||||
return black;
|
||||
}
|
||||
|
||||
if (color == Color::from_rgb(0xffffff)) {
|
||||
static auto white = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ColorStyleValue(color)));
|
||||
static auto white = adopt_ref(*new (nothrow) ColorStyleValue(color));
|
||||
return white;
|
||||
}
|
||||
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) ColorStyleValue(color));
|
||||
return adopt_ref(*new (nothrow) ColorStyleValue(color));
|
||||
}
|
||||
|
||||
ErrorOr<String> ColorStyleValue::to_string() const
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Web::CSS {
|
|||
|
||||
class ColorStyleValue : public StyleValueWithDefaultOperators<ColorStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<ColorStyleValue>> create(Color color);
|
||||
static ValueComparingNonnullRefPtr<ColorStyleValue> create(Color color);
|
||||
virtual ~ColorStyleValue() override = default;
|
||||
|
||||
Color color() const { return m_color; }
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace Web::CSS {
|
|||
|
||||
class CompositeStyleValue final : public StyleValueWithDefaultOperators<CompositeStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<CompositeStyleValue>> create(Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values)
|
||||
static ValueComparingNonnullRefPtr<CompositeStyleValue> create(Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new CompositeStyleValue(move(sub_properties), move(values)));
|
||||
return adopt_ref(*new CompositeStyleValue(move(sub_properties), move(values)));
|
||||
}
|
||||
virtual ~CompositeStyleValue() override;
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@ namespace Web::CSS {
|
|||
|
||||
class ConicGradientStyleValue final : public AbstractImageStyleValue {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<ConicGradientStyleValue>> create(Angle from_angle, PositionValue position, Vector<AngularColorStopListElement> color_stop_list, GradientRepeating repeating)
|
||||
static ValueComparingNonnullRefPtr<ConicGradientStyleValue> create(Angle from_angle, PositionValue position, Vector<AngularColorStopListElement> color_stop_list, GradientRepeating repeating)
|
||||
{
|
||||
VERIFY(color_stop_list.size() >= 2);
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) ConicGradientStyleValue(from_angle, position, move(color_stop_list), repeating));
|
||||
return adopt_ref(*new (nothrow) ConicGradientStyleValue(from_angle, position, move(color_stop_list), repeating));
|
||||
}
|
||||
|
||||
virtual ErrorOr<String> to_string() const override;
|
||||
|
|
|
@ -15,9 +15,9 @@ namespace Web::CSS {
|
|||
|
||||
class ContentStyleValue final : public StyleValueWithDefaultOperators<ContentStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<ContentStyleValue>> create(ValueComparingNonnullRefPtr<StyleValueList> content, ValueComparingRefPtr<StyleValueList> alt_text)
|
||||
static ValueComparingNonnullRefPtr<ContentStyleValue> create(ValueComparingNonnullRefPtr<StyleValueList> content, ValueComparingRefPtr<StyleValueList> alt_text)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) ContentStyleValue(move(content), move(alt_text)));
|
||||
return adopt_ref(*new (nothrow) ContentStyleValue(move(content), move(alt_text)));
|
||||
}
|
||||
virtual ~ContentStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ namespace Web::CSS {
|
|||
// https://www.w3.org/TR/css-values-4/#custom-idents
|
||||
class CustomIdentStyleValue final : public StyleValueWithDefaultOperators<CustomIdentStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<CustomIdentStyleValue>> create(FlyString custom_ident)
|
||||
static ValueComparingNonnullRefPtr<CustomIdentStyleValue> create(FlyString custom_ident)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) CustomIdentStyleValue(move(custom_ident)));
|
||||
return adopt_ref(*new (nothrow) CustomIdentStyleValue(move(custom_ident)));
|
||||
}
|
||||
virtual ~CustomIdentStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
ErrorOr<ValueComparingNonnullRefPtr<DisplayStyleValue>> DisplayStyleValue::create(Display const& display)
|
||||
ValueComparingNonnullRefPtr<DisplayStyleValue> DisplayStyleValue::create(Display const& display)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) DisplayStyleValue(display));
|
||||
return adopt_ref(*new (nothrow) DisplayStyleValue(display));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Web::CSS {
|
|||
|
||||
class DisplayStyleValue : public StyleValueWithDefaultOperators<DisplayStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<DisplayStyleValue>> create(Display const&);
|
||||
static ValueComparingNonnullRefPtr<DisplayStyleValue> create(Display const&);
|
||||
virtual ~DisplayStyleValue() override = default;
|
||||
|
||||
virtual ErrorOr<String> to_string() const override { return m_display.to_string(); }
|
||||
|
|
|
@ -17,9 +17,9 @@ namespace Web::CSS {
|
|||
|
||||
class EasingStyleValue final : public StyleValueWithDefaultOperators<EasingStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<EasingStyleValue>> create(CSS::EasingFunction easing_function, StyleValueVector&& values)
|
||||
static ValueComparingNonnullRefPtr<EasingStyleValue> create(CSS::EasingFunction easing_function, StyleValueVector&& values)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) EasingStyleValue(easing_function, move(values)));
|
||||
return adopt_ref(*new (nothrow) EasingStyleValue(easing_function, move(values)));
|
||||
}
|
||||
virtual ~EasingStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ namespace Web::CSS {
|
|||
|
||||
class EdgeStyleValue final : public StyleValueWithDefaultOperators<EdgeStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<EdgeStyleValue>> create(PositionEdge edge, LengthPercentage const& offset)
|
||||
static ValueComparingNonnullRefPtr<EdgeStyleValue> create(PositionEdge edge, LengthPercentage const& offset)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) EdgeStyleValue(edge, offset));
|
||||
return adopt_ref(*new (nothrow) EdgeStyleValue(edge, offset));
|
||||
}
|
||||
virtual ~EdgeStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -70,11 +70,11 @@ using FilterFunction = Variant<Filter::Blur, Filter::DropShadow, Filter::HueRota
|
|||
|
||||
class FilterValueListStyleValue final : public StyleValueWithDefaultOperators<FilterValueListStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<FilterValueListStyleValue>> create(
|
||||
static ValueComparingNonnullRefPtr<FilterValueListStyleValue> create(
|
||||
Vector<FilterFunction> filter_value_list)
|
||||
{
|
||||
VERIFY(filter_value_list.size() >= 1);
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) FilterValueListStyleValue(move(filter_value_list)));
|
||||
return adopt_ref(*new (nothrow) FilterValueListStyleValue(move(filter_value_list)));
|
||||
}
|
||||
|
||||
Vector<FilterFunction> const& filter_value_list() const { return m_filter_value_list; }
|
||||
|
|
|
@ -15,9 +15,9 @@ namespace Web::CSS {
|
|||
|
||||
class FlexFlowStyleValue final : public StyleValueWithDefaultOperators<FlexFlowStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<FlexFlowStyleValue>> create(ValueComparingNonnullRefPtr<StyleValue> flex_direction, ValueComparingNonnullRefPtr<StyleValue> flex_wrap)
|
||||
static ValueComparingNonnullRefPtr<FlexFlowStyleValue> create(ValueComparingNonnullRefPtr<StyleValue> flex_direction, ValueComparingNonnullRefPtr<StyleValue> flex_wrap)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) FlexFlowStyleValue(move(flex_direction), move(flex_wrap)));
|
||||
return adopt_ref(*new (nothrow) FlexFlowStyleValue(move(flex_direction), move(flex_wrap)));
|
||||
}
|
||||
virtual ~FlexFlowStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -15,12 +15,12 @@ namespace Web::CSS {
|
|||
|
||||
class FlexStyleValue final : public StyleValueWithDefaultOperators<FlexStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<FlexStyleValue>> create(
|
||||
static ValueComparingNonnullRefPtr<FlexStyleValue> create(
|
||||
ValueComparingNonnullRefPtr<StyleValue> grow,
|
||||
ValueComparingNonnullRefPtr<StyleValue> shrink,
|
||||
ValueComparingNonnullRefPtr<StyleValue> basis)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) FlexStyleValue(move(grow), move(shrink), move(basis)));
|
||||
return adopt_ref(*new (nothrow) FlexStyleValue(move(grow), move(shrink), move(basis)));
|
||||
}
|
||||
virtual ~FlexStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Web::CSS {
|
|||
|
||||
class FontStyleValue final : public StyleValueWithDefaultOperators<FontStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<FontStyleValue>> create(
|
||||
static ValueComparingNonnullRefPtr<FontStyleValue> create(
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_stretch,
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_style,
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_weight,
|
||||
|
@ -23,7 +23,7 @@ public:
|
|||
ValueComparingNonnullRefPtr<StyleValue> line_height,
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_families)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) FontStyleValue(move(font_stretch), move(font_style), move(font_weight), move(font_size), move(line_height), move(font_families)));
|
||||
return adopt_ref(*new (nothrow) FontStyleValue(move(font_stretch), move(font_style), move(font_weight), move(font_size), move(line_height), move(font_families)));
|
||||
}
|
||||
virtual ~FontStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ namespace Web::CSS {
|
|||
|
||||
class FrequencyStyleValue : public StyleValueWithDefaultOperators<FrequencyStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<FrequencyStyleValue>> create(Frequency frequency)
|
||||
static ValueComparingNonnullRefPtr<FrequencyStyleValue> create(Frequency frequency)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) FrequencyStyleValue(move(frequency)));
|
||||
return adopt_ref(*new (nothrow) FrequencyStyleValue(move(frequency)));
|
||||
}
|
||||
virtual ~FrequencyStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -12,22 +12,22 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
ErrorOr<ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue>> GridAreaShorthandStyleValue::create(
|
||||
ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue> GridAreaShorthandStyleValue::create(
|
||||
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_start,
|
||||
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> column_start,
|
||||
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_end,
|
||||
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> column_end)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) GridAreaShorthandStyleValue(row_start, column_start, row_end, column_end));
|
||||
return adopt_ref(*new (nothrow) GridAreaShorthandStyleValue(row_start, column_start, row_end, column_end));
|
||||
}
|
||||
|
||||
ErrorOr<ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue>> GridAreaShorthandStyleValue::create(GridTrackPlacement row_start, GridTrackPlacement column_start, GridTrackPlacement row_end, GridTrackPlacement column_end)
|
||||
ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue> GridAreaShorthandStyleValue::create(GridTrackPlacement row_start, GridTrackPlacement column_start, GridTrackPlacement row_end, GridTrackPlacement column_end)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) GridAreaShorthandStyleValue(
|
||||
TRY(GridTrackPlacementStyleValue::create(row_start)),
|
||||
TRY(GridTrackPlacementStyleValue::create(column_start)),
|
||||
TRY(GridTrackPlacementStyleValue::create(row_end)),
|
||||
TRY(GridTrackPlacementStyleValue::create(column_end))));
|
||||
return adopt_ref(*new (nothrow) GridAreaShorthandStyleValue(
|
||||
GridTrackPlacementStyleValue::create(row_start),
|
||||
GridTrackPlacementStyleValue::create(column_start),
|
||||
GridTrackPlacementStyleValue::create(row_end),
|
||||
GridTrackPlacementStyleValue::create(column_end)));
|
||||
}
|
||||
|
||||
ErrorOr<String> GridAreaShorthandStyleValue::to_string() const
|
||||
|
|
|
@ -15,12 +15,12 @@ namespace Web::CSS {
|
|||
|
||||
class GridAreaShorthandStyleValue final : public StyleValueWithDefaultOperators<GridAreaShorthandStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue>> create(
|
||||
static ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue> create(
|
||||
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_start,
|
||||
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> column_start,
|
||||
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> row_end,
|
||||
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> column_end);
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue>> create(GridTrackPlacement row_start, GridTrackPlacement column_start, GridTrackPlacement row_end, GridTrackPlacement column_end);
|
||||
static ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue> create(GridTrackPlacement row_start, GridTrackPlacement column_start, GridTrackPlacement row_end, GridTrackPlacement column_end);
|
||||
virtual ~GridAreaShorthandStyleValue() override = default;
|
||||
|
||||
auto row_start() const { return m_properties.row_start; }
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
ErrorOr<ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue>> GridTemplateAreaStyleValue::create(Vector<Vector<String>> grid_template_area)
|
||||
ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue> GridTemplateAreaStyleValue::create(Vector<Vector<String>> grid_template_area)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) GridTemplateAreaStyleValue(grid_template_area));
|
||||
return adopt_ref(*new (nothrow) GridTemplateAreaStyleValue(grid_template_area));
|
||||
}
|
||||
|
||||
ErrorOr<String> GridTemplateAreaStyleValue::to_string() const
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Web::CSS {
|
|||
|
||||
class GridTemplateAreaStyleValue final : public StyleValueWithDefaultOperators<GridTemplateAreaStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue>> create(Vector<Vector<String>> grid_template_area);
|
||||
static ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue> create(Vector<Vector<String>> grid_template_area);
|
||||
virtual ~GridTemplateAreaStyleValue() override = default;
|
||||
|
||||
Vector<Vector<String>> const& grid_template_area() const { return m_grid_template_area; }
|
||||
|
|
|
@ -12,16 +12,16 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
ErrorOr<ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue>> GridTrackPlacementShorthandStyleValue::create(ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> end)
|
||||
ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue> GridTrackPlacementShorthandStyleValue::create(ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> end)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackPlacementShorthandStyleValue(move(start), move(end)));
|
||||
return adopt_ref(*new (nothrow) GridTrackPlacementShorthandStyleValue(move(start), move(end)));
|
||||
}
|
||||
|
||||
ErrorOr<ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue>> GridTrackPlacementShorthandStyleValue::create(GridTrackPlacement start)
|
||||
ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue> GridTrackPlacementShorthandStyleValue::create(GridTrackPlacement start)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackPlacementShorthandStyleValue(
|
||||
TRY(GridTrackPlacementStyleValue::create(start)),
|
||||
TRY(GridTrackPlacementStyleValue::create(GridTrackPlacement::make_auto()))));
|
||||
return adopt_ref(*new (nothrow) GridTrackPlacementShorthandStyleValue(
|
||||
GridTrackPlacementStyleValue::create(start),
|
||||
GridTrackPlacementStyleValue::create(GridTrackPlacement::make_auto())));
|
||||
}
|
||||
|
||||
ErrorOr<String> GridTrackPlacementShorthandStyleValue::to_string() const
|
||||
|
|
|
@ -15,8 +15,8 @@ namespace Web::CSS {
|
|||
|
||||
class GridTrackPlacementShorthandStyleValue final : public StyleValueWithDefaultOperators<GridTrackPlacementShorthandStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue>> create(ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> end);
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue>> create(GridTrackPlacement start);
|
||||
static ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue> create(ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> start, ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue const> end);
|
||||
static ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue> create(GridTrackPlacement start);
|
||||
virtual ~GridTrackPlacementShorthandStyleValue() override = default;
|
||||
|
||||
auto start() const { return m_properties.start; }
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
ErrorOr<ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue>> GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement grid_track_placement)
|
||||
ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue> GridTrackPlacementStyleValue::create(CSS::GridTrackPlacement grid_track_placement)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackPlacementStyleValue(grid_track_placement));
|
||||
return adopt_ref(*new (nothrow) GridTrackPlacementStyleValue(grid_track_placement));
|
||||
}
|
||||
|
||||
ErrorOr<String> GridTrackPlacementStyleValue::to_string() const
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Web::CSS {
|
|||
|
||||
class GridTrackPlacementStyleValue final : public StyleValueWithDefaultOperators<GridTrackPlacementStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue>> create(GridTrackPlacement grid_track_placement);
|
||||
static ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue> create(GridTrackPlacement grid_track_placement);
|
||||
virtual ~GridTrackPlacementStyleValue() override = default;
|
||||
|
||||
GridTrackPlacement const& grid_track_placement() const { return m_grid_track_placement; }
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListShorthandStyleValue>> GridTrackSizeListShorthandStyleValue::create(
|
||||
ValueComparingNonnullRefPtr<GridTrackSizeListShorthandStyleValue> GridTrackSizeListShorthandStyleValue::create(
|
||||
ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue const> areas,
|
||||
ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue const> rows,
|
||||
ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue const> columns)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackSizeListShorthandStyleValue(move(areas), move(rows), move(columns)));
|
||||
return adopt_ref(*new (nothrow) GridTrackSizeListShorthandStyleValue(move(areas), move(rows), move(columns)));
|
||||
}
|
||||
|
||||
ErrorOr<String> GridTrackSizeListShorthandStyleValue::to_string() const
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Web::CSS {
|
|||
|
||||
class GridTrackSizeListShorthandStyleValue final : public StyleValueWithDefaultOperators<GridTrackSizeListShorthandStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListShorthandStyleValue>> create(
|
||||
static ValueComparingNonnullRefPtr<GridTrackSizeListShorthandStyleValue> create(
|
||||
ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue const> areas,
|
||||
ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue const> rows,
|
||||
ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue const> columns);
|
||||
|
|
|
@ -16,19 +16,19 @@ ErrorOr<String> GridTrackSizeListStyleValue::to_string() const
|
|||
return m_grid_track_size_list.to_string();
|
||||
}
|
||||
|
||||
ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue>> GridTrackSizeListStyleValue::create(CSS::GridTrackSizeList grid_track_size_list)
|
||||
ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue> GridTrackSizeListStyleValue::create(CSS::GridTrackSizeList grid_track_size_list)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackSizeListStyleValue(grid_track_size_list));
|
||||
return adopt_ref(*new (nothrow) GridTrackSizeListStyleValue(grid_track_size_list));
|
||||
}
|
||||
|
||||
ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue>> GridTrackSizeListStyleValue::make_auto()
|
||||
ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue> GridTrackSizeListStyleValue::make_auto()
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackSizeListStyleValue(CSS::GridTrackSizeList()));
|
||||
return adopt_ref(*new (nothrow) GridTrackSizeListStyleValue(CSS::GridTrackSizeList()));
|
||||
}
|
||||
|
||||
ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue>> GridTrackSizeListStyleValue::make_none()
|
||||
ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue> GridTrackSizeListStyleValue::make_none()
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) GridTrackSizeListStyleValue(CSS::GridTrackSizeList()));
|
||||
return adopt_ref(*new (nothrow) GridTrackSizeListStyleValue(CSS::GridTrackSizeList()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@ namespace Web::CSS {
|
|||
|
||||
class GridTrackSizeListStyleValue final : public StyleValueWithDefaultOperators<GridTrackSizeListStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue>> create(CSS::GridTrackSizeList grid_track_size_list);
|
||||
static ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue> create(CSS::GridTrackSizeList grid_track_size_list);
|
||||
virtual ~GridTrackSizeListStyleValue() override = default;
|
||||
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue>> make_auto();
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue>> make_none();
|
||||
static ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue> make_auto();
|
||||
static ValueComparingNonnullRefPtr<GridTrackSizeListStyleValue> make_none();
|
||||
|
||||
CSS::GridTrackSizeList grid_track_size_list() const { return m_grid_track_size_list; }
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ namespace Web::CSS {
|
|||
|
||||
class IdentifierStyleValue final : public StyleValueWithDefaultOperators<IdentifierStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<IdentifierStyleValue>> create(ValueID id)
|
||||
static ValueComparingNonnullRefPtr<IdentifierStyleValue> create(ValueID id)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) IdentifierStyleValue(id));
|
||||
return adopt_ref(*new (nothrow) IdentifierStyleValue(id));
|
||||
}
|
||||
virtual ~IdentifierStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@ class ImageStyleValue final
|
|||
: public AbstractImageStyleValue
|
||||
, public Weakable<ImageStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<ImageStyleValue>> create(AK::URL const& url)
|
||||
static ValueComparingNonnullRefPtr<ImageStyleValue> create(AK::URL const& url)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) ImageStyleValue(url));
|
||||
return adopt_ref(*new (nothrow) ImageStyleValue(url));
|
||||
}
|
||||
virtual ~ImageStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace Web::CSS {
|
|||
|
||||
class InheritStyleValue final : public StyleValueWithDefaultOperators<InheritStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<InheritStyleValue>> the()
|
||||
static ValueComparingNonnullRefPtr<InheritStyleValue> the()
|
||||
{
|
||||
static ValueComparingNonnullRefPtr<InheritStyleValue> instance = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) InheritStyleValue));
|
||||
static ValueComparingNonnullRefPtr<InheritStyleValue> instance = adopt_ref(*new (nothrow) InheritStyleValue);
|
||||
return instance;
|
||||
}
|
||||
virtual ~InheritStyleValue() override = default;
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace Web::CSS {
|
|||
|
||||
class InitialStyleValue final : public StyleValueWithDefaultOperators<InitialStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<InitialStyleValue>> the()
|
||||
static ValueComparingNonnullRefPtr<InitialStyleValue> the()
|
||||
{
|
||||
static ValueComparingNonnullRefPtr<InitialStyleValue> instance = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) InitialStyleValue));
|
||||
static ValueComparingNonnullRefPtr<InitialStyleValue> instance = adopt_ref(*new (nothrow) InitialStyleValue);
|
||||
return instance;
|
||||
}
|
||||
virtual ~InitialStyleValue() override = default;
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace Web::CSS {
|
|||
|
||||
class IntegerStyleValue : public StyleValueWithDefaultOperators<IntegerStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<IntegerStyleValue>> create(i64 value)
|
||||
static ValueComparingNonnullRefPtr<IntegerStyleValue> create(i64 value)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) IntegerStyleValue(value));
|
||||
return adopt_ref(*new (nothrow) IntegerStyleValue(value));
|
||||
}
|
||||
|
||||
i64 integer() const { return m_value; }
|
||||
|
|
|
@ -11,20 +11,20 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
ErrorOr<ValueComparingNonnullRefPtr<LengthStyleValue>> LengthStyleValue::create(Length const& length)
|
||||
ValueComparingNonnullRefPtr<LengthStyleValue> LengthStyleValue::create(Length const& length)
|
||||
{
|
||||
VERIFY(!length.is_auto());
|
||||
if (length.is_px()) {
|
||||
if (length.raw_value() == 0) {
|
||||
static auto value = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) LengthStyleValue(CSS::Length::make_px(0))));
|
||||
static auto value = adopt_ref(*new (nothrow) LengthStyleValue(CSS::Length::make_px(0)));
|
||||
return value;
|
||||
}
|
||||
if (length.raw_value() == 1) {
|
||||
static auto value = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) LengthStyleValue(CSS::Length::make_px(1))));
|
||||
static auto value = adopt_ref(*new (nothrow) LengthStyleValue(CSS::Length::make_px(1)));
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) LengthStyleValue(length));
|
||||
return adopt_ref(*new (nothrow) LengthStyleValue(length));
|
||||
}
|
||||
|
||||
ErrorOr<ValueComparingNonnullRefPtr<StyleValue const>> LengthStyleValue::absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace Web::CSS {
|
|||
|
||||
class LengthStyleValue : public StyleValueWithDefaultOperators<LengthStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<LengthStyleValue>> create(Length const&);
|
||||
static ValueComparingNonnullRefPtr<LengthStyleValue> create(Length const&);
|
||||
virtual ~LengthStyleValue() override = default;
|
||||
|
||||
Length const& length() const { return m_length; }
|
||||
|
|
|
@ -38,10 +38,10 @@ public:
|
|||
WebKit
|
||||
};
|
||||
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<LinearGradientStyleValue>> create(GradientDirection direction, Vector<LinearColorStopListElement> color_stop_list, GradientType type, GradientRepeating repeating)
|
||||
static ValueComparingNonnullRefPtr<LinearGradientStyleValue> create(GradientDirection direction, Vector<LinearColorStopListElement> color_stop_list, GradientType type, GradientRepeating repeating)
|
||||
{
|
||||
VERIFY(color_stop_list.size() >= 2);
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) LinearGradientStyleValue(direction, move(color_stop_list), type, repeating));
|
||||
return adopt_ref(*new (nothrow) LinearGradientStyleValue(direction, move(color_stop_list), type, repeating));
|
||||
}
|
||||
|
||||
virtual ErrorOr<String> to_string() const override;
|
||||
|
|
|
@ -15,12 +15,12 @@ namespace Web::CSS {
|
|||
|
||||
class ListStyleStyleValue final : public StyleValueWithDefaultOperators<ListStyleStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<ListStyleStyleValue>> create(
|
||||
static ValueComparingNonnullRefPtr<ListStyleStyleValue> create(
|
||||
ValueComparingNonnullRefPtr<StyleValue> position,
|
||||
ValueComparingNonnullRefPtr<StyleValue> image,
|
||||
ValueComparingNonnullRefPtr<StyleValue> style_type)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) ListStyleStyleValue(move(position), move(image), move(style_type)));
|
||||
return adopt_ref(*new (nothrow) ListStyleStyleValue(move(position), move(image), move(style_type)));
|
||||
}
|
||||
virtual ~ListStyleStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@ namespace Web::CSS {
|
|||
|
||||
class NumberStyleValue : public StyleValueWithDefaultOperators<NumberStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<NumberStyleValue>> create(double value)
|
||||
static ValueComparingNonnullRefPtr<NumberStyleValue> create(double value)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) NumberStyleValue(value));
|
||||
return adopt_ref(*new (nothrow) NumberStyleValue(value));
|
||||
}
|
||||
|
||||
double number() const { return m_value; }
|
||||
|
|
|
@ -15,9 +15,9 @@ namespace Web::CSS {
|
|||
|
||||
class OverflowStyleValue final : public StyleValueWithDefaultOperators<OverflowStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<OverflowStyleValue>> create(ValueComparingNonnullRefPtr<StyleValue> overflow_x, ValueComparingNonnullRefPtr<StyleValue> overflow_y)
|
||||
static ValueComparingNonnullRefPtr<OverflowStyleValue> create(ValueComparingNonnullRefPtr<StyleValue> overflow_x, ValueComparingNonnullRefPtr<StyleValue> overflow_y)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) OverflowStyleValue(move(overflow_x), move(overflow_y)));
|
||||
return adopt_ref(*new (nothrow) OverflowStyleValue(move(overflow_x), move(overflow_y)));
|
||||
}
|
||||
virtual ~OverflowStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ namespace Web::CSS {
|
|||
|
||||
class PercentageStyleValue final : public StyleValueWithDefaultOperators<PercentageStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<PercentageStyleValue>> create(Percentage percentage)
|
||||
static ValueComparingNonnullRefPtr<PercentageStyleValue> create(Percentage percentage)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) PercentageStyleValue(move(percentage)));
|
||||
return adopt_ref(*new (nothrow) PercentageStyleValue(move(percentage)));
|
||||
}
|
||||
virtual ~PercentageStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace Web::CSS {
|
|||
|
||||
class PlaceContentStyleValue final : public StyleValueWithDefaultOperators<PlaceContentStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<PlaceContentStyleValue>> create(ValueComparingNonnullRefPtr<StyleValue> align_content, ValueComparingNonnullRefPtr<StyleValue> justify_content)
|
||||
static ValueComparingNonnullRefPtr<PlaceContentStyleValue> create(ValueComparingNonnullRefPtr<StyleValue> align_content, ValueComparingNonnullRefPtr<StyleValue> justify_content)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) PlaceContentStyleValue(move(align_content), move(justify_content)));
|
||||
return adopt_ref(*new (nothrow) PlaceContentStyleValue(move(align_content), move(justify_content)));
|
||||
}
|
||||
virtual ~PlaceContentStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace Web::CSS {
|
|||
|
||||
class PlaceItemsStyleValue final : public StyleValueWithDefaultOperators<PlaceItemsStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<PlaceItemsStyleValue>> create(ValueComparingNonnullRefPtr<StyleValue> align_items, ValueComparingNonnullRefPtr<StyleValue> justify_items)
|
||||
static ValueComparingNonnullRefPtr<PlaceItemsStyleValue> create(ValueComparingNonnullRefPtr<StyleValue> align_items, ValueComparingNonnullRefPtr<StyleValue> justify_items)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) PlaceItemsStyleValue(move(align_items), move(justify_items)));
|
||||
return adopt_ref(*new (nothrow) PlaceItemsStyleValue(move(align_items), move(justify_items)));
|
||||
}
|
||||
virtual ~PlaceItemsStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace Web::CSS {
|
|||
|
||||
class PlaceSelfStyleValue final : public StyleValueWithDefaultOperators<PlaceSelfStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<PlaceSelfStyleValue>> create(ValueComparingNonnullRefPtr<StyleValue> align_self, ValueComparingNonnullRefPtr<StyleValue> justify_self)
|
||||
static ValueComparingNonnullRefPtr<PlaceSelfStyleValue> create(ValueComparingNonnullRefPtr<StyleValue> align_self, ValueComparingNonnullRefPtr<StyleValue> justify_self)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) PlaceSelfStyleValue(move(align_self), move(justify_self)));
|
||||
return adopt_ref(*new (nothrow) PlaceSelfStyleValue(move(align_self), move(justify_self)));
|
||||
}
|
||||
virtual ~PlaceSelfStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ namespace Web::CSS {
|
|||
|
||||
class PositionStyleValue final : public StyleValueWithDefaultOperators<PositionStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<PositionStyleValue>> create(ValueComparingNonnullRefPtr<StyleValue> egde_x, ValueComparingNonnullRefPtr<StyleValue> edge_y)
|
||||
static ValueComparingNonnullRefPtr<PositionStyleValue> create(ValueComparingNonnullRefPtr<StyleValue> egde_x, ValueComparingNonnullRefPtr<StyleValue> edge_y)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) PositionStyleValue(move(egde_x), move(edge_y)));
|
||||
return adopt_ref(*new (nothrow) PositionStyleValue(move(egde_x), move(edge_y)));
|
||||
}
|
||||
virtual ~PositionStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -44,10 +44,10 @@ public:
|
|||
|
||||
using Size = Variant<Extent, CircleSize, EllipseSize>;
|
||||
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<RadialGradientStyleValue>> create(EndingShape ending_shape, Size size, PositionValue position, Vector<LinearColorStopListElement> color_stop_list, GradientRepeating repeating)
|
||||
static ValueComparingNonnullRefPtr<RadialGradientStyleValue> create(EndingShape ending_shape, Size size, PositionValue position, Vector<LinearColorStopListElement> color_stop_list, GradientRepeating repeating)
|
||||
{
|
||||
VERIFY(color_stop_list.size() >= 2);
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) RadialGradientStyleValue(ending_shape, size, position, move(color_stop_list), repeating));
|
||||
return adopt_ref(*new (nothrow) RadialGradientStyleValue(ending_shape, size, position, move(color_stop_list), repeating));
|
||||
}
|
||||
|
||||
virtual ErrorOr<String> to_string() const override;
|
||||
|
|
|
@ -13,9 +13,9 @@ namespace Web::CSS {
|
|||
|
||||
class RatioStyleValue final : public StyleValueWithDefaultOperators<RatioStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<RatioStyleValue>> create(Ratio ratio)
|
||||
static ValueComparingNonnullRefPtr<RatioStyleValue> create(Ratio ratio)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) RatioStyleValue(move(ratio)));
|
||||
return adopt_ref(*new (nothrow) RatioStyleValue(move(ratio)));
|
||||
}
|
||||
virtual ~RatioStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
ErrorOr<ValueComparingNonnullRefPtr<RectStyleValue>> RectStyleValue::create(EdgeRect rect)
|
||||
ValueComparingNonnullRefPtr<RectStyleValue> RectStyleValue::create(EdgeRect rect)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) RectStyleValue(move(rect)));
|
||||
return adopt_ref(*new (nothrow) RectStyleValue(move(rect)));
|
||||
}
|
||||
|
||||
ErrorOr<String> RectStyleValue::to_string() const
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Web::CSS {
|
|||
|
||||
class RectStyleValue : public StyleValueWithDefaultOperators<RectStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<RectStyleValue>> create(EdgeRect rect);
|
||||
static ValueComparingNonnullRefPtr<RectStyleValue> create(EdgeRect rect);
|
||||
virtual ~RectStyleValue() override = default;
|
||||
|
||||
EdgeRect rect() const { return m_rect; }
|
||||
|
|
|
@ -13,9 +13,9 @@ namespace Web::CSS {
|
|||
|
||||
class ResolutionStyleValue : public StyleValueWithDefaultOperators<ResolutionStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<ResolutionStyleValue>> create(Resolution resolution)
|
||||
static ValueComparingNonnullRefPtr<ResolutionStyleValue> create(Resolution resolution)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) ResolutionStyleValue(move(resolution)));
|
||||
return adopt_ref(*new (nothrow) ResolutionStyleValue(move(resolution)));
|
||||
}
|
||||
virtual ~ResolutionStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace Web::CSS {
|
|||
|
||||
class RevertStyleValue final : public StyleValueWithDefaultOperators<RevertStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<RevertStyleValue>> the()
|
||||
static ValueComparingNonnullRefPtr<RevertStyleValue> the()
|
||||
{
|
||||
static ValueComparingNonnullRefPtr<RevertStyleValue> instance = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) RevertStyleValue));
|
||||
static ValueComparingNonnullRefPtr<RevertStyleValue> instance = adopt_ref(*new (nothrow) RevertStyleValue);
|
||||
return instance;
|
||||
}
|
||||
virtual ~RevertStyleValue() override = default;
|
||||
|
|
|
@ -22,7 +22,7 @@ enum class ShadowPlacement {
|
|||
|
||||
class ShadowStyleValue final : public StyleValueWithDefaultOperators<ShadowStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<ShadowStyleValue>> create(
|
||||
static ValueComparingNonnullRefPtr<ShadowStyleValue> create(
|
||||
Color color,
|
||||
ValueComparingNonnullRefPtr<StyleValue const> offset_x,
|
||||
ValueComparingNonnullRefPtr<StyleValue const> offset_y,
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
ValueComparingNonnullRefPtr<StyleValue const> spread_distance,
|
||||
ShadowPlacement placement)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) ShadowStyleValue(color, move(offset_x), move(offset_y), move(blur_radius), move(spread_distance), placement));
|
||||
return adopt_ref(*new (nothrow) ShadowStyleValue(color, move(offset_x), move(offset_y), move(blur_radius), move(spread_distance), placement));
|
||||
}
|
||||
virtual ~ShadowStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ namespace Web::CSS {
|
|||
|
||||
class StringStyleValue : public StyleValueWithDefaultOperators<StringStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<StringStyleValue>> create(String const& string)
|
||||
static ValueComparingNonnullRefPtr<StringStyleValue> create(String const& string)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) StringStyleValue(string));
|
||||
return adopt_ref(*new (nothrow) StringStyleValue(string));
|
||||
}
|
||||
virtual ~StringStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ public:
|
|||
Space,
|
||||
Comma,
|
||||
};
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<StyleValueList>> create(StyleValueVector&& values, Separator separator)
|
||||
static ValueComparingNonnullRefPtr<StyleValueList> create(StyleValueVector&& values, Separator separator)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) StyleValueList(move(values), separator));
|
||||
return adopt_ref(*new (nothrow) StyleValueList(move(values), separator));
|
||||
}
|
||||
|
||||
size_t size() const { return m_properties.values.size(); }
|
||||
|
|
|
@ -15,13 +15,13 @@ namespace Web::CSS {
|
|||
|
||||
class TextDecorationStyleValue final : public StyleValueWithDefaultOperators<TextDecorationStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<TextDecorationStyleValue>> create(
|
||||
static ValueComparingNonnullRefPtr<TextDecorationStyleValue> create(
|
||||
ValueComparingNonnullRefPtr<StyleValue> line,
|
||||
ValueComparingNonnullRefPtr<StyleValue> thickness,
|
||||
ValueComparingNonnullRefPtr<StyleValue> style,
|
||||
ValueComparingNonnullRefPtr<StyleValue> color)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) TextDecorationStyleValue(move(line), move(thickness), move(style), move(color)));
|
||||
return adopt_ref(*new (nothrow) TextDecorationStyleValue(move(line), move(thickness), move(style), move(color)));
|
||||
}
|
||||
virtual ~TextDecorationStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ namespace Web::CSS {
|
|||
|
||||
class TimeStyleValue : public StyleValueWithDefaultOperators<TimeStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<TimeStyleValue>> create(Time time)
|
||||
static ValueComparingNonnullRefPtr<TimeStyleValue> create(Time time)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) TimeStyleValue(move(time)));
|
||||
return adopt_ref(*new (nothrow) TimeStyleValue(move(time)));
|
||||
}
|
||||
virtual ~TimeStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ namespace Web::CSS {
|
|||
|
||||
class TransformationStyleValue final : public StyleValueWithDefaultOperators<TransformationStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<TransformationStyleValue>> create(CSS::TransformFunction transform_function, StyleValueVector&& values)
|
||||
static ValueComparingNonnullRefPtr<TransformationStyleValue> create(CSS::TransformFunction transform_function, StyleValueVector&& values)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) TransformationStyleValue(transform_function, move(values)));
|
||||
return adopt_ref(*new (nothrow) TransformationStyleValue(transform_function, move(values)));
|
||||
}
|
||||
virtual ~TransformationStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ namespace Web::CSS {
|
|||
|
||||
class URLStyleValue final : public StyleValueWithDefaultOperators<URLStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<URLStyleValue>> create(AK::URL const& url)
|
||||
static ValueComparingNonnullRefPtr<URLStyleValue> create(AK::URL const& url)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) URLStyleValue(url));
|
||||
return adopt_ref(*new (nothrow) URLStyleValue(url));
|
||||
}
|
||||
|
||||
virtual ~URLStyleValue() override = default;
|
||||
|
|
|
@ -17,9 +17,9 @@ namespace Web::CSS {
|
|||
|
||||
class UnresolvedStyleValue final : public StyleValue {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<UnresolvedStyleValue>> create(Vector<Parser::ComponentValue>&& values, bool contains_var_or_attr)
|
||||
static ValueComparingNonnullRefPtr<UnresolvedStyleValue> create(Vector<Parser::ComponentValue>&& values, bool contains_var_or_attr)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) UnresolvedStyleValue(move(values), contains_var_or_attr));
|
||||
return adopt_ref(*new (nothrow) UnresolvedStyleValue(move(values), contains_var_or_attr));
|
||||
}
|
||||
virtual ~UnresolvedStyleValue() override = default;
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@ namespace Web::CSS {
|
|||
|
||||
class UnsetStyleValue final : public StyleValueWithDefaultOperators<UnsetStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<UnsetStyleValue>> the()
|
||||
static ValueComparingNonnullRefPtr<UnsetStyleValue> the()
|
||||
{
|
||||
static ValueComparingNonnullRefPtr<UnsetStyleValue> instance = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) UnsetStyleValue));
|
||||
static ValueComparingNonnullRefPtr<UnsetStyleValue> instance = adopt_ref(*new (nothrow) UnsetStyleValue);
|
||||
return instance;
|
||||
}
|
||||
virtual ~UnsetStyleValue() override = default;
|
||||
|
|
|
@ -35,12 +35,12 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
|
|||
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value
|
||||
auto color = parse_legacy_color_value(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors(), nullptr);
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()), nullptr);
|
||||
} else if (name.equals_ignoring_ascii_case("text"sv)) {
|
||||
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value-2
|
||||
auto color = parse_legacy_color_value(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors(), nullptr);
|
||||
style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()), nullptr);
|
||||
} else if (name.equals_ignoring_ascii_case("background"sv)) {
|
||||
VERIFY(m_background_style_value);
|
||||
style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value, nullptr);
|
||||
|
@ -67,7 +67,7 @@ void HTMLBodyElement::attribute_changed(DeprecatedFlyString const& name, Depreca
|
|||
if (color.has_value())
|
||||
document().set_visited_link_color(color.value());
|
||||
} else if (name.equals_ignoring_ascii_case("background"sv)) {
|
||||
m_background_style_value = CSS::ImageStyleValue::create(document().parse_url(value)).release_value_but_fixme_should_propagate_errors();
|
||||
m_background_style_value = CSS::ImageStyleValue::create(document().parse_url(value));
|
||||
m_background_style_value->on_animate = [this] {
|
||||
if (layout_node()) {
|
||||
layout_node()->set_needs_display();
|
||||
|
|
|
@ -24,13 +24,13 @@ void HTMLDivElement::apply_presentational_hints(CSS::StyleProperties& style) con
|
|||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_ascii_case("align"sv)) {
|
||||
if (value.equals_ignoring_ascii_case("left"sv))
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebLeft).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebLeft));
|
||||
else if (value.equals_ignoring_ascii_case("right"sv))
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebRight).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebRight));
|
||||
else if (value.equals_ignoring_ascii_case("center"sv))
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebCenter).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebCenter));
|
||||
else if (value.equals_ignoring_ascii_case("justify"sv))
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ void HTMLFontElement::apply_presentational_hints(CSS::StyleProperties& style) co
|
|||
// https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3:rules-for-parsing-a-legacy-colour-value
|
||||
auto color = parse_legacy_color_value(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -31,13 +31,13 @@ void HTMLHeadingElement::apply_presentational_hints(CSS::StyleProperties& style)
|
|||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_ascii_case("align"sv)) {
|
||||
if (value == "left"sv)
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Left).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Left));
|
||||
else if (value == "right"sv)
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Right).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Right));
|
||||
else if (value == "center"sv)
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Center).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Center));
|
||||
else if (value == "justify"sv)
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::
|
|||
// AD-HOC: We rewrite `display: inline` to `display: inline-block`.
|
||||
// This is required for the internal shadow tree to work correctly in layout.
|
||||
if (style->display().is_inline_outside() && style->display().is_flow_inside())
|
||||
style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::InlineBlock)).release_value_but_fixme_should_propagate_errors());
|
||||
style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::InlineBlock)));
|
||||
|
||||
return Element::create_layout_node_for_display_type(document(), style->display(), style, this);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ void HTMLMarqueeElement::apply_presentational_hints(CSS::StyleProperties& style)
|
|||
// https://html.spec.whatwg.org/multipage/rendering.html#the-marquee-element-2:rules-for-parsing-a-legacy-colour-value
|
||||
auto color = parse_legacy_color_value(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -31,13 +31,13 @@ void HTMLParagraphElement::apply_presentational_hints(CSS::StyleProperties& styl
|
|||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_ascii_case("align"sv)) {
|
||||
if (value == "left"sv)
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Left).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Left));
|
||||
else if (value == "right"sv)
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Right).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Right));
|
||||
else if (value == "center"sv)
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Center).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Center));
|
||||
else if (value == "justify"sv)
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Justify));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ void HTMLPreElement::apply_presentational_hints(CSS::StyleProperties& style) con
|
|||
|
||||
for_each_attribute([&](auto const& name, auto const&) {
|
||||
if (name.equals_ignoring_ascii_case(HTML::AttributeNames::wrap))
|
||||
style.set_property(CSS::PropertyID::WhiteSpace, CSS::IdentifierStyleValue::create(CSS::ValueID::PreWrap).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::WhiteSpace, CSS::IdentifierStyleValue::create(CSS::ValueID::PreWrap));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ void HTMLTableCaptionElement::apply_presentational_hints(CSS::StyleProperties& s
|
|||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_ascii_case("align"sv)) {
|
||||
if (value == "bottom"sv)
|
||||
style.set_property(CSS::PropertyID::CaptionSide, CSS::IdentifierStyleValue::create(CSS::ValueID::Bottom).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::CaptionSide, CSS::IdentifierStyleValue::create(CSS::ValueID::Bottom));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl
|
|||
// https://html.spec.whatwg.org/multipage/rendering.html#tables-2:rules-for-parsing-a-legacy-colour-value
|
||||
auto color = parse_legacy_color_value(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()));
|
||||
return;
|
||||
}
|
||||
if (name == HTML::AttributeNames::valign) {
|
||||
|
@ -46,7 +46,7 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl
|
|||
}
|
||||
if (name == HTML::AttributeNames::align) {
|
||||
if (value.equals_ignoring_ascii_case("center"sv) || value.equals_ignoring_ascii_case("middle"sv)) {
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebCenter).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebCenter));
|
||||
} else {
|
||||
if (auto parsed_value = parse_css_value(CSS::Parser::ParsingContext { document() }, value.view(), CSS::PropertyID::TextAlign).release_value_but_fixme_should_propagate_errors())
|
||||
style.set_property(CSS::PropertyID::TextAlign, parsed_value.release_nonnull());
|
||||
|
@ -63,7 +63,7 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl
|
|||
return;
|
||||
} else if (name == HTML::AttributeNames::background) {
|
||||
if (auto parsed_value = document().parse_url(value); parsed_value.is_valid())
|
||||
style.set_property(CSS::PropertyID::BackgroundImage, CSS::ImageStyleValue::create(parsed_value).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::BackgroundImage, CSS::ImageStyleValue::create(parsed_value));
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -56,7 +56,7 @@ void HTMLTableElement::apply_presentational_hints(CSS::StyleProperties& style) c
|
|||
// https://html.spec.whatwg.org/multipage/rendering.html#tables-2:rules-for-parsing-a-legacy-colour-value
|
||||
auto color = parse_legacy_color_value(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()));
|
||||
return;
|
||||
}
|
||||
if (name == HTML::AttributeNames::cellspacing) {
|
||||
|
|
|
@ -41,11 +41,11 @@ void HTMLTableRowElement::apply_presentational_hints(CSS::StyleProperties& style
|
|||
// https://html.spec.whatwg.org/multipage/rendering.html#tables-2:rules-for-parsing-a-legacy-colour-value
|
||||
auto color = parse_legacy_color_value(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()));
|
||||
return;
|
||||
} else if (name == HTML::AttributeNames::background) {
|
||||
if (auto parsed_value = document().parse_url(value); parsed_value.is_valid())
|
||||
style.set_property(CSS::PropertyID::BackgroundImage, CSS::ImageStyleValue::create(parsed_value).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::BackgroundImage, CSS::ImageStyleValue::create(parsed_value));
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -3993,14 +3993,14 @@ static RefPtr<CSS::StyleValue> parse_current_dimension_value(float value, Utf8Vi
|
|||
{
|
||||
// 1. If position is past the end of input, then return value as a length.
|
||||
if (position == input.end())
|
||||
return CSS::LengthStyleValue::create(CSS::Length::make_px(value)).release_value_but_fixme_should_propagate_errors();
|
||||
return CSS::LengthStyleValue::create(CSS::Length::make_px(value));
|
||||
|
||||
// 2. If the code point at position within input is U+0025 (%), then return value as a percentage.
|
||||
if (*position == '%')
|
||||
return CSS::PercentageStyleValue::create(CSS::Percentage(value)).release_value_but_fixme_should_propagate_errors();
|
||||
return CSS::PercentageStyleValue::create(CSS::Percentage(value));
|
||||
|
||||
// 3. Return value as a length.
|
||||
return CSS::LengthStyleValue::create(CSS::Length::make_px(value)).release_value_but_fixme_should_propagate_errors();
|
||||
return CSS::LengthStyleValue::create(CSS::Length::make_px(value));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-dimension-values
|
||||
|
@ -4034,7 +4034,7 @@ RefPtr<CSS::StyleValue> parse_dimension_value(StringView string)
|
|||
|
||||
// 6. If position is past the end of input, then return value as a length.
|
||||
if (position == input.end())
|
||||
return CSS::LengthStyleValue::create(CSS::Length::make_px(*integer_value)).release_value_but_fixme_should_propagate_errors();
|
||||
return CSS::LengthStyleValue::create(CSS::Length::make_px(*integer_value));
|
||||
|
||||
float value = *integer_value;
|
||||
|
||||
|
@ -4065,7 +4065,7 @@ RefPtr<CSS::StyleValue> parse_dimension_value(StringView string)
|
|||
|
||||
// 4. If position is past the end of input, then return value as a length.
|
||||
if (position == input.end())
|
||||
return CSS::LengthStyleValue::create(CSS::Length::make_px(value)).release_value_but_fixme_should_propagate_errors();
|
||||
return CSS::LengthStyleValue::create(CSS::Length::make_px(value));
|
||||
|
||||
// 5. If the code point at position within input is not an ASCII digit, then break.
|
||||
if (!is_ascii_digit(*position))
|
||||
|
|
|
@ -352,11 +352,11 @@ ErrorOr<void> TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::
|
|||
auto& progress = static_cast<HTML::HTMLProgressElement&>(dom_node);
|
||||
if (!progress.using_system_appearance()) {
|
||||
auto bar_style = TRY(style_computer.compute_style(progress, CSS::Selector::PseudoElement::ProgressBar));
|
||||
bar_style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::FlowRoot)).release_value_but_fixme_should_propagate_errors());
|
||||
bar_style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::FlowRoot)));
|
||||
auto value_style = TRY(style_computer.compute_style(progress, CSS::Selector::PseudoElement::ProgressValue));
|
||||
value_style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Block)).release_value_but_fixme_should_propagate_errors());
|
||||
value_style->set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Block)));
|
||||
auto position = progress.position();
|
||||
value_style->set_property(CSS::PropertyID::Width, CSS::PercentageStyleValue::create(CSS::Percentage(position >= 0 ? round_to<int>(100 * position) : 0)).release_value_but_fixme_should_propagate_errors());
|
||||
value_style->set_property(CSS::PropertyID::Width, CSS::PercentageStyleValue::create(CSS::Percentage(position >= 0 ? round_to<int>(100 * position) : 0)));
|
||||
auto bar_display = bar_style->display();
|
||||
auto value_display = value_style->display();
|
||||
auto progress_bar = DOM::Element::create_layout_node_for_display_type(document, bar_display, bar_style, nullptr);
|
||||
|
|
|
@ -396,7 +396,7 @@ Gfx::FloatMatrix4x4 StackingContext::get_transformation_matrix(CSS::Transformati
|
|||
0, 0, 0, 1);
|
||||
break;
|
||||
default:
|
||||
dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Unhandled transformation function {}", MUST(CSS::TransformationStyleValue::create(transformation.function, {}))->to_string());
|
||||
dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Unhandled transformation function {}", CSS::TransformationStyleValue::create(transformation.function, {})->to_string());
|
||||
}
|
||||
return Gfx::FloatMatrix4x4::identity();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) cons
|
|||
// If the `width` attribute is an empty string, it defaults to 100%.
|
||||
// This matches WebKit and Blink, but not Firefox. The spec is unclear.
|
||||
// FIXME: Figure out what to do here.
|
||||
style.set_property(CSS::PropertyID::Width, CSS::PercentageStyleValue::create(CSS::Percentage { 100 }).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::Width, CSS::PercentageStyleValue::create(CSS::Percentage { 100 }));
|
||||
}
|
||||
|
||||
// Height defaults to 100%
|
||||
|
@ -60,7 +60,7 @@ void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) cons
|
|||
// If the `height` attribute is an empty string, it defaults to 100%.
|
||||
// This matches WebKit and Blink, but not Firefox. The spec is unclear.
|
||||
// FIXME: Figure out what to do here.
|
||||
style.set_property(CSS::PropertyID::Height, CSS::PercentageStyleValue::create(CSS::Percentage { 100 }).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::Height, CSS::PercentageStyleValue::create(CSS::Percentage { 100 }));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,17 +31,17 @@ void SVGSymbolElement::initialize(JS::Realm& realm)
|
|||
void SVGSymbolElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||
{
|
||||
// The user agent style sheet sets the overflow property for ‘symbol’ elements to hidden.
|
||||
auto hidden = CSS::IdentifierStyleValue::create(CSS::ValueID::Hidden).release_value_but_fixme_should_propagate_errors();
|
||||
style.set_property(CSS::PropertyID::Overflow, CSS::OverflowStyleValue::create(hidden, hidden).release_value_but_fixme_should_propagate_errors());
|
||||
auto hidden = CSS::IdentifierStyleValue::create(CSS::ValueID::Hidden);
|
||||
style.set_property(CSS::PropertyID::Overflow, CSS::OverflowStyleValue::create(hidden, hidden));
|
||||
|
||||
if (is_direct_child_of_use_shadow_tree()) {
|
||||
// The generated instance of a ‘symbol’ that is the direct referenced element of a ‘use’ element must always have a computed value of inline for the display property.
|
||||
style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Inline)).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::Inline)));
|
||||
} else {
|
||||
// FIXME: When we have a DefaultSVG.css then use https://svgwg.org/svg2-draft/styling.html#UAStyleSheet instead.
|
||||
// The user agent must set the display property on the ‘symbol’ element to none, as part of the user agent style sheet,
|
||||
// and this declaration must have importance over any other CSS rule or presentation attribute.
|
||||
style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::None)).release_value_but_fixme_should_propagate_errors());
|
||||
style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::None)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue