mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 19:07:35 +00:00
LibWeb: Make StyleValue::to_string() infallible
This commit is contained in:
parent
ccfe197e5a
commit
7fe97ee6c5
112 changed files with 425 additions and 430 deletions
|
@ -210,7 +210,7 @@ DeprecatedString CSSStyleDeclaration::get_property_value(StringView property_nam
|
||||||
auto maybe_property = property(property_id.value());
|
auto maybe_property = property(property_id.value());
|
||||||
if (!maybe_property.has_value())
|
if (!maybe_property.has_value())
|
||||||
return {};
|
return {};
|
||||||
return maybe_property->value->to_string().release_value_but_fixme_should_propagate_errors().to_deprecated_string();
|
return maybe_property->value->to_string().to_deprecated_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertypriority
|
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertypriority
|
||||||
|
@ -303,7 +303,7 @@ DeprecatedString PropertyOwningCSSStyleDeclaration::serialized() const
|
||||||
// NOTE: There are no shorthands for custom properties.
|
// NOTE: There are no shorthands for custom properties.
|
||||||
|
|
||||||
// 5. Let value be the result of invoking serialize a CSS value of declaration.
|
// 5. Let value be the result of invoking serialize a CSS value of declaration.
|
||||||
auto value = declaration.value.value->to_string().release_value_but_fixme_should_propagate_errors().to_deprecated_string();
|
auto value = declaration.value.value->to_string().to_deprecated_string();
|
||||||
|
|
||||||
// 6. Let serialized declaration be the result of invoking serialize a CSS declaration with property name property, value value,
|
// 6. Let serialized declaration be the result of invoking serialize a CSS declaration with property name property, value value,
|
||||||
// and the important flag set if declaration has its important flag set.
|
// and the important flag set if declaration has its important flag set.
|
||||||
|
@ -354,7 +354,7 @@ DeprecatedString PropertyOwningCSSStyleDeclaration::serialized() const
|
||||||
// FIXME: 4. Shorthand loop: For each shorthand in shorthands, follow these substeps: ...
|
// FIXME: 4. Shorthand loop: For each shorthand in shorthands, follow these substeps: ...
|
||||||
|
|
||||||
// 5. Let value be the result of invoking serialize a CSS value of declaration.
|
// 5. Let value be the result of invoking serialize a CSS value of declaration.
|
||||||
auto value = declaration.value->to_string().release_value_but_fixme_should_propagate_errors().to_deprecated_string();
|
auto value = declaration.value->to_string().to_deprecated_string();
|
||||||
|
|
||||||
// 6. Let serialized declaration be the result of invoking serialize a CSS declaration with property name property, value value,
|
// 6. Let serialized declaration be the result of invoking serialize a CSS declaration with property name property, value value,
|
||||||
// and the important flag set if declaration has its important flag set.
|
// and the important flag set if declaration has its important flag set.
|
||||||
|
@ -403,7 +403,7 @@ JS::ThrowCompletionOr<JS::Value> CSSStyleDeclaration::internal_get(JS::PropertyK
|
||||||
if (property_id == CSS::PropertyID::Invalid)
|
if (property_id == CSS::PropertyID::Invalid)
|
||||||
return Base::internal_get(name, receiver, cacheable_metadata);
|
return Base::internal_get(name, receiver, cacheable_metadata);
|
||||||
if (auto maybe_property = property(property_id); maybe_property.has_value())
|
if (auto maybe_property = property(property_id); maybe_property.has_value())
|
||||||
return { JS::PrimitiveString::create(vm(), maybe_property->value->to_string().release_value_but_fixme_should_propagate_errors().to_deprecated_string()) };
|
return { JS::PrimitiveString::create(vm(), maybe_property->value->to_string().to_deprecated_string()) };
|
||||||
return { JS::PrimitiveString::create(vm(), String {}) };
|
return { JS::PrimitiveString::create(vm(), String {}) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
String to_string() const
|
String to_string() const
|
||||||
{
|
{
|
||||||
if (is_calculated())
|
if (is_calculated())
|
||||||
return MUST(m_value.template get<NonnullRefPtr<CalculatedStyleValue>>()->to_string());
|
return m_value.template get<NonnullRefPtr<CalculatedStyleValue>>()->to_string();
|
||||||
|
|
||||||
return m_value.template get<T>().to_string();
|
return m_value.template get<T>().to_string();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6238,7 +6238,7 @@ public:
|
||||||
|
|
||||||
ComponentValue& component_value() { return m_component_value; }
|
ComponentValue& component_value() { return m_component_value; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override { VERIFY_NOT_REACHED(); }
|
virtual String to_string() const override { VERIFY_NOT_REACHED(); }
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override { VERIFY_NOT_REACHED(); }
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override { VERIFY_NOT_REACHED(); }
|
||||||
virtual Optional<CSSNumericType> determine_type(Web::CSS::PropertyID) const override { VERIFY_NOT_REACHED(); }
|
virtual Optional<CSSNumericType> determine_type(Web::CSS::PropertyID) const override { VERIFY_NOT_REACHED(); }
|
||||||
virtual bool contains_percentage() const override { VERIFY_NOT_REACHED(); }
|
virtual bool contains_percentage() const override { VERIFY_NOT_REACHED(); }
|
||||||
|
|
|
@ -115,7 +115,7 @@ public:
|
||||||
String to_string() const
|
String to_string() const
|
||||||
{
|
{
|
||||||
if (is_calculated())
|
if (is_calculated())
|
||||||
return MUST(m_value.template get<NonnullRefPtr<CalculatedStyleValue>>()->to_string());
|
return m_value.template get<NonnullRefPtr<CalculatedStyleValue>>()->to_string();
|
||||||
if (is_percentage())
|
if (is_percentage())
|
||||||
return m_value.template get<Percentage>().to_string();
|
return m_value.template get<Percentage>().to_string();
|
||||||
return m_value.template get<T>().to_string();
|
return m_value.template get<T>().to_string();
|
||||||
|
|
|
@ -1782,7 +1782,7 @@ ErrorOr<void> StyleComputer::compute_cascaded_values(StyleProperties& style, DOM
|
||||||
style.set_property(static_cast<PropertyID>(property_id_value), *property_value);
|
style.set_property(static_cast<PropertyID>(property_id_value), *property_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (auto name = TRY(animation_name->to_string()); !name.is_empty()) {
|
} else if (auto name = animation_name->to_string(); !name.is_empty()) {
|
||||||
auto active_animation = m_active_animations.get(animation_key);
|
auto active_animation = m_active_animations.get(animation_key);
|
||||||
if (!active_animation.has_value()) {
|
if (!active_animation.has_value()) {
|
||||||
// New animation!
|
// New animation!
|
||||||
|
@ -2296,7 +2296,7 @@ RefPtr<Gfx::Font const> StyleComputer::compute_font_for_style_values(DOM::Elemen
|
||||||
if (family->is_identifier()) {
|
if (family->is_identifier()) {
|
||||||
found_font = find_generic_font(family->to_identifier());
|
found_font = find_generic_font(family->to_identifier());
|
||||||
} else if (family->is_string()) {
|
} else if (family->is_string()) {
|
||||||
found_font = find_font(family->to_string().release_value_but_fixme_should_propagate_errors());
|
found_font = find_font(family->to_string());
|
||||||
}
|
}
|
||||||
if (found_font)
|
if (found_font)
|
||||||
break;
|
break;
|
||||||
|
@ -2304,7 +2304,7 @@ RefPtr<Gfx::Font const> StyleComputer::compute_font_for_style_values(DOM::Elemen
|
||||||
} else if (font_family.is_identifier()) {
|
} else if (font_family.is_identifier()) {
|
||||||
found_font = find_generic_font(font_family.to_identifier());
|
found_font = find_generic_font(font_family.to_identifier());
|
||||||
} else if (font_family.is_string()) {
|
} else if (font_family.is_string()) {
|
||||||
found_font = find_font(font_family.to_string().release_value_but_fixme_should_propagate_errors());
|
found_font = find_font(font_family.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found_font) {
|
if (!found_font) {
|
||||||
|
|
|
@ -225,7 +225,7 @@ CSSPixels StyleProperties::line_height(Layout::Node const& layout_node) const
|
||||||
if (line_height->as_calculated().resolves_to_number()) {
|
if (line_height->as_calculated().resolves_to_number()) {
|
||||||
auto resolved = line_height->as_calculated().resolve_number();
|
auto resolved = line_height->as_calculated().resolve_number();
|
||||||
if (!resolved.has_value()) {
|
if (!resolved.has_value()) {
|
||||||
dbgln("FIXME: Failed to resolve calc() line-height (number): {}", line_height->as_calculated().to_string().release_value_but_fixme_should_propagate_errors());
|
dbgln("FIXME: Failed to resolve calc() line-height (number): {}", line_height->as_calculated().to_string());
|
||||||
return layout_node.font().pixel_metrics().line_spacing();
|
return layout_node.font().pixel_metrics().line_spacing();
|
||||||
}
|
}
|
||||||
return Length(resolved.value(), Length::Type::Em).to_px(layout_node);
|
return Length(resolved.value(), Length::Type::Em).to_px(layout_node);
|
||||||
|
@ -233,7 +233,7 @@ CSSPixels StyleProperties::line_height(Layout::Node const& layout_node) const
|
||||||
|
|
||||||
auto resolved = line_height->as_calculated().resolve_length(layout_node);
|
auto resolved = line_height->as_calculated().resolve_length(layout_node);
|
||||||
if (!resolved.has_value()) {
|
if (!resolved.has_value()) {
|
||||||
dbgln("FIXME: Failed to resolve calc() line-height: {}", line_height->as_calculated().to_string().release_value_but_fixme_should_propagate_errors());
|
dbgln("FIXME: Failed to resolve calc() line-height: {}", line_height->as_calculated().to_string());
|
||||||
return layout_node.font().pixel_metrics().line_spacing();
|
return layout_node.font().pixel_metrics().line_spacing();
|
||||||
}
|
}
|
||||||
return resolved->to_px(layout_node);
|
return resolved->to_px(layout_node);
|
||||||
|
@ -659,7 +659,7 @@ CSS::ContentData StyleProperties::content() const
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
for (auto const& item : content_style_value.content().values()) {
|
for (auto const& item : content_style_value.content().values()) {
|
||||||
if (item->is_string()) {
|
if (item->is_string()) {
|
||||||
builder.append(item->to_string().release_value_but_fixme_should_propagate_errors());
|
builder.append(item->to_string());
|
||||||
} else {
|
} else {
|
||||||
// TODO: Implement quotes, counters, images, and other things.
|
// TODO: Implement quotes, counters, images, and other things.
|
||||||
}
|
}
|
||||||
|
@ -671,7 +671,7 @@ CSS::ContentData StyleProperties::content() const
|
||||||
StringBuilder alt_text_builder;
|
StringBuilder alt_text_builder;
|
||||||
for (auto const& item : content_style_value.alt_text()->values()) {
|
for (auto const& item : content_style_value.alt_text()->values()) {
|
||||||
if (item->is_string()) {
|
if (item->is_string()) {
|
||||||
alt_text_builder.append(item->to_string().release_value_but_fixme_should_propagate_errors());
|
alt_text_builder.append(item->to_string());
|
||||||
} else {
|
} else {
|
||||||
// TODO: Implement counters
|
// TODO: Implement counters
|
||||||
}
|
}
|
||||||
|
@ -950,7 +950,7 @@ Vector<Vector<String>> StyleProperties::grid_template_areas() const
|
||||||
String StyleProperties::grid_area() const
|
String StyleProperties::grid_area() const
|
||||||
{
|
{
|
||||||
auto value = property(CSS::PropertyID::GridArea);
|
auto value = property(CSS::PropertyID::GridArea);
|
||||||
return value->as_string().to_string().release_value_but_fixme_should_propagate_errors();
|
return value->as_string().to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CSS::ObjectFit> StyleProperties::object_fit() const
|
Optional<CSS::ObjectFit> StyleProperties::object_fit() const
|
||||||
|
|
|
@ -180,7 +180,7 @@ public:
|
||||||
|
|
||||||
virtual Color to_color(Optional<Layout::NodeWithStyle const&>) const { return {}; }
|
virtual Color to_color(Optional<Layout::NodeWithStyle const&>) const { return {}; }
|
||||||
ValueID to_identifier() const;
|
ValueID to_identifier() const;
|
||||||
virtual ErrorOr<String> to_string() const = 0;
|
virtual String to_string() const = 0;
|
||||||
|
|
||||||
[[nodiscard]] int to_font_weight() const;
|
[[nodiscard]] int to_font_weight() const;
|
||||||
[[nodiscard]] int to_font_slope() const;
|
[[nodiscard]] int to_font_slope() const;
|
||||||
|
@ -219,6 +219,6 @@ template<>
|
||||||
struct AK::Formatter<Web::CSS::StyleValue> : Formatter<StringView> {
|
struct AK::Formatter<Web::CSS::StyleValue> : Formatter<StringView> {
|
||||||
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::StyleValue const& style_value)
|
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::StyleValue const& style_value)
|
||||||
{
|
{
|
||||||
return Formatter<StringView>::format(builder, TRY(style_value.to_string()));
|
return Formatter<StringView>::format(builder, style_value.to_string());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,24 +59,23 @@ struct ColorStopListElement {
|
||||||
using LinearColorStopListElement = ColorStopListElement<LengthPercentage>;
|
using LinearColorStopListElement = ColorStopListElement<LengthPercentage>;
|
||||||
using AngularColorStopListElement = ColorStopListElement<AnglePercentage>;
|
using AngularColorStopListElement = ColorStopListElement<AnglePercentage>;
|
||||||
|
|
||||||
static ErrorOr<void> serialize_color_stop_list(StringBuilder& builder, auto const& color_stop_list)
|
static void serialize_color_stop_list(StringBuilder& builder, auto const& color_stop_list)
|
||||||
{
|
{
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (auto const& element : color_stop_list) {
|
for (auto const& element : color_stop_list) {
|
||||||
if (!first)
|
if (!first)
|
||||||
TRY(builder.try_append(", "sv));
|
builder.append(", "sv);
|
||||||
|
|
||||||
if (element.transition_hint.has_value())
|
if (element.transition_hint.has_value())
|
||||||
TRY(builder.try_appendff("{}, "sv, element.transition_hint->value.to_string()));
|
builder.appendff("{}, "sv, element.transition_hint->value.to_string());
|
||||||
|
|
||||||
TRY(builder.try_append(TRY(element.color_stop.color->to_string())));
|
builder.append(element.color_stop.color->to_string());
|
||||||
for (auto position : Array { &element.color_stop.position, &element.color_stop.second_position }) {
|
for (auto position : Array { &element.color_stop.position, &element.color_stop.second_position }) {
|
||||||
if (position->has_value())
|
if (position->has_value())
|
||||||
TRY(builder.try_appendff(" {}"sv, (*position)->to_string()));
|
builder.appendff(" {}"sv, (*position)->to_string());
|
||||||
}
|
}
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ AngleStyleValue::AngleStyleValue(Angle angle)
|
||||||
|
|
||||||
AngleStyleValue::~AngleStyleValue() = default;
|
AngleStyleValue::~AngleStyleValue() = default;
|
||||||
|
|
||||||
ErrorOr<String> AngleStyleValue::to_string() const
|
String AngleStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return m_angle.to_string();
|
return m_angle.to_string();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
|
|
||||||
Angle const& angle() const { return m_angle; }
|
Angle const& angle() const { return m_angle; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(AngleStyleValue const& other) const;
|
bool properties_equal(AngleStyleValue const& other) const;
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,9 @@ BackgroundRepeatStyleValue::BackgroundRepeatStyleValue(Repeat repeat_x, Repeat r
|
||||||
|
|
||||||
BackgroundRepeatStyleValue::~BackgroundRepeatStyleValue() = default;
|
BackgroundRepeatStyleValue::~BackgroundRepeatStyleValue() = default;
|
||||||
|
|
||||||
ErrorOr<String> BackgroundRepeatStyleValue::to_string() const
|
String BackgroundRepeatStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return String::formatted("{} {}", CSS::to_string(m_properties.repeat_x), CSS::to_string(m_properties.repeat_y));
|
return MUST(String::formatted("{} {}", CSS::to_string(m_properties.repeat_x), CSS::to_string(m_properties.repeat_y)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
Repeat repeat_x() const { return m_properties.repeat_x; }
|
Repeat repeat_x() const { return m_properties.repeat_x; }
|
||||||
Repeat repeat_y() const { return m_properties.repeat_y; }
|
Repeat repeat_y() const { return m_properties.repeat_y; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(BackgroundRepeatStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(BackgroundRepeatStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,9 @@ BackgroundSizeStyleValue::BackgroundSizeStyleValue(LengthPercentage size_x, Leng
|
||||||
|
|
||||||
BackgroundSizeStyleValue::~BackgroundSizeStyleValue() = default;
|
BackgroundSizeStyleValue::~BackgroundSizeStyleValue() = default;
|
||||||
|
|
||||||
ErrorOr<String> BackgroundSizeStyleValue::to_string() const
|
String BackgroundSizeStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return String::formatted("{} {}", m_properties.size_x.to_string(), m_properties.size_y.to_string());
|
return MUST(String::formatted("{} {}", m_properties.size_x.to_string(), m_properties.size_y.to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
LengthPercentage size_x() const { return m_properties.size_x; }
|
LengthPercentage size_x() const { return m_properties.size_x; }
|
||||||
LengthPercentage size_y() const { return m_properties.size_y; }
|
LengthPercentage size_y() const { return m_properties.size_y; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(BackgroundSizeStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(BackgroundSizeStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -53,10 +53,10 @@ BackgroundStyleValue::BackgroundStyleValue(
|
||||||
|
|
||||||
BackgroundStyleValue::~BackgroundStyleValue() = default;
|
BackgroundStyleValue::~BackgroundStyleValue() = default;
|
||||||
|
|
||||||
ErrorOr<String> BackgroundStyleValue::to_string() const
|
String BackgroundStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
if (m_properties.layer_count == 1) {
|
if (m_properties.layer_count == 1) {
|
||||||
return String::formatted("{} {} {} {} {} {} {} {}", TRY(m_properties.color->to_string()), TRY(m_properties.image->to_string()), TRY(m_properties.position->to_string()), TRY(m_properties.size->to_string()), TRY(m_properties.repeat->to_string()), TRY(m_properties.attachment->to_string()), TRY(m_properties.origin->to_string()), TRY(m_properties.clip->to_string()));
|
return MUST(String::formatted("{} {} {} {} {} {} {} {}", m_properties.color->to_string(), m_properties.image->to_string(), m_properties.position->to_string(), m_properties.size->to_string(), m_properties.repeat->to_string(), m_properties.attachment->to_string(), m_properties.origin->to_string(), m_properties.clip->to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto get_layer_value_string = [](ValueComparingNonnullRefPtr<StyleValue const> const& style_value, size_t index) {
|
auto get_layer_value_string = [](ValueComparingNonnullRefPtr<StyleValue const> const& style_value, size_t index) {
|
||||||
|
@ -68,13 +68,13 @@ ErrorOr<String> BackgroundStyleValue::to_string() const
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
for (size_t i = 0; i < m_properties.layer_count; i++) {
|
for (size_t i = 0; i < m_properties.layer_count; i++) {
|
||||||
if (i)
|
if (i)
|
||||||
TRY(builder.try_append(", "sv));
|
builder.append(", "sv);
|
||||||
if (i == m_properties.layer_count - 1)
|
if (i == m_properties.layer_count - 1)
|
||||||
TRY(builder.try_appendff("{} ", TRY(m_properties.color->to_string())));
|
builder.appendff("{} ", m_properties.color->to_string());
|
||||||
TRY(builder.try_appendff("{} {} {} {} {} {} {}", TRY(get_layer_value_string(m_properties.image, i)), TRY(get_layer_value_string(m_properties.position, i)), TRY(get_layer_value_string(m_properties.size, i)), TRY(get_layer_value_string(m_properties.repeat, i)), TRY(get_layer_value_string(m_properties.attachment, i)), TRY(get_layer_value_string(m_properties.origin, i)), TRY(get_layer_value_string(m_properties.clip, i))));
|
builder.appendff("{} {} {} {} {} {} {}", get_layer_value_string(m_properties.image, i), get_layer_value_string(m_properties.position, i), get_layer_value_string(m_properties.size, i), get_layer_value_string(m_properties.repeat, i), get_layer_value_string(m_properties.attachment, i), get_layer_value_string(m_properties.origin, i), get_layer_value_string(m_properties.clip, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
auto repeat() const { return m_properties.repeat; }
|
auto repeat() const { return m_properties.repeat; }
|
||||||
auto size() const { return m_properties.size; }
|
auto size() const { return m_properties.size; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(BackgroundStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(BackgroundStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> BorderRadiusShorthandStyleValue::to_string() const
|
String BorderRadiusShorthandStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return String::formatted("{} {} {} {} / {} {} {} {}",
|
return MUST(String::formatted("{} {} {} {} / {} {} {} {}",
|
||||||
m_properties.top_left->horizontal_radius().to_string(),
|
m_properties.top_left->horizontal_radius().to_string(),
|
||||||
m_properties.top_right->horizontal_radius().to_string(),
|
m_properties.top_right->horizontal_radius().to_string(),
|
||||||
m_properties.bottom_right->horizontal_radius().to_string(),
|
m_properties.bottom_right->horizontal_radius().to_string(),
|
||||||
|
@ -21,7 +21,7 @@ ErrorOr<String> BorderRadiusShorthandStyleValue::to_string() const
|
||||||
m_properties.top_left->vertical_radius().to_string(),
|
m_properties.top_left->vertical_radius().to_string(),
|
||||||
m_properties.top_right->vertical_radius().to_string(),
|
m_properties.top_right->vertical_radius().to_string(),
|
||||||
m_properties.bottom_right->vertical_radius().to_string(),
|
m_properties.bottom_right->vertical_radius().to_string(),
|
||||||
m_properties.bottom_left->vertical_radius().to_string());
|
m_properties.bottom_left->vertical_radius().to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
auto bottom_right() const { return m_properties.bottom_right; }
|
auto bottom_right() const { return m_properties.bottom_right; }
|
||||||
auto bottom_left() const { return m_properties.bottom_left; }
|
auto bottom_left() const { return m_properties.bottom_left; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(BorderRadiusShorthandStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(BorderRadiusShorthandStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> BorderRadiusStyleValue::to_string() const
|
String BorderRadiusStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
if (m_properties.horizontal_radius == m_properties.vertical_radius)
|
if (m_properties.horizontal_radius == m_properties.vertical_radius)
|
||||||
return m_properties.horizontal_radius.to_string();
|
return m_properties.horizontal_radius.to_string();
|
||||||
return String::formatted("{} / {}", m_properties.horizontal_radius.to_string(), m_properties.vertical_radius.to_string());
|
return MUST(String::formatted("{} / {}", m_properties.horizontal_radius.to_string(), m_properties.vertical_radius.to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ValueComparingNonnullRefPtr<StyleValue const> BorderRadiusStyleValue::absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const
|
ValueComparingNonnullRefPtr<StyleValue const> BorderRadiusStyleValue::absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
LengthPercentage const& vertical_radius() const { return m_properties.vertical_radius; }
|
LengthPercentage const& vertical_radius() const { return m_properties.vertical_radius; }
|
||||||
bool is_elliptical() const { return m_properties.is_elliptical; }
|
bool is_elliptical() const { return m_properties.is_elliptical; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(BorderRadiusStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(BorderRadiusStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,9 @@ BorderStyleValue::BorderStyleValue(
|
||||||
|
|
||||||
BorderStyleValue::~BorderStyleValue() = default;
|
BorderStyleValue::~BorderStyleValue() = default;
|
||||||
|
|
||||||
ErrorOr<String> BorderStyleValue::to_string() const
|
String BorderStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return String::formatted("{} {} {}", TRY(m_properties.border_width->to_string()), TRY(m_properties.border_style->to_string()), TRY(m_properties.border_color->to_string()));
|
return MUST(String::formatted("{} {} {}", m_properties.border_width->to_string(), m_properties.border_style->to_string(), m_properties.border_color->to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
ValueComparingNonnullRefPtr<StyleValue> border_style() const { return m_properties.border_style; }
|
ValueComparingNonnullRefPtr<StyleValue> border_style() const { return m_properties.border_style; }
|
||||||
ValueComparingNonnullRefPtr<StyleValue> border_color() const { return m_properties.border_color; }
|
ValueComparingNonnullRefPtr<StyleValue> border_color() const { return m_properties.border_color; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(BorderStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(BorderStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ NumericCalculationNode::NumericCalculationNode(NumericValue value)
|
||||||
|
|
||||||
NumericCalculationNode::~NumericCalculationNode() = default;
|
NumericCalculationNode::~NumericCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> NumericCalculationNode::to_string() const
|
String NumericCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
return m_value.visit([](auto& value) { return value.to_string(); });
|
return m_value.visit([](auto& value) { return value.to_string(); });
|
||||||
}
|
}
|
||||||
|
@ -225,17 +225,17 @@ SumCalculationNode::SumCalculationNode(Vector<NonnullOwnPtr<CalculationNode>> va
|
||||||
|
|
||||||
SumCalculationNode::~SumCalculationNode() = default;
|
SumCalculationNode::~SumCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> SumCalculationNode::to_string() const
|
String SumCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
bool first = true;
|
bool first = true;
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
for (auto& value : m_values) {
|
for (auto& value : m_values) {
|
||||||
if (!first)
|
if (!first)
|
||||||
TRY(builder.try_append(" + "sv));
|
builder.append(" + "sv);
|
||||||
TRY(builder.try_append(TRY(value->to_string())));
|
builder.append(value->to_string());
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> SumCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> SumCalculationNode::resolved_type() const
|
||||||
|
@ -324,7 +324,7 @@ void SumCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcula
|
||||||
|
|
||||||
ErrorOr<void> SumCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> SumCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}SUM:\n", "", indent));
|
builder.appendff("{: >{}}SUM:\n", "", indent);
|
||||||
for (auto const& item : m_values)
|
for (auto const& item : m_values)
|
||||||
TRY(item->dump(builder, indent + 2));
|
TRY(item->dump(builder, indent + 2));
|
||||||
return {};
|
return {};
|
||||||
|
@ -344,17 +344,17 @@ ProductCalculationNode::ProductCalculationNode(Vector<NonnullOwnPtr<CalculationN
|
||||||
|
|
||||||
ProductCalculationNode::~ProductCalculationNode() = default;
|
ProductCalculationNode::~ProductCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> ProductCalculationNode::to_string() const
|
String ProductCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
bool first = true;
|
bool first = true;
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
for (auto& value : m_values) {
|
for (auto& value : m_values) {
|
||||||
if (!first)
|
if (!first)
|
||||||
TRY(builder.try_append(" * "sv));
|
builder.append(" * "sv);
|
||||||
TRY(builder.try_append(TRY(value->to_string())));
|
builder.append(value->to_string());
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> ProductCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> ProductCalculationNode::resolved_type() const
|
||||||
|
@ -448,7 +448,7 @@ void ProductCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Cal
|
||||||
|
|
||||||
ErrorOr<void> ProductCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> ProductCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}PRODUCT:\n", "", indent));
|
builder.appendff("{: >{}}PRODUCT:\n", "", indent);
|
||||||
for (auto const& item : m_values)
|
for (auto const& item : m_values)
|
||||||
TRY(item->dump(builder, indent + 2));
|
TRY(item->dump(builder, indent + 2));
|
||||||
return {};
|
return {};
|
||||||
|
@ -467,9 +467,9 @@ NegateCalculationNode::NegateCalculationNode(NonnullOwnPtr<CalculationNode> valu
|
||||||
|
|
||||||
NegateCalculationNode::~NegateCalculationNode() = default;
|
NegateCalculationNode::~NegateCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> NegateCalculationNode::to_string() const
|
String NegateCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
return String::formatted("(0 - {})", TRY(m_value->to_string()));
|
return MUST(String::formatted("(0 - {})", m_value->to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> NegateCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> NegateCalculationNode::resolved_type() const
|
||||||
|
@ -504,7 +504,7 @@ void NegateCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calc
|
||||||
|
|
||||||
ErrorOr<void> NegateCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> NegateCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}NEGATE:\n", "", indent));
|
builder.appendff("{: >{}}NEGATE:\n", "", indent);
|
||||||
TRY(m_value->dump(builder, indent + 2));
|
TRY(m_value->dump(builder, indent + 2));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -522,9 +522,9 @@ InvertCalculationNode::InvertCalculationNode(NonnullOwnPtr<CalculationNode> valu
|
||||||
|
|
||||||
InvertCalculationNode::~InvertCalculationNode() = default;
|
InvertCalculationNode::~InvertCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> InvertCalculationNode::to_string() const
|
String InvertCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
return String::formatted("(1 / {})", TRY(m_value->to_string()));
|
return MUST(String::formatted("(1 / {})", m_value->to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> InvertCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> InvertCalculationNode::resolved_type() const
|
||||||
|
@ -566,7 +566,7 @@ void InvertCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calc
|
||||||
|
|
||||||
ErrorOr<void> InvertCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> InvertCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}INVERT:\n", "", indent));
|
builder.appendff("{: >{}}INVERT:\n", "", indent);
|
||||||
TRY(m_value->dump(builder, indent + 2));
|
TRY(m_value->dump(builder, indent + 2));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -584,17 +584,17 @@ MinCalculationNode::MinCalculationNode(Vector<NonnullOwnPtr<CalculationNode>> va
|
||||||
|
|
||||||
MinCalculationNode::~MinCalculationNode() = default;
|
MinCalculationNode::~MinCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> MinCalculationNode::to_string() const
|
String MinCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
TRY(builder.try_append("min("sv));
|
builder.append("min("sv);
|
||||||
for (size_t i = 0; i < m_values.size(); ++i) {
|
for (size_t i = 0; i < m_values.size(); ++i) {
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
TRY(builder.try_append(", "sv));
|
builder.append(", "sv);
|
||||||
TRY(builder.try_append(TRY(m_values[i]->to_string())));
|
builder.append(m_values[i]->to_string());
|
||||||
}
|
}
|
||||||
TRY(builder.try_append(")"sv));
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> MinCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> MinCalculationNode::resolved_type() const
|
||||||
|
@ -648,7 +648,7 @@ void MinCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcula
|
||||||
|
|
||||||
ErrorOr<void> MinCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> MinCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}MIN:\n", "", indent));
|
builder.appendff("{: >{}}MIN:\n", "", indent);
|
||||||
for (auto const& value : m_values)
|
for (auto const& value : m_values)
|
||||||
TRY(value->dump(builder, indent + 2));
|
TRY(value->dump(builder, indent + 2));
|
||||||
return {};
|
return {};
|
||||||
|
@ -667,17 +667,17 @@ MaxCalculationNode::MaxCalculationNode(Vector<NonnullOwnPtr<CalculationNode>> va
|
||||||
|
|
||||||
MaxCalculationNode::~MaxCalculationNode() = default;
|
MaxCalculationNode::~MaxCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> MaxCalculationNode::to_string() const
|
String MaxCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
TRY(builder.try_append("max("sv));
|
builder.append("max("sv);
|
||||||
for (size_t i = 0; i < m_values.size(); ++i) {
|
for (size_t i = 0; i < m_values.size(); ++i) {
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
TRY(builder.try_append(", "sv));
|
builder.append(", "sv);
|
||||||
TRY(builder.try_append(TRY(m_values[i]->to_string())));
|
builder.append(m_values[i]->to_string());
|
||||||
}
|
}
|
||||||
TRY(builder.try_append(")"sv));
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> MaxCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> MaxCalculationNode::resolved_type() const
|
||||||
|
@ -731,7 +731,7 @@ void MaxCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcula
|
||||||
|
|
||||||
ErrorOr<void> MaxCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> MaxCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}MAX:\n", "", indent));
|
builder.appendff("{: >{}}MAX:\n", "", indent);
|
||||||
for (auto const& value : m_values)
|
for (auto const& value : m_values)
|
||||||
TRY(value->dump(builder, indent + 2));
|
TRY(value->dump(builder, indent + 2));
|
||||||
return {};
|
return {};
|
||||||
|
@ -752,17 +752,17 @@ ClampCalculationNode::ClampCalculationNode(NonnullOwnPtr<CalculationNode> min, N
|
||||||
|
|
||||||
ClampCalculationNode::~ClampCalculationNode() = default;
|
ClampCalculationNode::~ClampCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> ClampCalculationNode::to_string() const
|
String ClampCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
TRY(builder.try_append("clamp("sv));
|
builder.append("clamp("sv);
|
||||||
TRY(builder.try_append(TRY(m_min_value->to_string())));
|
builder.append(m_min_value->to_string());
|
||||||
TRY(builder.try_append(", "sv));
|
builder.append(", "sv);
|
||||||
TRY(builder.try_append(TRY(m_center_value->to_string())));
|
builder.append(m_center_value->to_string());
|
||||||
TRY(builder.try_append(", "sv));
|
builder.append(", "sv);
|
||||||
TRY(builder.try_append(TRY(m_max_value->to_string())));
|
builder.append(m_max_value->to_string());
|
||||||
TRY(builder.try_append(")"sv));
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> ClampCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> ClampCalculationNode::resolved_type() const
|
||||||
|
@ -827,7 +827,7 @@ void ClampCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcu
|
||||||
|
|
||||||
ErrorOr<void> ClampCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> ClampCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}CLAMP:\n", "", indent));
|
builder.appendff("{: >{}}CLAMP:\n", "", indent);
|
||||||
TRY(m_min_value->dump(builder, indent + 2));
|
TRY(m_min_value->dump(builder, indent + 2));
|
||||||
TRY(m_center_value->dump(builder, indent + 2));
|
TRY(m_center_value->dump(builder, indent + 2));
|
||||||
TRY(m_max_value->dump(builder, indent + 2));
|
TRY(m_max_value->dump(builder, indent + 2));
|
||||||
|
@ -847,13 +847,13 @@ AbsCalculationNode::AbsCalculationNode(NonnullOwnPtr<CalculationNode> value)
|
||||||
|
|
||||||
AbsCalculationNode::~AbsCalculationNode() = default;
|
AbsCalculationNode::~AbsCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> AbsCalculationNode::to_string() const
|
String AbsCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("abs("sv);
|
builder.append("abs("sv);
|
||||||
builder.append(TRY(m_value->to_string()));
|
builder.append(m_value->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> AbsCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> AbsCalculationNode::resolved_type() const
|
||||||
|
@ -893,7 +893,7 @@ void AbsCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcula
|
||||||
|
|
||||||
ErrorOr<void> AbsCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> AbsCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}ABS: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}ABS: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -910,13 +910,13 @@ SignCalculationNode::SignCalculationNode(NonnullOwnPtr<CalculationNode> value)
|
||||||
|
|
||||||
SignCalculationNode::~SignCalculationNode() = default;
|
SignCalculationNode::~SignCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> SignCalculationNode::to_string() const
|
String SignCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("sign("sv);
|
builder.append("sign("sv);
|
||||||
builder.append(TRY(m_value->to_string()));
|
builder.append(m_value->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> SignCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> SignCalculationNode::resolved_type() const
|
||||||
|
@ -958,7 +958,7 @@ void SignCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcul
|
||||||
|
|
||||||
ErrorOr<void> SignCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> SignCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}SIGN: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}SIGN: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -975,7 +975,7 @@ ConstantCalculationNode::ConstantCalculationNode(ConstantType constant)
|
||||||
|
|
||||||
ConstantCalculationNode::~ConstantCalculationNode() = default;
|
ConstantCalculationNode::~ConstantCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> ConstantCalculationNode::to_string() const
|
String ConstantCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
switch (m_constant) {
|
switch (m_constant) {
|
||||||
case CalculationNode::ConstantType::E:
|
case CalculationNode::ConstantType::E:
|
||||||
|
@ -1027,7 +1027,7 @@ CalculatedStyleValue::CalculationResult ConstantCalculationNode::resolve([[maybe
|
||||||
|
|
||||||
ErrorOr<void> ConstantCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> ConstantCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}CONSTANT: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}CONSTANT: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1044,13 +1044,13 @@ SinCalculationNode::SinCalculationNode(NonnullOwnPtr<CalculationNode> value)
|
||||||
|
|
||||||
SinCalculationNode::~SinCalculationNode() = default;
|
SinCalculationNode::~SinCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> SinCalculationNode::to_string() const
|
String SinCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("sin("sv);
|
builder.append("sin("sv);
|
||||||
builder.append(TRY(m_value->to_string()));
|
builder.append(m_value->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> SinCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> SinCalculationNode::resolved_type() const
|
||||||
|
@ -1087,7 +1087,7 @@ void SinCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcula
|
||||||
|
|
||||||
ErrorOr<void> SinCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> SinCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}SIN: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}SIN: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1104,13 +1104,13 @@ CosCalculationNode::CosCalculationNode(NonnullOwnPtr<CalculationNode> value)
|
||||||
|
|
||||||
CosCalculationNode::~CosCalculationNode() = default;
|
CosCalculationNode::~CosCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> CosCalculationNode::to_string() const
|
String CosCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("cos("sv);
|
builder.append("cos("sv);
|
||||||
builder.append(TRY(m_value->to_string()));
|
builder.append(m_value->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> CosCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> CosCalculationNode::resolved_type() const
|
||||||
|
@ -1147,7 +1147,7 @@ void CosCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcula
|
||||||
|
|
||||||
ErrorOr<void> CosCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> CosCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}COS: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}COS: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1164,13 +1164,13 @@ TanCalculationNode::TanCalculationNode(NonnullOwnPtr<CalculationNode> value)
|
||||||
|
|
||||||
TanCalculationNode::~TanCalculationNode() = default;
|
TanCalculationNode::~TanCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> TanCalculationNode::to_string() const
|
String TanCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("tan("sv);
|
builder.append("tan("sv);
|
||||||
builder.append(TRY(m_value->to_string()));
|
builder.append(m_value->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> TanCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> TanCalculationNode::resolved_type() const
|
||||||
|
@ -1207,7 +1207,7 @@ void TanCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcula
|
||||||
|
|
||||||
ErrorOr<void> TanCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> TanCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}TAN: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}TAN: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1224,13 +1224,13 @@ AsinCalculationNode::AsinCalculationNode(NonnullOwnPtr<CalculationNode> value)
|
||||||
|
|
||||||
AsinCalculationNode::~AsinCalculationNode() = default;
|
AsinCalculationNode::~AsinCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> AsinCalculationNode::to_string() const
|
String AsinCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("asin("sv);
|
builder.append("asin("sv);
|
||||||
builder.append(TRY(m_value->to_string()));
|
builder.append(m_value->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> AsinCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> AsinCalculationNode::resolved_type() const
|
||||||
|
@ -1267,7 +1267,7 @@ void AsinCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcul
|
||||||
|
|
||||||
ErrorOr<void> AsinCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> AsinCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}ASIN: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}ASIN: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1284,13 +1284,13 @@ AcosCalculationNode::AcosCalculationNode(NonnullOwnPtr<CalculationNode> value)
|
||||||
|
|
||||||
AcosCalculationNode::~AcosCalculationNode() = default;
|
AcosCalculationNode::~AcosCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> AcosCalculationNode::to_string() const
|
String AcosCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("acos("sv);
|
builder.append("acos("sv);
|
||||||
builder.append(TRY(m_value->to_string()));
|
builder.append(m_value->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> AcosCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> AcosCalculationNode::resolved_type() const
|
||||||
|
@ -1327,7 +1327,7 @@ void AcosCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcul
|
||||||
|
|
||||||
ErrorOr<void> AcosCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> AcosCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}ACOS: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}ACOS: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1344,13 +1344,13 @@ AtanCalculationNode::AtanCalculationNode(NonnullOwnPtr<CalculationNode> value)
|
||||||
|
|
||||||
AtanCalculationNode::~AtanCalculationNode() = default;
|
AtanCalculationNode::~AtanCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> AtanCalculationNode::to_string() const
|
String AtanCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("atan("sv);
|
builder.append("atan("sv);
|
||||||
builder.append(TRY(m_value->to_string()));
|
builder.append(m_value->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> AtanCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> AtanCalculationNode::resolved_type() const
|
||||||
|
@ -1387,7 +1387,7 @@ void AtanCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcul
|
||||||
|
|
||||||
ErrorOr<void> AtanCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> AtanCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}ATAN: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}ATAN: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1405,15 +1405,15 @@ Atan2CalculationNode::Atan2CalculationNode(NonnullOwnPtr<CalculationNode> y, Non
|
||||||
|
|
||||||
Atan2CalculationNode::~Atan2CalculationNode() = default;
|
Atan2CalculationNode::~Atan2CalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> Atan2CalculationNode::to_string() const
|
String Atan2CalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("atan2("sv);
|
builder.append("atan2("sv);
|
||||||
builder.append(TRY(m_y->to_string()));
|
builder.append(m_y->to_string());
|
||||||
builder.append(", "sv);
|
builder.append(", "sv);
|
||||||
builder.append(TRY(m_x->to_string()));
|
builder.append(m_x->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> Atan2CalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> Atan2CalculationNode::resolved_type() const
|
||||||
|
@ -1456,7 +1456,7 @@ void Atan2CalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcu
|
||||||
|
|
||||||
ErrorOr<void> Atan2CalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> Atan2CalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}ATAN2: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}ATAN2: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1474,15 +1474,15 @@ PowCalculationNode::PowCalculationNode(NonnullOwnPtr<CalculationNode> x, Nonnull
|
||||||
|
|
||||||
PowCalculationNode::~PowCalculationNode() = default;
|
PowCalculationNode::~PowCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> PowCalculationNode::to_string() const
|
String PowCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("pow("sv);
|
builder.append("pow("sv);
|
||||||
builder.append(TRY(m_x->to_string()));
|
builder.append(m_x->to_string());
|
||||||
builder.append(", "sv);
|
builder.append(", "sv);
|
||||||
builder.append(TRY(m_y->to_string()));
|
builder.append(m_y->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> PowCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> PowCalculationNode::resolved_type() const
|
||||||
|
@ -1520,7 +1520,7 @@ void PowCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcula
|
||||||
|
|
||||||
ErrorOr<void> PowCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> PowCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}POW: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}POW: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1537,13 +1537,13 @@ SqrtCalculationNode::SqrtCalculationNode(NonnullOwnPtr<CalculationNode> value)
|
||||||
|
|
||||||
SqrtCalculationNode::~SqrtCalculationNode() = default;
|
SqrtCalculationNode::~SqrtCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> SqrtCalculationNode::to_string() const
|
String SqrtCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("sqrt("sv);
|
builder.append("sqrt("sv);
|
||||||
builder.append(TRY(m_value->to_string()));
|
builder.append(m_value->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> SqrtCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> SqrtCalculationNode::resolved_type() const
|
||||||
|
@ -1575,7 +1575,7 @@ void SqrtCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcul
|
||||||
|
|
||||||
ErrorOr<void> SqrtCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> SqrtCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}SQRT: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}SQRT: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1592,17 +1592,17 @@ HypotCalculationNode::HypotCalculationNode(Vector<NonnullOwnPtr<CalculationNode>
|
||||||
|
|
||||||
HypotCalculationNode::~HypotCalculationNode() = default;
|
HypotCalculationNode::~HypotCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> HypotCalculationNode::to_string() const
|
String HypotCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
TRY(builder.try_append("hypot("sv));
|
builder.append("hypot("sv);
|
||||||
for (size_t i = 0; i < m_values.size(); ++i) {
|
for (size_t i = 0; i < m_values.size(); ++i) {
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
TRY(builder.try_append(", "sv));
|
builder.append(", "sv);
|
||||||
TRY(builder.try_append(TRY(m_values[i]->to_string())));
|
builder.append(m_values[i]->to_string());
|
||||||
}
|
}
|
||||||
TRY(builder.try_append(")"sv));
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> HypotCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> HypotCalculationNode::resolved_type() const
|
||||||
|
@ -1654,7 +1654,7 @@ void HypotCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcu
|
||||||
|
|
||||||
ErrorOr<void> HypotCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> HypotCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}HYPOT:\n", "", indent));
|
builder.appendff("{: >{}}HYPOT:\n", "", indent);
|
||||||
for (auto const& value : m_values)
|
for (auto const& value : m_values)
|
||||||
TRY(value->dump(builder, indent + 2));
|
TRY(value->dump(builder, indent + 2));
|
||||||
return {};
|
return {};
|
||||||
|
@ -1674,15 +1674,15 @@ LogCalculationNode::LogCalculationNode(NonnullOwnPtr<CalculationNode> x, Nonnull
|
||||||
|
|
||||||
LogCalculationNode::~LogCalculationNode() = default;
|
LogCalculationNode::~LogCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> LogCalculationNode::to_string() const
|
String LogCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("log("sv);
|
builder.append("log("sv);
|
||||||
builder.append(TRY(m_x->to_string()));
|
builder.append(m_x->to_string());
|
||||||
builder.append(", "sv);
|
builder.append(", "sv);
|
||||||
builder.append(TRY(m_y->to_string()));
|
builder.append(m_y->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> LogCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> LogCalculationNode::resolved_type() const
|
||||||
|
@ -1720,7 +1720,7 @@ void LogCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcula
|
||||||
|
|
||||||
ErrorOr<void> LogCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> LogCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}LOG: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}LOG: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1737,13 +1737,13 @@ ExpCalculationNode::ExpCalculationNode(NonnullOwnPtr<CalculationNode> value)
|
||||||
|
|
||||||
ExpCalculationNode::~ExpCalculationNode() = default;
|
ExpCalculationNode::~ExpCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> ExpCalculationNode::to_string() const
|
String ExpCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("exp("sv);
|
builder.append("exp("sv);
|
||||||
builder.append(TRY(m_value->to_string()));
|
builder.append(m_value->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> ExpCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> ExpCalculationNode::resolved_type() const
|
||||||
|
@ -1775,7 +1775,7 @@ void ExpCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcula
|
||||||
|
|
||||||
ErrorOr<void> ExpCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> ExpCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}EXP: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}EXP: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1794,17 +1794,17 @@ RoundCalculationNode::RoundCalculationNode(RoundingStrategy mode, NonnullOwnPtr<
|
||||||
|
|
||||||
RoundCalculationNode::~RoundCalculationNode() = default;
|
RoundCalculationNode::~RoundCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> RoundCalculationNode::to_string() const
|
String RoundCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("round("sv);
|
builder.append("round("sv);
|
||||||
builder.append(CSS::to_string(m_strategy));
|
builder.append(CSS::to_string(m_strategy));
|
||||||
builder.append(", "sv);
|
builder.append(", "sv);
|
||||||
builder.append(TRY(m_x->to_string()));
|
builder.append(m_x->to_string());
|
||||||
builder.append(", "sv);
|
builder.append(", "sv);
|
||||||
builder.append(TRY(m_y->to_string()));
|
builder.append(m_y->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> RoundCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> RoundCalculationNode::resolved_type() const
|
||||||
|
@ -1878,7 +1878,7 @@ void RoundCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcu
|
||||||
|
|
||||||
ErrorOr<void> RoundCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> RoundCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}ROUND: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}ROUND: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1896,15 +1896,15 @@ ModCalculationNode::ModCalculationNode(NonnullOwnPtr<CalculationNode> x, Nonnull
|
||||||
|
|
||||||
ModCalculationNode::~ModCalculationNode() = default;
|
ModCalculationNode::~ModCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> ModCalculationNode::to_string() const
|
String ModCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("mod("sv);
|
builder.append("mod("sv);
|
||||||
builder.append(TRY(m_x->to_string()));
|
builder.append(m_x->to_string());
|
||||||
builder.append(", "sv);
|
builder.append(", "sv);
|
||||||
builder.append(TRY(m_y->to_string()));
|
builder.append(m_y->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> ModCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> ModCalculationNode::resolved_type() const
|
||||||
|
@ -1955,7 +1955,7 @@ void ModCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcula
|
||||||
|
|
||||||
ErrorOr<void> ModCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> ModCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}MOD: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}MOD: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1973,15 +1973,15 @@ RemCalculationNode::RemCalculationNode(NonnullOwnPtr<CalculationNode> x, Nonnull
|
||||||
|
|
||||||
RemCalculationNode::~RemCalculationNode() = default;
|
RemCalculationNode::~RemCalculationNode() = default;
|
||||||
|
|
||||||
ErrorOr<String> RemCalculationNode::to_string() const
|
String RemCalculationNode::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append("rem("sv);
|
builder.append("rem("sv);
|
||||||
builder.append(TRY(m_x->to_string()));
|
builder.append(m_x->to_string());
|
||||||
builder.append(", "sv);
|
builder.append(", "sv);
|
||||||
builder.append(TRY(m_y->to_string()));
|
builder.append(m_y->to_string());
|
||||||
builder.append(")"sv);
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<CalculatedStyleValue::ResolvedType> RemCalculationNode::resolved_type() const
|
Optional<CalculatedStyleValue::ResolvedType> RemCalculationNode::resolved_type() const
|
||||||
|
@ -2031,7 +2031,7 @@ void RemCalculationNode::for_each_child_node(Function<void(NonnullOwnPtr<Calcula
|
||||||
|
|
||||||
ErrorOr<void> RemCalculationNode::dump(StringBuilder& builder, int indent) const
|
ErrorOr<void> RemCalculationNode::dump(StringBuilder& builder, int indent) const
|
||||||
{
|
{
|
||||||
TRY(builder.try_appendff("{: >{}}REM: {}\n", "", indent, TRY(to_string())));
|
builder.appendff("{: >{}}REM: {}\n", "", indent, to_string());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2269,10 +2269,10 @@ void CalculatedStyleValue::CalculationResult::invert()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<String> CalculatedStyleValue::to_string() const
|
String CalculatedStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
// FIXME: Implement this according to https://www.w3.org/TR/css-values-4/#calc-serialize once that stabilizes.
|
// FIXME: Implement this according to https://www.w3.org/TR/css-values-4/#calc-serialize once that stabilizes.
|
||||||
return String::formatted("calc({})", TRY(m_calculation->to_string()));
|
return MUST(String::formatted("calc({})", m_calculation->to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CalculatedStyleValue::equals(StyleValue const& other) const
|
bool CalculatedStyleValue::equals(StyleValue const& other) const
|
||||||
|
@ -2280,7 +2280,7 @@ bool CalculatedStyleValue::equals(StyleValue const& other) const
|
||||||
if (type() != other.type())
|
if (type() != other.type())
|
||||||
return false;
|
return false;
|
||||||
// This is a case where comparing the strings actually makes sense.
|
// This is a case where comparing the strings actually makes sense.
|
||||||
return to_string().release_value_but_fixme_should_propagate_errors() == other.to_string().release_value_but_fixme_should_propagate_errors();
|
return to_string() == other.to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<Angle> CalculatedStyleValue::resolve_angle() const
|
Optional<Angle> CalculatedStyleValue::resolve_angle() const
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
return adopt_ref(*new (nothrow) CalculatedStyleValue(move(calculation), resolved_type));
|
return adopt_ref(*new (nothrow) CalculatedStyleValue(move(calculation), resolved_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<String> to_string() const override;
|
String to_string() const override;
|
||||||
virtual bool equals(StyleValue const& other) const override;
|
virtual bool equals(StyleValue const& other) const override;
|
||||||
|
|
||||||
bool resolves_to_angle() const { return m_resolved_type.matches_angle(); }
|
bool resolves_to_angle() const { return m_resolved_type.matches_angle(); }
|
||||||
|
@ -233,7 +233,7 @@ public:
|
||||||
return first_is_one_of(m_type, Type::Sum, Type::Product, Type::Negate, Type::Invert);
|
return first_is_one_of(m_type, Type::Sum, Type::Product, Type::Negate, Type::Invert);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const = 0;
|
virtual String to_string() const = 0;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const = 0;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const = 0;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const = 0;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const = 0;
|
||||||
virtual bool contains_percentage() const = 0;
|
virtual bool contains_percentage() const = 0;
|
||||||
|
@ -254,7 +254,7 @@ public:
|
||||||
static NonnullOwnPtr<NumericCalculationNode> create(NumericValue);
|
static NonnullOwnPtr<NumericCalculationNode> create(NumericValue);
|
||||||
~NumericCalculationNode();
|
~NumericCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -273,7 +273,7 @@ public:
|
||||||
static NonnullOwnPtr<SumCalculationNode> create(Vector<NonnullOwnPtr<CalculationNode>>);
|
static NonnullOwnPtr<SumCalculationNode> create(Vector<NonnullOwnPtr<CalculationNode>>);
|
||||||
~SumCalculationNode();
|
~SumCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -292,7 +292,7 @@ public:
|
||||||
static NonnullOwnPtr<ProductCalculationNode> create(Vector<NonnullOwnPtr<CalculationNode>>);
|
static NonnullOwnPtr<ProductCalculationNode> create(Vector<NonnullOwnPtr<CalculationNode>>);
|
||||||
~ProductCalculationNode();
|
~ProductCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -311,7 +311,7 @@ public:
|
||||||
static NonnullOwnPtr<NegateCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<NegateCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
||||||
~NegateCalculationNode();
|
~NegateCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -330,7 +330,7 @@ public:
|
||||||
static NonnullOwnPtr<InvertCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<InvertCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
||||||
~InvertCalculationNode();
|
~InvertCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -349,7 +349,7 @@ public:
|
||||||
static NonnullOwnPtr<MinCalculationNode> create(Vector<NonnullOwnPtr<CalculationNode>>);
|
static NonnullOwnPtr<MinCalculationNode> create(Vector<NonnullOwnPtr<CalculationNode>>);
|
||||||
~MinCalculationNode();
|
~MinCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -368,7 +368,7 @@ public:
|
||||||
static NonnullOwnPtr<MaxCalculationNode> create(Vector<NonnullOwnPtr<CalculationNode>>);
|
static NonnullOwnPtr<MaxCalculationNode> create(Vector<NonnullOwnPtr<CalculationNode>>);
|
||||||
~MaxCalculationNode();
|
~MaxCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -387,7 +387,7 @@ public:
|
||||||
static NonnullOwnPtr<ClampCalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<ClampCalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
||||||
~ClampCalculationNode();
|
~ClampCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -408,7 +408,7 @@ public:
|
||||||
static NonnullOwnPtr<AbsCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<AbsCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
||||||
~AbsCalculationNode();
|
~AbsCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -427,7 +427,7 @@ public:
|
||||||
static NonnullOwnPtr<SignCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<SignCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
||||||
~SignCalculationNode();
|
~SignCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -446,7 +446,7 @@ public:
|
||||||
static NonnullOwnPtr<ConstantCalculationNode> create(CalculationNode::ConstantType);
|
static NonnullOwnPtr<ConstantCalculationNode> create(CalculationNode::ConstantType);
|
||||||
~ConstantCalculationNode();
|
~ConstantCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override { return false; }
|
virtual bool contains_percentage() const override { return false; }
|
||||||
|
@ -465,7 +465,7 @@ public:
|
||||||
static NonnullOwnPtr<SinCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<SinCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
||||||
~SinCalculationNode();
|
~SinCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -484,7 +484,7 @@ public:
|
||||||
static NonnullOwnPtr<CosCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<CosCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
||||||
~CosCalculationNode();
|
~CosCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -503,7 +503,7 @@ public:
|
||||||
static NonnullOwnPtr<TanCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<TanCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
||||||
~TanCalculationNode();
|
~TanCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -522,7 +522,7 @@ public:
|
||||||
static NonnullOwnPtr<AsinCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<AsinCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
||||||
~AsinCalculationNode();
|
~AsinCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -541,7 +541,7 @@ public:
|
||||||
static NonnullOwnPtr<AcosCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<AcosCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
||||||
~AcosCalculationNode();
|
~AcosCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -560,7 +560,7 @@ public:
|
||||||
static NonnullOwnPtr<AtanCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<AtanCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
||||||
~AtanCalculationNode();
|
~AtanCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -579,7 +579,7 @@ public:
|
||||||
static NonnullOwnPtr<Atan2CalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<Atan2CalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
||||||
~Atan2CalculationNode();
|
~Atan2CalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -599,7 +599,7 @@ public:
|
||||||
static NonnullOwnPtr<PowCalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<PowCalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
||||||
~PowCalculationNode();
|
~PowCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override { return false; }
|
virtual bool contains_percentage() const override { return false; }
|
||||||
|
@ -619,7 +619,7 @@ public:
|
||||||
static NonnullOwnPtr<SqrtCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<SqrtCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
||||||
~SqrtCalculationNode();
|
~SqrtCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override { return false; }
|
virtual bool contains_percentage() const override { return false; }
|
||||||
|
@ -638,7 +638,7 @@ public:
|
||||||
static NonnullOwnPtr<HypotCalculationNode> create(Vector<NonnullOwnPtr<CalculationNode>>);
|
static NonnullOwnPtr<HypotCalculationNode> create(Vector<NonnullOwnPtr<CalculationNode>>);
|
||||||
~HypotCalculationNode();
|
~HypotCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -657,7 +657,7 @@ public:
|
||||||
static NonnullOwnPtr<LogCalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<LogCalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
||||||
~LogCalculationNode();
|
~LogCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override { return false; }
|
virtual bool contains_percentage() const override { return false; }
|
||||||
|
@ -677,7 +677,7 @@ public:
|
||||||
static NonnullOwnPtr<ExpCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<ExpCalculationNode> create(NonnullOwnPtr<CalculationNode>);
|
||||||
~ExpCalculationNode();
|
~ExpCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override { return false; }
|
virtual bool contains_percentage() const override { return false; }
|
||||||
|
@ -696,7 +696,7 @@ public:
|
||||||
static NonnullOwnPtr<RoundCalculationNode> create(RoundingStrategy, NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<RoundCalculationNode> create(RoundingStrategy, NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
||||||
~RoundCalculationNode();
|
~RoundCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -717,7 +717,7 @@ public:
|
||||||
static NonnullOwnPtr<ModCalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<ModCalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
||||||
~ModCalculationNode();
|
~ModCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
@ -737,7 +737,7 @@ public:
|
||||||
static NonnullOwnPtr<RemCalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
static NonnullOwnPtr<RemCalculationNode> create(NonnullOwnPtr<CalculationNode>, NonnullOwnPtr<CalculationNode>);
|
||||||
~RemCalculationNode();
|
~RemCalculationNode();
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
virtual Optional<CalculatedStyleValue::ResolvedType> resolved_type() const override;
|
||||||
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
virtual Optional<CSSNumericType> determine_type(PropertyID) const override;
|
||||||
virtual bool contains_percentage() const override;
|
virtual bool contains_percentage() const override;
|
||||||
|
|
|
@ -32,7 +32,7 @@ ValueComparingNonnullRefPtr<ColorStyleValue> ColorStyleValue::create(Color color
|
||||||
return adopt_ref(*new (nothrow) ColorStyleValue(color));
|
return adopt_ref(*new (nothrow) ColorStyleValue(color));
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<String> ColorStyleValue::to_string() const
|
String ColorStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return serialize_a_srgb_value(m_color);
|
return serialize_a_srgb_value(m_color);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
virtual ~ColorStyleValue() override = default;
|
virtual ~ColorStyleValue() override = default;
|
||||||
|
|
||||||
Color color() const { return m_color; }
|
Color color() const { return m_color; }
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual bool has_color() const override { return true; }
|
virtual bool has_color() const override { return true; }
|
||||||
virtual Color to_color(Optional<Layout::NodeWithStyle const&>) const override { return m_color; }
|
virtual Color to_color(Optional<Layout::NodeWithStyle const&>) const override { return m_color; }
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ CompositeStyleValue::CompositeStyleValue(Vector<PropertyID> sub_properties, Vect
|
||||||
|
|
||||||
CompositeStyleValue::~CompositeStyleValue() = default;
|
CompositeStyleValue::~CompositeStyleValue() = default;
|
||||||
|
|
||||||
ErrorOr<String> CompositeStyleValue::to_string() const
|
String CompositeStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
auto first = true;
|
auto first = true;
|
||||||
|
@ -30,9 +30,9 @@ ErrorOr<String> CompositeStyleValue::to_string() const
|
||||||
first = false;
|
first = false;
|
||||||
else
|
else
|
||||||
builder.append(' ');
|
builder.append(' ');
|
||||||
builder.append(TRY(value->to_string()));
|
builder.append(value->to_string());
|
||||||
}
|
}
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
Vector<PropertyID> const& sub_properties() const { return m_properties.sub_properties; }
|
Vector<PropertyID> const& sub_properties() const { return m_properties.sub_properties; }
|
||||||
Vector<ValueComparingNonnullRefPtr<StyleValue const>> const& values() const { return m_properties.values; }
|
Vector<ValueComparingNonnullRefPtr<StyleValue const>> const& values() const { return m_properties.values; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(CompositeStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(CompositeStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -12,27 +12,27 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> ConicGradientStyleValue::to_string() const
|
String ConicGradientStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
if (is_repeating())
|
if (is_repeating())
|
||||||
TRY(builder.try_append("repeating-"sv));
|
builder.append("repeating-"sv);
|
||||||
TRY(builder.try_append("conic-gradient("sv));
|
builder.append("conic-gradient("sv);
|
||||||
bool has_from_angle = false;
|
bool has_from_angle = false;
|
||||||
bool has_at_position = false;
|
bool has_at_position = false;
|
||||||
if ((has_from_angle = m_properties.from_angle.to_degrees() != 0))
|
if ((has_from_angle = m_properties.from_angle.to_degrees() != 0))
|
||||||
TRY(builder.try_appendff("from {}", m_properties.from_angle.to_string()));
|
builder.appendff("from {}", m_properties.from_angle.to_string());
|
||||||
if ((has_at_position = m_properties.position != PositionValue::center())) {
|
if ((has_at_position = m_properties.position != PositionValue::center())) {
|
||||||
if (has_from_angle)
|
if (has_from_angle)
|
||||||
TRY(builder.try_append(' '));
|
builder.append(' ');
|
||||||
TRY(builder.try_appendff("at "sv));
|
builder.appendff("at "sv);
|
||||||
m_properties.position.serialize(builder);
|
m_properties.position.serialize(builder);
|
||||||
}
|
}
|
||||||
if (has_from_angle || has_at_position)
|
if (has_from_angle || has_at_position)
|
||||||
TRY(builder.try_append(", "sv));
|
builder.append(", "sv);
|
||||||
TRY(serialize_color_stop_list(builder, m_properties.color_stop_list));
|
serialize_color_stop_list(builder, m_properties.color_stop_list);
|
||||||
TRY(builder.try_append(')'));
|
builder.append(')');
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConicGradientStyleValue::resolve_for_size(Layout::NodeWithStyleAndBoxModelMetrics const& node, CSSPixelSize size) const
|
void ConicGradientStyleValue::resolve_for_size(Layout::NodeWithStyleAndBoxModelMetrics const& node, CSSPixelSize size) const
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
return adopt_ref(*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;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
void paint(PaintContext&, DevicePixelRect const& dest_rect, CSS::ImageRendering) const override;
|
void paint(PaintContext&, DevicePixelRect const& dest_rect, CSS::ImageRendering) const override;
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> ContentStyleValue::to_string() const
|
String ContentStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
if (has_alt_text())
|
if (has_alt_text())
|
||||||
return String::formatted("{} / {}", TRY(m_properties.content->to_string()), TRY(m_properties.alt_text->to_string()));
|
return MUST(String::formatted("{} / {}", m_properties.content->to_string(), m_properties.alt_text->to_string()));
|
||||||
return m_properties.content->to_string();
|
return m_properties.content->to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
bool has_alt_text() const { return !m_properties.alt_text.is_null(); }
|
bool has_alt_text() const { return !m_properties.alt_text.is_null(); }
|
||||||
StyleValueList const* alt_text() const { return m_properties.alt_text; }
|
StyleValueList const* alt_text() const { return m_properties.alt_text; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(ContentStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(ContentStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
|
|
||||||
FlyString const& custom_ident() const { return m_custom_ident; }
|
FlyString const& custom_ident() const { return m_custom_ident; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override { return m_custom_ident.to_string(); }
|
virtual String to_string() const override { return m_custom_ident.to_string(); }
|
||||||
|
|
||||||
bool properties_equal(CustomIdentStyleValue const& other) const { return m_custom_ident == other.m_custom_ident; }
|
bool properties_equal(CustomIdentStyleValue const& other) const { return m_custom_ident == other.m_custom_ident; }
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ public:
|
||||||
static ValueComparingNonnullRefPtr<DisplayStyleValue> create(Display const&);
|
static ValueComparingNonnullRefPtr<DisplayStyleValue> create(Display const&);
|
||||||
virtual ~DisplayStyleValue() override = default;
|
virtual ~DisplayStyleValue() override = default;
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override { return m_display.to_string(); }
|
virtual String to_string() const override { return m_display.to_string(); }
|
||||||
|
|
||||||
Display display() const { return m_display; }
|
Display display() const { return m_display; }
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> EasingStyleValue::to_string() const
|
String EasingStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
if (m_properties.easing_function == EasingFunction::StepStart)
|
if (m_properties.easing_function == EasingFunction::StepStart)
|
||||||
return "steps(1, start)"_string;
|
return "steps(1, start)"_string;
|
||||||
|
@ -21,20 +21,20 @@ ErrorOr<String> EasingStyleValue::to_string() const
|
||||||
return "steps(1, end)"_string;
|
return "steps(1, end)"_string;
|
||||||
|
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
TRY(builder.try_append(CSS::to_string(m_properties.easing_function)));
|
builder.append(CSS::to_string(m_properties.easing_function));
|
||||||
|
|
||||||
if (m_properties.values.is_empty())
|
if (m_properties.values.is_empty())
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
|
|
||||||
TRY(builder.try_append('('));
|
builder.append('(');
|
||||||
for (size_t i = 0; i < m_properties.values.size(); ++i) {
|
for (size_t i = 0; i < m_properties.values.size(); ++i) {
|
||||||
TRY(builder.try_append(TRY(m_properties.values[i]->to_string())));
|
builder.append(m_properties.values[i]->to_string());
|
||||||
if (i != m_properties.values.size() - 1)
|
if (i != m_properties.values.size() - 1)
|
||||||
TRY(builder.try_append(", "sv));
|
builder.append(", "sv);
|
||||||
}
|
}
|
||||||
TRY(builder.try_append(')'));
|
builder.append(')');
|
||||||
|
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EasingStyleValue::Properties::operator==(Properties const& other) const
|
bool EasingStyleValue::Properties::operator==(Properties const& other) const
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
CSS::EasingFunction easing_function() const { return m_properties.easing_function; }
|
CSS::EasingFunction easing_function() const { return m_properties.easing_function; }
|
||||||
StyleValueVector values() const { return m_properties.values; }
|
StyleValueVector values() const { return m_properties.values; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(EasingStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(EasingStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> EdgeStyleValue::to_string() const
|
String EdgeStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
auto to_string = [](PositionEdge edge) {
|
auto to_string = [](PositionEdge edge) {
|
||||||
switch (edge) {
|
switch (edge) {
|
||||||
|
@ -24,7 +24,7 @@ ErrorOr<String> EdgeStyleValue::to_string() const
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
};
|
};
|
||||||
|
|
||||||
return String::formatted("{} {}", to_string(m_properties.edge), m_properties.offset.to_string());
|
return MUST(String::formatted("{} {}", to_string(m_properties.edge), m_properties.offset.to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
PositionEdge edge() const { return m_properties.edge; }
|
PositionEdge edge() const { return m_properties.edge; }
|
||||||
LengthPercentage const& offset() const { return m_properties.offset; }
|
LengthPercentage const& offset() const { return m_properties.offset; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(EdgeStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(EdgeStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -54,46 +54,43 @@ float Filter::Color::resolved_amount() const
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<String> FilterValueListStyleValue::to_string() const
|
String FilterValueListStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder {};
|
StringBuilder builder {};
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (auto& filter_function : filter_value_list()) {
|
for (auto& filter_function : filter_value_list()) {
|
||||||
if (!first)
|
if (!first)
|
||||||
TRY(builder.try_append(' '));
|
builder.append(' ');
|
||||||
TRY(filter_function.visit(
|
filter_function.visit(
|
||||||
[&](Filter::Blur const& blur) -> ErrorOr<void> {
|
[&](Filter::Blur const& blur) {
|
||||||
TRY(builder.try_append("blur("sv));
|
builder.append("blur("sv);
|
||||||
if (blur.radius.has_value())
|
if (blur.radius.has_value())
|
||||||
TRY(builder.try_append(blur.radius->to_string()));
|
builder.append(blur.radius->to_string());
|
||||||
return {};
|
|
||||||
},
|
},
|
||||||
[&](Filter::DropShadow const& drop_shadow) -> ErrorOr<void> {
|
[&](Filter::DropShadow const& drop_shadow) {
|
||||||
TRY(builder.try_appendff("drop-shadow({} {}"sv,
|
builder.appendff("drop-shadow({} {}"sv,
|
||||||
drop_shadow.offset_x, drop_shadow.offset_y));
|
drop_shadow.offset_x, drop_shadow.offset_y);
|
||||||
if (drop_shadow.radius.has_value())
|
if (drop_shadow.radius.has_value())
|
||||||
TRY(builder.try_appendff(" {}", drop_shadow.radius->to_string()));
|
builder.appendff(" {}", drop_shadow.radius->to_string());
|
||||||
if (drop_shadow.color.has_value()) {
|
if (drop_shadow.color.has_value()) {
|
||||||
TRY(builder.try_append(' '));
|
builder.append(' ');
|
||||||
serialize_a_srgb_value(builder, *drop_shadow.color);
|
serialize_a_srgb_value(builder, *drop_shadow.color);
|
||||||
}
|
}
|
||||||
return {};
|
|
||||||
},
|
},
|
||||||
[&](Filter::HueRotate const& hue_rotate) -> ErrorOr<void> {
|
[&](Filter::HueRotate const& hue_rotate) {
|
||||||
TRY(builder.try_append("hue-rotate("sv));
|
builder.append("hue-rotate("sv);
|
||||||
if (hue_rotate.angle.has_value()) {
|
if (hue_rotate.angle.has_value()) {
|
||||||
TRY(hue_rotate.angle->visit(
|
hue_rotate.angle->visit(
|
||||||
[&](Angle const& angle) -> ErrorOr<void> {
|
[&](Angle const& angle) {
|
||||||
return builder.try_append(angle.to_string());
|
return builder.append(angle.to_string());
|
||||||
},
|
},
|
||||||
[&](auto&) -> ErrorOr<void> {
|
[&](auto&) {
|
||||||
return builder.try_append('0');
|
return builder.append('0');
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
return {};
|
|
||||||
},
|
},
|
||||||
[&](Filter::Color const& color) -> ErrorOr<void> {
|
[&](Filter::Color const& color) {
|
||||||
TRY(builder.try_appendff("{}(",
|
builder.appendff("{}(",
|
||||||
[&] {
|
[&] {
|
||||||
switch (color.operation) {
|
switch (color.operation) {
|
||||||
case Filter::Color::Operation::Brightness:
|
case Filter::Color::Operation::Brightness:
|
||||||
|
@ -113,15 +110,14 @@ ErrorOr<String> FilterValueListStyleValue::to_string() const
|
||||||
default:
|
default:
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
}()));
|
}());
|
||||||
if (color.amount.has_value())
|
if (color.amount.has_value())
|
||||||
TRY(builder.try_append(color.amount->to_string()));
|
builder.append(color.amount->to_string());
|
||||||
return {};
|
});
|
||||||
}));
|
builder.append(')');
|
||||||
TRY(builder.try_append(')'));
|
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ public:
|
||||||
|
|
||||||
Vector<FilterFunction> const& filter_value_list() const { return m_filter_value_list; }
|
Vector<FilterFunction> const& filter_value_list() const { return m_filter_value_list; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
virtual ~FilterValueListStyleValue() override = default;
|
virtual ~FilterValueListStyleValue() override = default;
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> FlexFlowStyleValue::to_string() const
|
String FlexFlowStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return String::formatted("{} {}", TRY(m_properties.flex_direction->to_string()), TRY(m_properties.flex_wrap->to_string()));
|
return MUST(String::formatted("{} {}", m_properties.flex_direction->to_string(), m_properties.flex_wrap->to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
ValueComparingNonnullRefPtr<StyleValue> flex_direction() const { return m_properties.flex_direction; }
|
ValueComparingNonnullRefPtr<StyleValue> flex_direction() const { return m_properties.flex_direction; }
|
||||||
ValueComparingNonnullRefPtr<StyleValue> flex_wrap() const { return m_properties.flex_wrap; }
|
ValueComparingNonnullRefPtr<StyleValue> flex_wrap() const { return m_properties.flex_wrap; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(FlexFlowStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(FlexFlowStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> FlexStyleValue::to_string() const
|
String FlexStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return String::formatted("{} {} {}", TRY(m_properties.grow->to_string()), TRY(m_properties.shrink->to_string()), TRY(m_properties.basis->to_string()));
|
return MUST(String::formatted("{} {} {}", m_properties.grow->to_string(), m_properties.shrink->to_string(), m_properties.basis->to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
ValueComparingNonnullRefPtr<StyleValue> shrink() const { return m_properties.shrink; }
|
ValueComparingNonnullRefPtr<StyleValue> shrink() const { return m_properties.shrink; }
|
||||||
ValueComparingNonnullRefPtr<StyleValue> basis() const { return m_properties.basis; }
|
ValueComparingNonnullRefPtr<StyleValue> basis() const { return m_properties.basis; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(FlexStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(FlexStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> FontStyleValue::to_string() const
|
String FontStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return String::formatted("{} {} {} / {} {}", TRY(m_properties.font_style->to_string()), TRY(m_properties.font_weight->to_string()), TRY(m_properties.font_size->to_string()), TRY(m_properties.line_height->to_string()), TRY(m_properties.font_families->to_string()));
|
return MUST(String::formatted("{} {} {} / {} {}", m_properties.font_style->to_string(), m_properties.font_weight->to_string(), m_properties.font_size->to_string(), m_properties.line_height->to_string(), m_properties.font_families->to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
ValueComparingNonnullRefPtr<StyleValue> line_height() const { return m_properties.line_height; }
|
ValueComparingNonnullRefPtr<StyleValue> line_height() const { return m_properties.line_height; }
|
||||||
ValueComparingNonnullRefPtr<StyleValue> font_families() const { return m_properties.font_families; }
|
ValueComparingNonnullRefPtr<StyleValue> font_families() const { return m_properties.font_families; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(FontStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(FontStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
|
|
||||||
Frequency const& frequency() const { return m_frequency; }
|
Frequency const& frequency() const { return m_frequency; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override { return m_frequency.to_string(); }
|
virtual String to_string() const override { return m_frequency.to_string(); }
|
||||||
|
|
||||||
bool properties_equal(FrequencyStyleValue const& other) const { return m_frequency == other.m_frequency; }
|
bool properties_equal(FrequencyStyleValue const& other) const { return m_frequency == other.m_frequency; }
|
||||||
|
|
||||||
|
|
|
@ -30,18 +30,18 @@ ValueComparingNonnullRefPtr<GridAreaShorthandStyleValue> GridAreaShorthandStyleV
|
||||||
GridTrackPlacementStyleValue::create(column_end)));
|
GridTrackPlacementStyleValue::create(column_end)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<String> GridAreaShorthandStyleValue::to_string() const
|
String GridAreaShorthandStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
if (!m_properties.row_start->as_grid_track_placement().grid_track_placement().is_auto())
|
if (!m_properties.row_start->as_grid_track_placement().grid_track_placement().is_auto())
|
||||||
TRY(builder.try_appendff("{}", m_properties.row_start->as_grid_track_placement().grid_track_placement().to_string()));
|
builder.appendff("{}", m_properties.row_start->as_grid_track_placement().grid_track_placement().to_string());
|
||||||
if (!m_properties.column_start->as_grid_track_placement().grid_track_placement().is_auto())
|
if (!m_properties.column_start->as_grid_track_placement().grid_track_placement().is_auto())
|
||||||
TRY(builder.try_appendff(" / {}", m_properties.column_start->as_grid_track_placement().grid_track_placement().to_string()));
|
builder.appendff(" / {}", m_properties.column_start->as_grid_track_placement().grid_track_placement().to_string());
|
||||||
if (!m_properties.row_end->as_grid_track_placement().grid_track_placement().is_auto())
|
if (!m_properties.row_end->as_grid_track_placement().grid_track_placement().is_auto())
|
||||||
TRY(builder.try_appendff(" / {}", m_properties.row_end->as_grid_track_placement().grid_track_placement().to_string()));
|
builder.appendff(" / {}", m_properties.row_end->as_grid_track_placement().grid_track_placement().to_string());
|
||||||
if (!m_properties.column_end->as_grid_track_placement().grid_track_placement().is_auto())
|
if (!m_properties.column_end->as_grid_track_placement().grid_track_placement().is_auto())
|
||||||
TRY(builder.try_appendff(" / {}", m_properties.column_end->as_grid_track_placement().grid_track_placement().to_string()));
|
builder.appendff(" / {}", m_properties.column_end->as_grid_track_placement().grid_track_placement().to_string());
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
auto row_end() const { return m_properties.row_end; }
|
auto row_end() const { return m_properties.row_end; }
|
||||||
auto column_end() const { return m_properties.column_end; }
|
auto column_end() const { return m_properties.column_end; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(GridAreaShorthandStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(GridAreaShorthandStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ ValueComparingNonnullRefPtr<GridAutoFlowStyleValue> GridAutoFlowStyleValue::crea
|
||||||
return adopt_ref(*new GridAutoFlowStyleValue(axis, dense));
|
return adopt_ref(*new GridAutoFlowStyleValue(axis, dense));
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<String> GridAutoFlowStyleValue::to_string() const
|
String GridAutoFlowStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
if (m_row)
|
if (m_row)
|
||||||
|
@ -22,7 +22,7 @@ ErrorOr<String> GridAutoFlowStyleValue::to_string() const
|
||||||
builder.append("column"sv);
|
builder.append("column"sv);
|
||||||
if (m_dense)
|
if (m_dense)
|
||||||
builder.append(" dense"sv);
|
builder.append(" dense"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
[[nodiscard]] bool is_column() const { return !m_row; }
|
[[nodiscard]] bool is_column() const { return !m_row; }
|
||||||
[[nodiscard]] bool is_dense() const { return m_dense; }
|
[[nodiscard]] bool is_dense() const { return m_dense; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
bool properties_equal(GridAutoFlowStyleValue const& other) const { return m_row == other.m_row && m_dense == other.m_dense; }
|
bool properties_equal(GridAutoFlowStyleValue const& other) const { return m_row == other.m_row && m_dense == other.m_dense; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -16,19 +16,19 @@ ValueComparingNonnullRefPtr<GridTemplateAreaStyleValue> GridTemplateAreaStyleVal
|
||||||
return adopt_ref(*new (nothrow) GridTemplateAreaStyleValue(grid_template_area));
|
return adopt_ref(*new (nothrow) GridTemplateAreaStyleValue(grid_template_area));
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<String> GridTemplateAreaStyleValue::to_string() const
|
String GridTemplateAreaStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
for (size_t y = 0; y < m_grid_template_area.size(); ++y) {
|
for (size_t y = 0; y < m_grid_template_area.size(); ++y) {
|
||||||
for (size_t x = 0; x < m_grid_template_area[y].size(); ++x) {
|
for (size_t x = 0; x < m_grid_template_area[y].size(); ++x) {
|
||||||
TRY(builder.try_appendff("{}", m_grid_template_area[y][x]));
|
builder.appendff("{}", m_grid_template_area[y][x]);
|
||||||
if (x < m_grid_template_area[y].size() - 1)
|
if (x < m_grid_template_area[y].size() - 1)
|
||||||
TRY(builder.try_append(" "sv));
|
builder.append(" "sv);
|
||||||
}
|
}
|
||||||
if (y < m_grid_template_area.size() - 1)
|
if (y < m_grid_template_area.size() - 1)
|
||||||
TRY(builder.try_append(", "sv));
|
builder.append(", "sv);
|
||||||
}
|
}
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
virtual ~GridTemplateAreaStyleValue() override = default;
|
virtual ~GridTemplateAreaStyleValue() override = default;
|
||||||
|
|
||||||
Vector<Vector<String>> const& grid_template_area() const { return m_grid_template_area; }
|
Vector<Vector<String>> const& grid_template_area() const { return m_grid_template_area; }
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(GridTemplateAreaStyleValue const& other) const { return m_grid_template_area == other.m_grid_template_area; }
|
bool properties_equal(GridTemplateAreaStyleValue const& other) const { return m_grid_template_area == other.m_grid_template_area; }
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,11 @@ ValueComparingNonnullRefPtr<GridTrackPlacementShorthandStyleValue> GridTrackPlac
|
||||||
GridTrackPlacementStyleValue::create(GridTrackPlacement::make_auto())));
|
GridTrackPlacementStyleValue::create(GridTrackPlacement::make_auto())));
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<String> GridTrackPlacementShorthandStyleValue::to_string() const
|
String GridTrackPlacementShorthandStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
if (m_properties.end->grid_track_placement().is_auto())
|
if (m_properties.end->grid_track_placement().is_auto())
|
||||||
return String::formatted("{}", m_properties.start->grid_track_placement().to_string());
|
return MUST(String::formatted("{}", m_properties.start->grid_track_placement().to_string()));
|
||||||
return String::formatted("{} / {}", m_properties.start->grid_track_placement().to_string(), m_properties.end->grid_track_placement().to_string());
|
return MUST(String::formatted("{} / {}", m_properties.start->grid_track_placement().to_string(), m_properties.end->grid_track_placement().to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
auto start() const { return m_properties.start; }
|
auto start() const { return m_properties.start; }
|
||||||
auto end() const { return m_properties.end; }
|
auto end() const { return m_properties.end; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(GridTrackPlacementShorthandStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(GridTrackPlacementShorthandStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ ValueComparingNonnullRefPtr<GridTrackPlacementStyleValue> GridTrackPlacementStyl
|
||||||
return adopt_ref(*new (nothrow) GridTrackPlacementStyleValue(grid_track_placement));
|
return adopt_ref(*new (nothrow) GridTrackPlacementStyleValue(grid_track_placement));
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<String> GridTrackPlacementStyleValue::to_string() const
|
String GridTrackPlacementStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return m_grid_track_placement.to_string();
|
return m_grid_track_placement.to_string();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
virtual ~GridTrackPlacementStyleValue() override = default;
|
virtual ~GridTrackPlacementStyleValue() override = default;
|
||||||
|
|
||||||
GridTrackPlacement const& grid_track_placement() const { return m_grid_track_placement; }
|
GridTrackPlacement const& grid_track_placement() const { return m_grid_track_placement; }
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(GridTrackPlacementStyleValue const& other) const { return m_grid_track_placement == other.m_grid_track_placement; }
|
bool properties_equal(GridTrackPlacementStyleValue const& other) const { return m_grid_track_placement == other.m_grid_track_placement; }
|
||||||
|
|
||||||
|
|
|
@ -17,32 +17,32 @@ ValueComparingNonnullRefPtr<GridTrackSizeListShorthandStyleValue> GridTrackSizeL
|
||||||
return adopt_ref(*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
|
String GridTrackSizeListShorthandStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
auto construct_rows_string = [&]() -> ErrorOr<String> {
|
auto construct_rows_string = [&]() {
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
for (auto const& row : m_properties.rows->grid_track_size_list().track_list()) {
|
for (auto const& row : m_properties.rows->grid_track_size_list().track_list()) {
|
||||||
if (m_properties.areas->grid_template_area().size() > idx) {
|
if (m_properties.areas->grid_template_area().size() > idx) {
|
||||||
TRY(builder.try_append("\""sv));
|
builder.append("\""sv);
|
||||||
for (size_t y = 0; y < m_properties.areas->grid_template_area()[idx].size(); ++y) {
|
for (size_t y = 0; y < m_properties.areas->grid_template_area()[idx].size(); ++y) {
|
||||||
TRY(builder.try_append(m_properties.areas->grid_template_area()[idx][y]));
|
builder.append(m_properties.areas->grid_template_area()[idx][y]);
|
||||||
if (y != m_properties.areas->grid_template_area()[idx].size() - 1)
|
if (y != m_properties.areas->grid_template_area()[idx].size() - 1)
|
||||||
TRY(builder.try_append(" "sv));
|
builder.append(" "sv);
|
||||||
}
|
}
|
||||||
TRY(builder.try_append("\" "sv));
|
builder.append("\" "sv);
|
||||||
}
|
}
|
||||||
TRY(builder.try_append(row.to_string()));
|
builder.append(row.to_string());
|
||||||
if (idx < m_properties.rows->grid_track_size_list().track_list().size() - 1)
|
if (idx < m_properties.rows->grid_track_size_list().track_list().size() - 1)
|
||||||
TRY(builder.try_append(' '));
|
builder.append(' ');
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
return TRY(builder.to_string());
|
return MUST(builder.to_string());
|
||||||
};
|
};
|
||||||
|
|
||||||
if (m_properties.columns->grid_track_size_list().track_list().size() == 0)
|
if (m_properties.columns->grid_track_size_list().track_list().size() == 0)
|
||||||
return String::formatted("{}", TRY(construct_rows_string()));
|
return MUST(String::formatted("{}", construct_rows_string()));
|
||||||
return String::formatted("{} / {}", TRY(construct_rows_string()), m_properties.columns->grid_track_size_list().to_string());
|
return MUST(String::formatted("{} / {}", construct_rows_string(), m_properties.columns->grid_track_size_list().to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
auto columns() const { return m_properties.columns; }
|
auto columns() const { return m_properties.columns; }
|
||||||
auto areas() const { return m_properties.areas; }
|
auto areas() const { return m_properties.areas; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(GridTrackSizeListShorthandStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(GridTrackSizeListShorthandStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> GridTrackSizeListStyleValue::to_string() const
|
String GridTrackSizeListStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return m_grid_track_size_list.to_string();
|
return m_grid_track_size_list.to_string();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
|
|
||||||
CSS::GridTrackSizeList grid_track_size_list() const { return m_grid_track_size_list; }
|
CSS::GridTrackSizeList grid_track_size_list() const { return m_grid_track_size_list; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(GridTrackSizeListStyleValue const& other) const { return m_grid_track_size_list == other.m_grid_track_size_list; }
|
bool properties_equal(GridTrackSizeListStyleValue const& other) const { return m_grid_track_size_list == other.m_grid_track_size_list; }
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> IdentifierStyleValue::to_string() const
|
String IdentifierStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return String::from_utf8(CSS::string_from_value_id(m_id));
|
return MUST(String::from_utf8(CSS::string_from_value_id(m_id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IdentifierStyleValue::has_color() const
|
bool IdentifierStyleValue::has_color() const
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
|
|
||||||
virtual bool has_color() const override;
|
virtual bool has_color() const override;
|
||||||
virtual Color to_color(Optional<Layout::NodeWithStyle const&> node) const override;
|
virtual Color to_color(Optional<Layout::NodeWithStyle const&> node) const override;
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(IdentifierStyleValue const& other) const { return m_id == other.m_id; }
|
bool properties_equal(IdentifierStyleValue const& other) const { return m_id == other.m_id; }
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ Gfx::Bitmap const* ImageStyleValue::bitmap(size_t frame_index, Gfx::IntSize size
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<String> ImageStyleValue::to_string() const
|
String ImageStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return serialize_a_url(m_url.to_deprecated_string());
|
return serialize_a_url(m_url.to_deprecated_string());
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
}
|
}
|
||||||
virtual ~ImageStyleValue() override = default;
|
virtual ~ImageStyleValue() override = default;
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
virtual bool equals(StyleValue const& other) const override;
|
virtual bool equals(StyleValue const& other) const override;
|
||||||
|
|
||||||
virtual void load_any_resources(DOM::Document&) override;
|
virtual void load_any_resources(DOM::Document&) override;
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
}
|
}
|
||||||
virtual ~InheritStyleValue() override = default;
|
virtual ~InheritStyleValue() override = default;
|
||||||
|
|
||||||
ErrorOr<String> to_string() const override { return "inherit"_string; }
|
String to_string() const override { return "inherit"_string; }
|
||||||
|
|
||||||
bool properties_equal(InheritStyleValue const&) const { return true; }
|
bool properties_equal(InheritStyleValue const&) const { return true; }
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
}
|
}
|
||||||
virtual ~InitialStyleValue() override = default;
|
virtual ~InitialStyleValue() override = default;
|
||||||
|
|
||||||
ErrorOr<String> to_string() const override { return "initial"_string; }
|
String to_string() const override { return "initial"_string; }
|
||||||
|
|
||||||
bool properties_equal(InitialStyleValue const&) const { return true; }
|
bool properties_equal(InitialStyleValue const&) const { return true; }
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> IntegerStyleValue::to_string() const
|
String IntegerStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return String::number(m_value);
|
return MUST(String::number(m_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
|
|
||||||
i64 integer() const { return m_value; }
|
i64 integer() const { return m_value; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(IntegerStyleValue const& other) const { return m_value == other.m_value; }
|
bool properties_equal(IntegerStyleValue const& other) const { return m_value == other.m_value; }
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
|
|
||||||
Length const& length() const { return m_length; }
|
Length const& length() const { return m_length; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override { return m_length.to_string(); }
|
virtual String to_string() const override { return m_length.to_string(); }
|
||||||
virtual ValueComparingNonnullRefPtr<StyleValue const> absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const override;
|
virtual ValueComparingNonnullRefPtr<StyleValue const> absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const override;
|
||||||
|
|
||||||
bool properties_equal(LengthStyleValue const& other) const { return m_length == other.m_length; }
|
bool properties_equal(LengthStyleValue const& other) const { return m_length == other.m_length; }
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> LinearGradientStyleValue::to_string() const
|
String LinearGradientStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
auto side_or_corner_to_string = [](SideOrCorner value) {
|
auto side_or_corner_to_string = [](SideOrCorner value) {
|
||||||
|
@ -38,21 +38,21 @@ ErrorOr<String> LinearGradientStyleValue::to_string() const
|
||||||
};
|
};
|
||||||
|
|
||||||
if (m_properties.gradient_type == GradientType::WebKit)
|
if (m_properties.gradient_type == GradientType::WebKit)
|
||||||
TRY(builder.try_append("-webkit-"sv));
|
builder.append("-webkit-"sv);
|
||||||
if (is_repeating())
|
if (is_repeating())
|
||||||
TRY(builder.try_append("repeating-"sv));
|
builder.append("repeating-"sv);
|
||||||
TRY(builder.try_append("linear-gradient("sv));
|
builder.append("linear-gradient("sv);
|
||||||
TRY(m_properties.direction.visit(
|
m_properties.direction.visit(
|
||||||
[&](SideOrCorner side_or_corner) -> ErrorOr<void> {
|
[&](SideOrCorner side_or_corner) {
|
||||||
return builder.try_appendff("{}{}, "sv, m_properties.gradient_type == GradientType::Standard ? "to "sv : ""sv, side_or_corner_to_string(side_or_corner));
|
return builder.appendff("{}{}, "sv, m_properties.gradient_type == GradientType::Standard ? "to "sv : ""sv, side_or_corner_to_string(side_or_corner));
|
||||||
},
|
},
|
||||||
[&](Angle const& angle) -> ErrorOr<void> {
|
[&](Angle const& angle) {
|
||||||
return builder.try_appendff("{}, "sv, angle.to_string());
|
return builder.appendff("{}, "sv, angle.to_string());
|
||||||
}));
|
});
|
||||||
|
|
||||||
TRY(serialize_color_stop_list(builder, m_properties.color_stop_list));
|
serialize_color_stop_list(builder, m_properties.color_stop_list);
|
||||||
TRY(builder.try_append(")"sv));
|
builder.append(")"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LinearGradientStyleValue::equals(StyleValue const& other_) const
|
bool LinearGradientStyleValue::equals(StyleValue const& other_) const
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
return adopt_ref(*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;
|
virtual String to_string() const override;
|
||||||
virtual ~LinearGradientStyleValue() override = default;
|
virtual ~LinearGradientStyleValue() override = default;
|
||||||
virtual bool equals(StyleValue const& other) const override;
|
virtual bool equals(StyleValue const& other) const override;
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> ListStyleStyleValue::to_string() const
|
String ListStyleStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return String::formatted("{} {} {}", TRY(m_properties.position->to_string()), TRY(m_properties.image->to_string()), TRY(m_properties.style_type->to_string()));
|
return MUST(String::formatted("{} {} {}", m_properties.position->to_string(), m_properties.image->to_string(), m_properties.style_type->to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
ValueComparingNonnullRefPtr<StyleValue> image() const { return m_properties.image; }
|
ValueComparingNonnullRefPtr<StyleValue> image() const { return m_properties.image; }
|
||||||
ValueComparingNonnullRefPtr<StyleValue> style_type() const { return m_properties.style_type; }
|
ValueComparingNonnullRefPtr<StyleValue> style_type() const { return m_properties.style_type; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(ListStyleStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(ListStyleStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> NumberStyleValue::to_string() const
|
String NumberStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return String::number(m_value);
|
return MUST(String::number(m_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
|
|
||||||
double number() const { return m_value; }
|
double number() const { return m_value; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(NumberStyleValue const& other) const { return m_value == other.m_value; }
|
bool properties_equal(NumberStyleValue const& other) const { return m_value == other.m_value; }
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> OverflowStyleValue::to_string() const
|
String OverflowStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return String::formatted("{} {}", TRY(m_properties.overflow_x->to_string()), TRY(m_properties.overflow_y->to_string()));
|
return MUST(String::formatted("{} {}", m_properties.overflow_x->to_string(), m_properties.overflow_y->to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
ValueComparingNonnullRefPtr<StyleValue> overflow_x() const { return m_properties.overflow_x; }
|
ValueComparingNonnullRefPtr<StyleValue> overflow_x() const { return m_properties.overflow_x; }
|
||||||
ValueComparingNonnullRefPtr<StyleValue> overflow_y() const { return m_properties.overflow_y; }
|
ValueComparingNonnullRefPtr<StyleValue> overflow_y() const { return m_properties.overflow_y; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(OverflowStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(OverflowStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
Percentage const& percentage() const { return m_percentage; }
|
Percentage const& percentage() const { return m_percentage; }
|
||||||
Percentage& percentage() { return m_percentage; }
|
Percentage& percentage() { return m_percentage; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override { return m_percentage.to_string(); }
|
virtual String to_string() const override { return m_percentage.to_string(); }
|
||||||
|
|
||||||
bool properties_equal(PercentageStyleValue const& other) const { return m_percentage == other.m_percentage; }
|
bool properties_equal(PercentageStyleValue const& other) const { return m_percentage == other.m_percentage; }
|
||||||
|
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> PlaceContentStyleValue::to_string() const
|
String PlaceContentStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
auto align_content = TRY(m_properties.align_content->to_string());
|
auto align_content = m_properties.align_content->to_string();
|
||||||
auto justify_content = TRY(m_properties.justify_content->to_string());
|
auto justify_content = m_properties.justify_content->to_string();
|
||||||
if (align_content == justify_content)
|
if (align_content == justify_content)
|
||||||
return String::formatted("{}", align_content);
|
return MUST(String::formatted("{}", align_content));
|
||||||
return String::formatted("{} {}", align_content, justify_content);
|
return MUST(String::formatted("{} {}", align_content, justify_content));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
ValueComparingNonnullRefPtr<StyleValue> align_content() const { return m_properties.align_content; }
|
ValueComparingNonnullRefPtr<StyleValue> align_content() const { return m_properties.align_content; }
|
||||||
ValueComparingNonnullRefPtr<StyleValue> justify_content() const { return m_properties.justify_content; }
|
ValueComparingNonnullRefPtr<StyleValue> justify_content() const { return m_properties.justify_content; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(PlaceContentStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(PlaceContentStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> PlaceItemsStyleValue::to_string() const
|
String PlaceItemsStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
auto align_items = TRY(m_properties.align_items->to_string());
|
auto align_items = m_properties.align_items->to_string();
|
||||||
auto justify_items = TRY(m_properties.justify_items->to_string());
|
auto justify_items = m_properties.justify_items->to_string();
|
||||||
if (align_items == justify_items)
|
if (align_items == justify_items)
|
||||||
return String::formatted("{}", align_items);
|
return MUST(String::formatted("{}", align_items));
|
||||||
return String::formatted("{} {}", align_items, justify_items);
|
return MUST(String::formatted("{} {}", align_items, justify_items));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
ValueComparingNonnullRefPtr<StyleValue> align_items() const { return m_properties.align_items; }
|
ValueComparingNonnullRefPtr<StyleValue> align_items() const { return m_properties.align_items; }
|
||||||
ValueComparingNonnullRefPtr<StyleValue> justify_items() const { return m_properties.justify_items; }
|
ValueComparingNonnullRefPtr<StyleValue> justify_items() const { return m_properties.justify_items; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(PlaceItemsStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(PlaceItemsStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> PlaceSelfStyleValue::to_string() const
|
String PlaceSelfStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
auto align_self = TRY(m_properties.align_self->to_string());
|
auto align_self = m_properties.align_self->to_string();
|
||||||
auto justify_self = TRY(m_properties.justify_self->to_string());
|
auto justify_self = m_properties.justify_self->to_string();
|
||||||
if (align_self == justify_self)
|
if (align_self == justify_self)
|
||||||
return String::formatted("{}", align_self);
|
return MUST(String::formatted("{}", align_self));
|
||||||
return String::formatted("{} {}", align_self, justify_self);
|
return MUST(String::formatted("{} {}", align_self, justify_self));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
ValueComparingNonnullRefPtr<StyleValue> align_self() const { return m_properties.align_self; }
|
ValueComparingNonnullRefPtr<StyleValue> align_self() const { return m_properties.align_self; }
|
||||||
ValueComparingNonnullRefPtr<StyleValue> justify_self() const { return m_properties.justify_self; }
|
ValueComparingNonnullRefPtr<StyleValue> justify_self() const { return m_properties.justify_self; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(PlaceSelfStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(PlaceSelfStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> PositionStyleValue::to_string() const
|
String PositionStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return String::formatted("{} {}", TRY(m_properties.edge_x->to_string()), TRY(m_properties.edge_y->to_string()));
|
return MUST(String::formatted("{} {}", m_properties.edge_x->to_string(), m_properties.edge_y->to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
ValueComparingNonnullRefPtr<StyleValue> edge_x() const { return m_properties.edge_x; }
|
ValueComparingNonnullRefPtr<StyleValue> edge_x() const { return m_properties.edge_x; }
|
||||||
ValueComparingNonnullRefPtr<StyleValue> edge_y() const { return m_properties.edge_y; }
|
ValueComparingNonnullRefPtr<StyleValue> edge_y() const { return m_properties.edge_y; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(PositionStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(PositionStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -12,17 +12,17 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> RadialGradientStyleValue::to_string() const
|
String RadialGradientStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
if (is_repeating())
|
if (is_repeating())
|
||||||
TRY(builder.try_append("repeating-"sv));
|
builder.append("repeating-"sv);
|
||||||
TRY(builder.try_appendff("radial-gradient({} "sv,
|
builder.appendff("radial-gradient({} "sv,
|
||||||
m_properties.ending_shape == EndingShape::Circle ? "circle"sv : "ellipse"sv));
|
m_properties.ending_shape == EndingShape::Circle ? "circle"sv : "ellipse"sv);
|
||||||
|
|
||||||
TRY(m_properties.size.visit(
|
m_properties.size.visit(
|
||||||
[&](Extent extent) -> ErrorOr<void> {
|
[&](Extent extent) {
|
||||||
return builder.try_append([&] {
|
builder.append([&] {
|
||||||
switch (extent) {
|
switch (extent) {
|
||||||
case Extent::ClosestCorner:
|
case Extent::ClosestCorner:
|
||||||
return "closest-corner"sv;
|
return "closest-corner"sv;
|
||||||
|
@ -37,22 +37,22 @@ ErrorOr<String> RadialGradientStyleValue::to_string() const
|
||||||
}
|
}
|
||||||
}());
|
}());
|
||||||
},
|
},
|
||||||
[&](CircleSize const& circle_size) -> ErrorOr<void> {
|
[&](CircleSize const& circle_size) {
|
||||||
return builder.try_append(circle_size.radius.to_string());
|
builder.append(circle_size.radius.to_string());
|
||||||
},
|
},
|
||||||
[&](EllipseSize const& ellipse_size) -> ErrorOr<void> {
|
[&](EllipseSize const& ellipse_size) {
|
||||||
return builder.try_appendff("{} {}", ellipse_size.radius_a.to_string(), ellipse_size.radius_b.to_string());
|
builder.appendff("{} {}", ellipse_size.radius_a.to_string(), ellipse_size.radius_b.to_string());
|
||||||
}));
|
});
|
||||||
|
|
||||||
if (m_properties.position != PositionValue::center()) {
|
if (m_properties.position != PositionValue::center()) {
|
||||||
TRY(builder.try_appendff(" at "sv));
|
builder.appendff(" at "sv);
|
||||||
m_properties.position.serialize(builder);
|
m_properties.position.serialize(builder);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRY(builder.try_append(", "sv));
|
builder.append(", "sv);
|
||||||
TRY(serialize_color_stop_list(builder, m_properties.color_stop_list));
|
serialize_color_stop_list(builder, m_properties.color_stop_list);
|
||||||
TRY(builder.try_append(')'));
|
builder.append(')');
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::FloatSize RadialGradientStyleValue::resolve_size(Layout::Node const& node, Gfx::FloatPoint center, Gfx::FloatRect const& size) const
|
Gfx::FloatSize RadialGradientStyleValue::resolve_size(Layout::Node const& node, Gfx::FloatPoint center, Gfx::FloatRect const& size) const
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
return adopt_ref(*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;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
void paint(PaintContext&, DevicePixelRect const& dest_rect, CSS::ImageRendering) const override;
|
void paint(PaintContext&, DevicePixelRect const& dest_rect, CSS::ImageRendering) const override;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
Ratio const& ratio() const { return m_ratio; }
|
Ratio const& ratio() const { return m_ratio; }
|
||||||
Ratio& ratio() { return m_ratio; }
|
Ratio& ratio() { return m_ratio; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override { return m_ratio.to_string(); }
|
virtual String to_string() const override { return m_ratio.to_string(); }
|
||||||
|
|
||||||
bool properties_equal(RatioStyleValue const& other) const { return m_ratio == other.m_ratio; }
|
bool properties_equal(RatioStyleValue const& other) const { return m_ratio == other.m_ratio; }
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,9 @@ ValueComparingNonnullRefPtr<RectStyleValue> RectStyleValue::create(EdgeRect rect
|
||||||
return adopt_ref(*new (nothrow) RectStyleValue(move(rect)));
|
return adopt_ref(*new (nothrow) RectStyleValue(move(rect)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<String> RectStyleValue::to_string() const
|
String RectStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return String::formatted("rect({} {} {} {})", m_rect.top_edge, m_rect.right_edge, m_rect.bottom_edge, m_rect.left_edge);
|
return MUST(String::formatted("rect({} {} {} {})", m_rect.top_edge, m_rect.right_edge, m_rect.bottom_edge, m_rect.left_edge));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
virtual ~RectStyleValue() override = default;
|
virtual ~RectStyleValue() override = default;
|
||||||
|
|
||||||
EdgeRect rect() const { return m_rect; }
|
EdgeRect rect() const { return m_rect; }
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(RectStyleValue const& other) const { return m_rect == other.m_rect; }
|
bool properties_equal(RectStyleValue const& other) const { return m_rect == other.m_rect; }
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
|
|
||||||
Resolution const& resolution() const { return m_resolution; }
|
Resolution const& resolution() const { return m_resolution; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override { return m_resolution.to_string(); }
|
virtual String to_string() const override { return m_resolution.to_string(); }
|
||||||
|
|
||||||
bool properties_equal(ResolutionStyleValue const& other) const { return m_resolution == other.m_resolution; }
|
bool properties_equal(ResolutionStyleValue const& other) const { return m_resolution == other.m_resolution; }
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
}
|
}
|
||||||
virtual ~RevertStyleValue() override = default;
|
virtual ~RevertStyleValue() override = default;
|
||||||
|
|
||||||
ErrorOr<String> to_string() const override { return "revert"_string; }
|
String to_string() const override { return "revert"_string; }
|
||||||
|
|
||||||
bool properties_equal(RevertStyleValue const&) const { return true; }
|
bool properties_equal(RevertStyleValue const&) const { return true; }
|
||||||
|
|
||||||
|
|
|
@ -11,13 +11,13 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> ShadowStyleValue::to_string() const
|
String ShadowStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
TRY(builder.try_appendff("{} {} {} {} {}", m_properties.color.to_deprecated_string(), TRY(m_properties.offset_x->to_string()), TRY(m_properties.offset_y->to_string()), TRY(m_properties.blur_radius->to_string()), TRY(m_properties.spread_distance->to_string())));
|
builder.appendff("{} {} {} {} {}", m_properties.color.to_deprecated_string(), m_properties.offset_x->to_string(), m_properties.offset_y->to_string(), m_properties.blur_radius->to_string(), m_properties.spread_distance->to_string());
|
||||||
if (m_properties.placement == ShadowPlacement::Inner)
|
if (m_properties.placement == ShadowPlacement::Inner)
|
||||||
TRY(builder.try_append(" inset"sv));
|
builder.append(" inset"sv);
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
ValueComparingNonnullRefPtr<StyleValue const> ShadowStyleValue::absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const
|
ValueComparingNonnullRefPtr<StyleValue const> ShadowStyleValue::absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
ValueComparingNonnullRefPtr<StyleValue const> const& spread_distance() const { return m_properties.spread_distance; }
|
ValueComparingNonnullRefPtr<StyleValue const> const& spread_distance() const { return m_properties.spread_distance; }
|
||||||
ShadowPlacement placement() const { return m_properties.placement; }
|
ShadowPlacement placement() const { return m_properties.placement; }
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(ShadowStyleValue const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(ShadowStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
}
|
}
|
||||||
virtual ~StringStyleValue() override = default;
|
virtual ~StringStyleValue() override = default;
|
||||||
|
|
||||||
ErrorOr<String> to_string() const override { return m_string; }
|
String to_string() const override { return m_string; }
|
||||||
|
|
||||||
bool properties_equal(StringStyleValue const& other) const { return m_string == other.m_string; }
|
bool properties_equal(StringStyleValue const& other) const { return m_string == other.m_string; }
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ bool StyleValueList::Properties::operator==(Properties const& other) const
|
||||||
return separator == other.separator && values.span() == other.values.span();
|
return separator == other.separator && values.span() == other.values.span();
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<String> StyleValueList::to_string() const
|
String StyleValueList::to_string() const
|
||||||
{
|
{
|
||||||
auto separator = ""sv;
|
auto separator = ""sv;
|
||||||
switch (m_properties.separator) {
|
switch (m_properties.separator) {
|
||||||
|
@ -32,11 +32,11 @@ ErrorOr<String> StyleValueList::to_string() const
|
||||||
|
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
for (size_t i = 0; i < m_properties.values.size(); ++i) {
|
for (size_t i = 0; i < m_properties.values.size(); ++i) {
|
||||||
TRY(builder.try_append(TRY(m_properties.values[i]->to_string())));
|
builder.append(m_properties.values[i]->to_string());
|
||||||
if (i != m_properties.values.size() - 1)
|
if (i != m_properties.values.size() - 1)
|
||||||
TRY(builder.try_append(separator));
|
builder.append(separator);
|
||||||
}
|
}
|
||||||
return builder.to_string();
|
return MUST(builder.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
return m_properties.values[i];
|
return m_properties.values[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ErrorOr<String> to_string() const override;
|
virtual String to_string() const override;
|
||||||
|
|
||||||
bool properties_equal(StyleValueList const& other) const { return m_properties == other.m_properties; }
|
bool properties_equal(StyleValueList const& other) const { return m_properties == other.m_properties; }
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
ErrorOr<String> TextDecorationStyleValue::to_string() const
|
String TextDecorationStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
return String::formatted("{} {} {} {}", TRY(m_properties.line->to_string()), TRY(m_properties.thickness->to_string()), TRY(m_properties.style->to_string()), TRY(m_properties.color->to_string()));
|
return MUST(String::formatted("{} {} {} {}", m_properties.line->to_string(), m_properties.thickness->to_string(), m_properties.style->to_string(), m_properties.color->to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue