mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
LibWeb: Implement <center> as -libweb-center
To get the expected behavior for <center>, we needed a special text alignment mode that centers block-level elements (and not just line box fragments.)
This commit is contained in:
parent
6de937a689
commit
784ed004e6
6 changed files with 26 additions and 14 deletions
|
@ -216,4 +216,19 @@ bool StyleProperties::operator==(const StyleProperties& other) const
|
|||
return true;
|
||||
}
|
||||
|
||||
CSS::ValueID StyleProperties::text_align() const
|
||||
{
|
||||
auto string = string_or_fallback(CSS::PropertyID::TextAlign, "left");
|
||||
if (string == "center")
|
||||
return CSS::ValueID::Center;
|
||||
if (string == "right")
|
||||
return CSS::ValueID::Right;
|
||||
if (string == "justify")
|
||||
return CSS::ValueID::Justify;
|
||||
if (string == "-libweb-center")
|
||||
return CSS::ValueID::VendorSpecificCenter;
|
||||
// Otherwise, just assume "left"..
|
||||
return CSS::ValueID::Left;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue