mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-14 10:20:36 +00:00
LibWeb: Serialize Display values as a "short display" where possible
This commit is contained in:
parent
b78b5e6297
commit
088cddaca1
Notes:
sideshowbarker
2024-07-16 22:22:13 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/088cddaca1 Pull-request: https://github.com/SerenityOS/serenity/pull/20990
1 changed files with 29 additions and 0 deletions
|
@ -13,6 +13,35 @@ String Display::to_string() const
|
|||
StringBuilder builder;
|
||||
switch (m_type) {
|
||||
case Type::OutsideAndInside:
|
||||
// NOTE: Following the precedence rules of “most backwards-compatible, then shortest”,
|
||||
// serialization of equivalent display values uses the “Short display” column.
|
||||
if (*this == Display::from_short(Display::Short::Block))
|
||||
return "block"_string;
|
||||
if (*this == Display::from_short(Display::Short::FlowRoot))
|
||||
return "flow-root"_string;
|
||||
if (*this == Display::from_short(Display::Short::Inline))
|
||||
return "inline"_string;
|
||||
if (*this == Display::from_short(Display::Short::InlineBlock))
|
||||
return "inline-block"_string;
|
||||
if (*this == Display::from_short(Display::Short::RunIn))
|
||||
return "run-in"_string;
|
||||
if (*this == Display::from_short(Display::Short::ListItem))
|
||||
return "list-item"_string;
|
||||
if (*this == Display::from_short(Display::Short::Flex))
|
||||
return "flex"_string;
|
||||
if (*this == Display::from_short(Display::Short::InlineFlex))
|
||||
return "inline-flex"_string;
|
||||
if (*this == Display::from_short(Display::Short::Grid))
|
||||
return "grid"_string;
|
||||
if (*this == Display::from_short(Display::Short::InlineGrid))
|
||||
return "inline-grid"_string;
|
||||
if (*this == Display::from_short(Display::Short::Ruby))
|
||||
return "ruby"_string;
|
||||
if (*this == Display::from_short(Display::Short::Table))
|
||||
return "table"_string;
|
||||
if (*this == Display::from_short(Display::Short::InlineTable))
|
||||
return "inline-table"_string;
|
||||
|
||||
switch (m_value.outside_inside.outside) {
|
||||
case Outside::Block:
|
||||
builder.append("block"sv);
|
||||
|
|
Loading…
Reference in a new issue