diff --git a/Userland/Libraries/LibWeb/CSS/Display.cpp b/Userland/Libraries/LibWeb/CSS/Display.cpp index 45844cef7f..b8370d7101 100644 --- a/Userland/Libraries/LibWeb/CSS/Display.cpp +++ b/Userland/Libraries/LibWeb/CSS/Display.cpp @@ -8,98 +8,98 @@ namespace Web::CSS { -DeprecatedString Display::to_deprecated_string() const +ErrorOr Display::to_string() const { StringBuilder builder; switch (m_type) { case Type::OutsideAndInside: switch (m_value.outside_inside.outside) { case Outside::Block: - builder.append("block"sv); + TRY(builder.try_append("block"sv)); break; case Outside::Inline: - builder.append("inline"sv); + TRY(builder.try_append("inline"sv)); break; case Outside::RunIn: - builder.append("run-in"sv); + TRY(builder.try_append("run-in"sv)); break; } - builder.append(' '); + TRY(builder.try_append(' ')); switch (m_value.outside_inside.inside) { case Inside::Flow: - builder.append("flow"sv); + TRY(builder.try_append("flow"sv)); break; case Inside::FlowRoot: - builder.append("flow-root"sv); + TRY(builder.try_append("flow-root"sv)); break; case Inside::Table: - builder.append("table"sv); + TRY(builder.try_append("table"sv)); break; case Inside::Flex: - builder.append("flex"sv); + TRY(builder.try_append("flex"sv)); break; case Inside::Grid: - builder.append("grid"sv); + TRY(builder.try_append("grid"sv)); break; case Inside::Ruby: - builder.append("ruby"sv); + TRY(builder.try_append("ruby"sv)); break; } if (m_value.outside_inside.list_item == ListItem::Yes) - builder.append(" list-item"sv); + TRY(builder.try_append(" list-item"sv)); break; case Type::Internal: switch (m_value.internal) { case Internal::TableRowGroup: - builder.append("table-row-group"sv); + TRY(builder.try_append("table-row-group"sv)); break; case Internal::TableHeaderGroup: - builder.append("table-header-group"sv); + TRY(builder.try_append("table-header-group"sv)); break; case Internal::TableFooterGroup: - builder.append("table-footer-group"sv); + TRY(builder.try_append("table-footer-group"sv)); break; case Internal::TableRow: - builder.append("table-row"sv); + TRY(builder.try_append("table-row"sv)); break; case Internal::TableCell: - builder.append("table-cell"sv); + TRY(builder.try_append("table-cell"sv)); break; case Internal::TableColumnGroup: - builder.append("table-column-group"sv); + TRY(builder.try_append("table-column-group"sv)); break; case Internal::TableColumn: - builder.append("table-column"sv); + TRY(builder.try_append("table-column"sv)); break; case Internal::TableCaption: - builder.append("table-caption"sv); + TRY(builder.try_append("table-caption"sv)); break; case Internal::RubyBase: - builder.append("ruby-base"sv); + TRY(builder.try_append("ruby-base"sv)); break; case Internal::RubyText: - builder.append("ruby-text"sv); + TRY(builder.try_append("ruby-text"sv)); break; case Internal::RubyBaseContainer: - builder.append("ruby-base-container"sv); + TRY(builder.try_append("ruby-base-container"sv)); break; case Internal::RubyTextContainer: - builder.append("ruby-text-container"sv); + TRY(builder.try_append("ruby-text-container"sv)); break; } break; case Type::Box: switch (m_value.box) { case Box::Contents: - builder.append("contents"sv); + TRY(builder.try_append("contents"sv)); break; case Box::None: - builder.append("none"sv); + TRY(builder.try_append("none"sv)); break; } break; }; - return builder.to_deprecated_string(); + return builder.to_string(); } } diff --git a/Userland/Libraries/LibWeb/CSS/Display.h b/Userland/Libraries/LibWeb/CSS/Display.h index 294846d108..5d041b6285 100644 --- a/Userland/Libraries/LibWeb/CSS/Display.h +++ b/Userland/Libraries/LibWeb/CSS/Display.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include namespace Web::CSS { @@ -16,7 +16,7 @@ public: Display() = default; ~Display() = default; - DeprecatedString to_deprecated_string() const; + ErrorOr to_string() const; bool operator==(Display const& other) const { diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 57704c1631..84227f7a35 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -318,7 +318,7 @@ JS::GCPtr Element::create_layout_node_for_display_type(DOM::Docume return document.heap().allocate_without_realm(document, element, move(style)); if (display.is_flex_inside()) return document.heap().allocate_without_realm(document, element, move(style)); - dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Support display: {}", display.to_deprecated_string()); + dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Support display: {}", MUST(display.to_string())); return document.heap().allocate_without_realm(document, element, move(style)); } diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index 2ad2b0b58d..f94cb6dfca 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -161,7 +161,7 @@ OwnPtr FormattingContext::create_independent_formatting_conte // The child box is a block container that doesn't create its own BFC. // It will be formatted by this BFC. if (!child_display.is_flow_inside()) { - dbgln("FIXME: Child box doesn't create BFC, but inside is also not flow! display={}", child_display.to_deprecated_string()); + dbgln("FIXME: Child box doesn't create BFC, but inside is also not flow! display={}", MUST(child_display.to_string())); // HACK: Instead of crashing, create a dummy formatting context that does nothing. // FIXME: Remove this once it's no longer needed. It currently swallows problem with standalone // table-related boxes that don't get fixed up by CSS anonymous table box generation.