mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:08:10 +00:00
LibWeb: Make StyleValue constructors infallible
This commit is contained in:
parent
b2b99aba95
commit
8a8cc18cf4
86 changed files with 352 additions and 352 deletions
|
@ -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 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue