1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:47:45 +00:00

LibWeb: Add the 'float' CSS property to LayoutStyle

Note that we don't use the property for anything yet, as I'm still
wrapping my head around how to implement floats.
This commit is contained in:
Andreas Kling 2020-06-26 15:08:42 +02:00
parent 53f1090b86
commit 62daa6f73c
6 changed files with 38 additions and 0 deletions

View file

@ -263,6 +263,21 @@ Optional<CSS::WhiteSpace> StyleProperties::white_space() const
return {};
}
Optional<CSS::Float> StyleProperties::float_() const
{
auto value = property(CSS::PropertyID::Float);
if (!value.has_value() || !value.value()->is_string())
return {};
auto string = value.value()->to_string();
if (string == "none")
return CSS::Float::None;
if (string == "left")
return CSS::Float::Left;
if (string == "right")
return CSS::Float::Right;
return {};
}
CSS::Display StyleProperties::display() const
{
auto display = string_or_fallback(CSS::PropertyID::Display, "inline");

View file

@ -62,6 +62,7 @@ public:
Color color_or_fallback(CSS::PropertyID, const Document&, Color fallback) const;
CSS::TextAlign text_align() const;
CSS::Display display() const;
Optional<CSS::Float> float_() const;
Optional<CSS::WhiteSpace> white_space() const;
const Gfx::Font& font() const

View file

@ -143,6 +143,12 @@ enum class WhiteSpace {
PreWrap,
};
enum class Float {
None,
Left,
Right,
};
}
class StyleValue : public RefCounted<StyleValue> {