diff options
author | Andreas Kling <kling@serenityos.org> | 2020-06-26 15:08:42 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-26 18:27:12 +0200 |
commit | 62daa6f73c817044b254176a0af314a6a0e68ccd (patch) | |
tree | 046390e53e4763b777850581578e6da4ba7c0563 /Libraries/LibWeb/CSS/StyleProperties.cpp | |
parent | 53f1090b861cef6996ac8e54139c0fe64477d784 (diff) | |
download | serenity-62daa6f73c817044b254176a0af314a6a0e68ccd.zip |
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.
Diffstat (limited to 'Libraries/LibWeb/CSS/StyleProperties.cpp')
-rw-r--r-- | Libraries/LibWeb/CSS/StyleProperties.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Libraries/LibWeb/CSS/StyleProperties.cpp b/Libraries/LibWeb/CSS/StyleProperties.cpp index 4b57e0928f..d241ac2dae 100644 --- a/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -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"); |