mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:27:45 +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:
parent
87033ce7d1
commit
e18e2af826
4 changed files with 17 additions and 0 deletions
|
@ -107,6 +107,7 @@
|
||||||
"lowercase",
|
"lowercase",
|
||||||
"lower-alpha",
|
"lower-alpha",
|
||||||
"lower-latin",
|
"lower-latin",
|
||||||
|
"lower-roman",
|
||||||
"medium",
|
"medium",
|
||||||
"move",
|
"move",
|
||||||
"ne-resize",
|
"ne-resize",
|
||||||
|
@ -163,6 +164,7 @@
|
||||||
"uppercase",
|
"uppercase",
|
||||||
"upper-alpha",
|
"upper-alpha",
|
||||||
"upper-latin",
|
"upper-latin",
|
||||||
|
"upper-roman",
|
||||||
"visible",
|
"visible",
|
||||||
"vertical-text",
|
"vertical-text",
|
||||||
"wait",
|
"wait",
|
||||||
|
|
|
@ -645,6 +645,10 @@ Optional<CSS::ListStyleType> StyleProperties::list_style_type() const
|
||||||
return CSS::ListStyleType::UpperAlpha;
|
return CSS::ListStyleType::UpperAlpha;
|
||||||
case CSS::ValueID::UpperLatin:
|
case CSS::ValueID::UpperLatin:
|
||||||
return CSS::ListStyleType::UpperLatin;
|
return CSS::ListStyleType::UpperLatin;
|
||||||
|
case CSS::ValueID::UpperRoman:
|
||||||
|
return CSS::ListStyleType::UpperRoman;
|
||||||
|
case CSS::ValueID::LowerRoman:
|
||||||
|
return CSS::ListStyleType::LowerRoman;
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2021, Tobias Christiansen <tobi@tobyase.de>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -173,8 +174,10 @@ enum class ListStyleType {
|
||||||
DecimalLeadingZero,
|
DecimalLeadingZero,
|
||||||
LowerAlpha,
|
LowerAlpha,
|
||||||
LowerLatin,
|
LowerLatin,
|
||||||
|
LowerRoman,
|
||||||
UpperAlpha,
|
UpperAlpha,
|
||||||
UpperLatin,
|
UpperLatin,
|
||||||
|
UpperRoman,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class Overflow : u8 {
|
enum class Overflow : u8 {
|
||||||
|
|
|
@ -36,6 +36,12 @@ ListItemMarkerBox::ListItemMarkerBox(DOM::Document& document, CSS::ListStyleType
|
||||||
case CSS::ListStyleType::UpperLatin:
|
case CSS::ListStyleType::UpperLatin:
|
||||||
m_text = String::bijective_base_from(m_index - 1);
|
m_text = String::bijective_base_from(m_index - 1);
|
||||||
break;
|
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:
|
case CSS::ListStyleType::None:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -88,8 +94,10 @@ void ListItemMarkerBox::paint(PaintContext& context, PaintPhase phase)
|
||||||
case CSS::ListStyleType::DecimalLeadingZero:
|
case CSS::ListStyleType::DecimalLeadingZero:
|
||||||
case CSS::ListStyleType::LowerAlpha:
|
case CSS::ListStyleType::LowerAlpha:
|
||||||
case CSS::ListStyleType::LowerLatin:
|
case CSS::ListStyleType::LowerLatin:
|
||||||
|
case CSS::ListStyleType::LowerRoman:
|
||||||
case CSS::ListStyleType::UpperAlpha:
|
case CSS::ListStyleType::UpperAlpha:
|
||||||
case CSS::ListStyleType::UpperLatin:
|
case CSS::ListStyleType::UpperLatin:
|
||||||
|
case CSS::ListStyleType::UpperRoman:
|
||||||
if (m_text.is_null())
|
if (m_text.is_null())
|
||||||
break;
|
break;
|
||||||
context.painter().draw_text(enclosing, m_text, Gfx::TextAlignment::Center);
|
context.painter().draw_text(enclosing, m_text, Gfx::TextAlignment::Center);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue