1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 14:05:08 +00:00

LibWeb: Cache the used CSS text-align property on LayoutNodeWithStyle

This commit is contained in:
Andreas Kling 2020-06-23 23:28:40 +02:00
parent ae181e1573
commit f4ecb5362f
6 changed files with 28 additions and 16 deletions

View file

@ -229,19 +229,19 @@ bool StyleProperties::operator==(const StyleProperties& other) const
return true;
}
CSS::ValueID StyleProperties::text_align() const
CSS::TextAlign StyleProperties::text_align() const
{
auto string = string_or_fallback(CSS::PropertyID::TextAlign, "left");
if (string == "center")
return CSS::ValueID::Center;
return CSS::TextAlign::Center;
if (string == "right")
return CSS::ValueID::Right;
return CSS::TextAlign::Right;
if (string == "justify")
return CSS::ValueID::Justify;
return CSS::TextAlign::Justify;
if (string == "-libweb-center")
return CSS::ValueID::VendorSpecificCenter;
return CSS::TextAlign::VendorSpecificCenter;
// Otherwise, just assume "left"..
return CSS::ValueID::Left;
return CSS::TextAlign::Left;
}
}