mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +00:00
LibWeb: Add CSS::Display enum and StyleProperties::display()
The display property is not interesting after we've built the layout tree, so we don't have to move it into LayoutStyle.
This commit is contained in:
@@ -244,4 +244,29 @@ CSS::TextAlign StyleProperties::text_align() const
|
||||
return CSS::TextAlign::Left;
|
||||
}
|
||||
|
||||
CSS::Display StyleProperties::display() const
|
||||
{
|
||||
auto display = string_or_fallback(CSS::PropertyID::Display, "inline");
|
||||
if (display == "none")
|
||||
return CSS::Display::None;
|
||||
if (display == "block")
|
||||
return CSS::Display::Block;
|
||||
if (display == "inline")
|
||||
return CSS::Display::Inline;
|
||||
if (display == "inline-block")
|
||||
return CSS::Display::InlineBlock;
|
||||
if (display == "list-item")
|
||||
return CSS::Display::ListItem;
|
||||
if (display == "table")
|
||||
return CSS::Display::Table;
|
||||
if (display == "table-row")
|
||||
return CSS::Display::TableRow;
|
||||
if (display == "table-cell")
|
||||
return CSS::Display::TableCell;
|
||||
if (display == "table-row-group")
|
||||
return CSS::Display::TableRowGroup;
|
||||
dbg() << "Unknown display type: _" << display << "_";
|
||||
return CSS::Display::Block;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user