mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 14:47:35 +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:
parent
5d86305a72
commit
bc178ee743
8 changed files with 55 additions and 23 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
String string_or_fallback(CSS::PropertyID, const StringView& fallback) const;
|
||||
Color color_or_fallback(CSS::PropertyID, const Document&, Color fallback) const;
|
||||
CSS::TextAlign text_align() const;
|
||||
CSS::Display display() const;
|
||||
|
||||
const Gfx::Font& font() const
|
||||
{
|
||||
|
|
|
@ -123,6 +123,18 @@ enum class TextAlign {
|
|||
VendorSpecificCenter,
|
||||
};
|
||||
|
||||
enum class Display {
|
||||
None,
|
||||
Block,
|
||||
Inline,
|
||||
InlineBlock,
|
||||
ListItem,
|
||||
Table,
|
||||
TableRow,
|
||||
TableCell,
|
||||
TableRowGroup,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
class StyleValue : public RefCounted<StyleValue> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue