mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:37:35 +00:00
LibWeb: Naively implement the CSS clear property
This is definitely not fully-featured, but basically we now handle the clear property by forcing the cleared box below the bottom-most floated box on the relevant side.
This commit is contained in:
parent
26a9ab7cd5
commit
af757a1659
8 changed files with 120 additions and 0 deletions
|
@ -303,6 +303,23 @@ Optional<CSS::Float> StyleProperties::float_() const
|
|||
return {};
|
||||
}
|
||||
|
||||
Optional<CSS::Clear> StyleProperties::clear() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::Clear);
|
||||
if (!value.has_value() || !value.value()->is_string())
|
||||
return {};
|
||||
auto string = value.value()->to_string();
|
||||
if (string == "none")
|
||||
return CSS::Clear::None;
|
||||
if (string == "left")
|
||||
return CSS::Clear::Left;
|
||||
if (string == "right")
|
||||
return CSS::Clear::Right;
|
||||
if (string == "both")
|
||||
return CSS::Clear::Both;
|
||||
return {};
|
||||
}
|
||||
|
||||
CSS::Display StyleProperties::display() const
|
||||
{
|
||||
auto display = string_or_fallback(CSS::PropertyID::Display, "inline");
|
||||
|
|
|
@ -63,6 +63,7 @@ public:
|
|||
CSS::TextAlign text_align() const;
|
||||
CSS::Display display() const;
|
||||
Optional<CSS::Float> float_() const;
|
||||
Optional<CSS::Clear> clear() const;
|
||||
Optional<CSS::WhiteSpace> white_space() const;
|
||||
Optional<CSS::LineStyle> line_style(CSS::PropertyID) const;
|
||||
|
||||
|
|
|
@ -149,6 +149,13 @@ enum class Float {
|
|||
Right,
|
||||
};
|
||||
|
||||
enum class Clear {
|
||||
None,
|
||||
Left,
|
||||
Right,
|
||||
Both,
|
||||
};
|
||||
|
||||
enum class LineStyle {
|
||||
None,
|
||||
Hidden,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue