1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:27:45 +00:00

LibWeb: Use CSS::ValueID for 'text-align' values

Let's start moving away from using raw strings for CSS identifiers.
The idea here is to use IdentifierStyleValue with a CSS::ValueID inside
for all CSS identifier values.
This commit is contained in:
Andreas Kling 2020-12-14 18:38:02 +01:00
parent 08517daa5a
commit 3247ea3581
5 changed files with 32 additions and 11 deletions

View file

@ -37,6 +37,7 @@ public:
static CSS::Float float_() { return CSS::Float::None; }
static CSS::Clear clear() { return CSS::Clear::None; }
static CSS::WhiteSpace white_space() { return CSS::WhiteSpace::Normal; }
static CSS::TextAlign text_align() { return CSS::TextAlign::Left; }
};
struct BorderData {
@ -74,7 +75,7 @@ protected:
CSS::Float m_float { InitialValues::float_() };
CSS::Clear m_clear { InitialValues::clear() };
Optional<int> m_z_index;
CSS::TextAlign m_text_align;
CSS::TextAlign m_text_align { InitialValues::text_align() };
CSS::Position m_position;
CSS::WhiteSpace m_white_space { InitialValues::white_space() };
CSS::Length m_width;

View file

@ -220,7 +220,10 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& specified_style)
auto& style = static_cast<MutableLayoutStyle&>(m_style);
style.set_position(specified_style.position());
style.set_text_align(specified_style.text_align());
auto text_align = specified_style.text_align();
if (text_align.has_value())
style.set_text_align(text_align.value());
auto white_space = specified_style.white_space();
if (white_space.has_value())