mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:47:35 +00:00
LibWeb: Port CSS::Display to new Strings
This commit is contained in:
parent
41c4cc95e4
commit
dca19b764b
4 changed files with 31 additions and 31 deletions
|
@ -8,98 +8,98 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
DeprecatedString Display::to_deprecated_string() const
|
ErrorOr<String> Display::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case Type::OutsideAndInside:
|
case Type::OutsideAndInside:
|
||||||
switch (m_value.outside_inside.outside) {
|
switch (m_value.outside_inside.outside) {
|
||||||
case Outside::Block:
|
case Outside::Block:
|
||||||
builder.append("block"sv);
|
TRY(builder.try_append("block"sv));
|
||||||
break;
|
break;
|
||||||
case Outside::Inline:
|
case Outside::Inline:
|
||||||
builder.append("inline"sv);
|
TRY(builder.try_append("inline"sv));
|
||||||
break;
|
break;
|
||||||
case Outside::RunIn:
|
case Outside::RunIn:
|
||||||
builder.append("run-in"sv);
|
TRY(builder.try_append("run-in"sv));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
builder.append(' ');
|
TRY(builder.try_append(' '));
|
||||||
switch (m_value.outside_inside.inside) {
|
switch (m_value.outside_inside.inside) {
|
||||||
case Inside::Flow:
|
case Inside::Flow:
|
||||||
builder.append("flow"sv);
|
TRY(builder.try_append("flow"sv));
|
||||||
break;
|
break;
|
||||||
case Inside::FlowRoot:
|
case Inside::FlowRoot:
|
||||||
builder.append("flow-root"sv);
|
TRY(builder.try_append("flow-root"sv));
|
||||||
break;
|
break;
|
||||||
case Inside::Table:
|
case Inside::Table:
|
||||||
builder.append("table"sv);
|
TRY(builder.try_append("table"sv));
|
||||||
break;
|
break;
|
||||||
case Inside::Flex:
|
case Inside::Flex:
|
||||||
builder.append("flex"sv);
|
TRY(builder.try_append("flex"sv));
|
||||||
break;
|
break;
|
||||||
case Inside::Grid:
|
case Inside::Grid:
|
||||||
builder.append("grid"sv);
|
TRY(builder.try_append("grid"sv));
|
||||||
break;
|
break;
|
||||||
case Inside::Ruby:
|
case Inside::Ruby:
|
||||||
builder.append("ruby"sv);
|
TRY(builder.try_append("ruby"sv));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (m_value.outside_inside.list_item == ListItem::Yes)
|
if (m_value.outside_inside.list_item == ListItem::Yes)
|
||||||
builder.append(" list-item"sv);
|
TRY(builder.try_append(" list-item"sv));
|
||||||
break;
|
break;
|
||||||
case Type::Internal:
|
case Type::Internal:
|
||||||
switch (m_value.internal) {
|
switch (m_value.internal) {
|
||||||
case Internal::TableRowGroup:
|
case Internal::TableRowGroup:
|
||||||
builder.append("table-row-group"sv);
|
TRY(builder.try_append("table-row-group"sv));
|
||||||
break;
|
break;
|
||||||
case Internal::TableHeaderGroup:
|
case Internal::TableHeaderGroup:
|
||||||
builder.append("table-header-group"sv);
|
TRY(builder.try_append("table-header-group"sv));
|
||||||
break;
|
break;
|
||||||
case Internal::TableFooterGroup:
|
case Internal::TableFooterGroup:
|
||||||
builder.append("table-footer-group"sv);
|
TRY(builder.try_append("table-footer-group"sv));
|
||||||
break;
|
break;
|
||||||
case Internal::TableRow:
|
case Internal::TableRow:
|
||||||
builder.append("table-row"sv);
|
TRY(builder.try_append("table-row"sv));
|
||||||
break;
|
break;
|
||||||
case Internal::TableCell:
|
case Internal::TableCell:
|
||||||
builder.append("table-cell"sv);
|
TRY(builder.try_append("table-cell"sv));
|
||||||
break;
|
break;
|
||||||
case Internal::TableColumnGroup:
|
case Internal::TableColumnGroup:
|
||||||
builder.append("table-column-group"sv);
|
TRY(builder.try_append("table-column-group"sv));
|
||||||
break;
|
break;
|
||||||
case Internal::TableColumn:
|
case Internal::TableColumn:
|
||||||
builder.append("table-column"sv);
|
TRY(builder.try_append("table-column"sv));
|
||||||
break;
|
break;
|
||||||
case Internal::TableCaption:
|
case Internal::TableCaption:
|
||||||
builder.append("table-caption"sv);
|
TRY(builder.try_append("table-caption"sv));
|
||||||
break;
|
break;
|
||||||
case Internal::RubyBase:
|
case Internal::RubyBase:
|
||||||
builder.append("ruby-base"sv);
|
TRY(builder.try_append("ruby-base"sv));
|
||||||
break;
|
break;
|
||||||
case Internal::RubyText:
|
case Internal::RubyText:
|
||||||
builder.append("ruby-text"sv);
|
TRY(builder.try_append("ruby-text"sv));
|
||||||
break;
|
break;
|
||||||
case Internal::RubyBaseContainer:
|
case Internal::RubyBaseContainer:
|
||||||
builder.append("ruby-base-container"sv);
|
TRY(builder.try_append("ruby-base-container"sv));
|
||||||
break;
|
break;
|
||||||
case Internal::RubyTextContainer:
|
case Internal::RubyTextContainer:
|
||||||
builder.append("ruby-text-container"sv);
|
TRY(builder.try_append("ruby-text-container"sv));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Type::Box:
|
case Type::Box:
|
||||||
switch (m_value.box) {
|
switch (m_value.box) {
|
||||||
case Box::Contents:
|
case Box::Contents:
|
||||||
builder.append("contents"sv);
|
TRY(builder.try_append("contents"sv));
|
||||||
break;
|
break;
|
||||||
case Box::None:
|
case Box::None:
|
||||||
builder.append("none"sv);
|
TRY(builder.try_append("none"sv));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
return builder.to_deprecated_string();
|
return builder.to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/String.h>
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public:
|
||||||
Display() = default;
|
Display() = default;
|
||||||
~Display() = default;
|
~Display() = default;
|
||||||
|
|
||||||
DeprecatedString to_deprecated_string() const;
|
ErrorOr<String> to_string() const;
|
||||||
|
|
||||||
bool operator==(Display const& other) const
|
bool operator==(Display const& other) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -318,7 +318,7 @@ JS::GCPtr<Layout::Node> Element::create_layout_node_for_display_type(DOM::Docume
|
||||||
return document.heap().allocate_without_realm<Layout::InlineNode>(document, element, move(style));
|
return document.heap().allocate_without_realm<Layout::InlineNode>(document, element, move(style));
|
||||||
if (display.is_flex_inside())
|
if (display.is_flex_inside())
|
||||||
return document.heap().allocate_without_realm<Layout::Box>(document, element, move(style));
|
return document.heap().allocate_without_realm<Layout::Box>(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<Layout::InlineNode>(document, element, move(style));
|
return document.heap().allocate_without_realm<Layout::InlineNode>(document, element, move(style));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ OwnPtr<FormattingContext> FormattingContext::create_independent_formatting_conte
|
||||||
// The child box is a block container that doesn't create its own BFC.
|
// The child box is a block container that doesn't create its own BFC.
|
||||||
// It will be formatted by this BFC.
|
// It will be formatted by this BFC.
|
||||||
if (!child_display.is_flow_inside()) {
|
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.
|
// 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
|
// 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.
|
// table-related boxes that don't get fixed up by CSS anonymous table box generation.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue