1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:37:35 +00:00

LibWeb: Add roman numerals as a list-style for ol's

This patch adds support for the identifiers upper-roman and lower-roman
of the list-style property.
This commit is contained in:
Tobias Christiansen 2021-07-04 17:17:23 +02:00 committed by Andreas Kling
parent 87033ce7d1
commit e18e2af826
4 changed files with 17 additions and 0 deletions

View file

@ -36,6 +36,12 @@ ListItemMarkerBox::ListItemMarkerBox(DOM::Document& document, CSS::ListStyleType
case CSS::ListStyleType::UpperLatin:
m_text = String::bijective_base_from(m_index - 1);
break;
case CSS::ListStyleType::LowerRoman:
m_text = String::roman_number_from(m_index).to_lowercase();
break;
case CSS::ListStyleType::UpperRoman:
m_text = String::roman_number_from(m_index);
break;
case CSS::ListStyleType::None:
break;
@ -88,8 +94,10 @@ void ListItemMarkerBox::paint(PaintContext& context, PaintPhase phase)
case CSS::ListStyleType::DecimalLeadingZero:
case CSS::ListStyleType::LowerAlpha:
case CSS::ListStyleType::LowerLatin:
case CSS::ListStyleType::LowerRoman:
case CSS::ListStyleType::UpperAlpha:
case CSS::ListStyleType::UpperLatin:
case CSS::ListStyleType::UpperRoman:
if (m_text.is_null())
break;
context.painter().draw_text(enclosing, m_text, Gfx::TextAlignment::Center);