mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03: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
Notes:
sideshowbarker
2024-07-18 10:27:18 +09:00
Author: https://github.com/TobyAsE Commit: https://github.com/SerenityOS/serenity/commit/e18e2af826d Pull-request: https://github.com/SerenityOS/serenity/pull/8434 Reviewed-by: https://github.com/MaxWipfli ✅
@ -107,6 +107,7 @@
|
||||
"lowercase",
|
||||
"lower-alpha",
|
||||
"lower-latin",
|
||||
"lower-roman",
|
||||
"medium",
|
||||
"move",
|
||||
"ne-resize",
|
||||
@ -163,6 +164,7 @@
|
||||
"uppercase",
|
||||
"upper-alpha",
|
||||
"upper-latin",
|
||||
"upper-roman",
|
||||
"visible",
|
||||
"vertical-text",
|
||||
"wait",
|
||||
|
@ -645,6 +645,10 @@ Optional<CSS::ListStyleType> StyleProperties::list_style_type() const
|
||||
return CSS::ListStyleType::UpperAlpha;
|
||||
case CSS::ValueID::UpperLatin:
|
||||
return CSS::ListStyleType::UpperLatin;
|
||||
case CSS::ValueID::UpperRoman:
|
||||
return CSS::ListStyleType::UpperRoman;
|
||||
case CSS::ValueID::LowerRoman:
|
||||
return CSS::ListStyleType::LowerRoman;
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, Tobias Christiansen <tobi@tobyase.de>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@ -173,8 +174,10 @@ enum class ListStyleType {
|
||||
DecimalLeadingZero,
|
||||
LowerAlpha,
|
||||
LowerLatin,
|
||||
LowerRoman,
|
||||
UpperAlpha,
|
||||
UpperLatin,
|
||||
UpperRoman,
|
||||
};
|
||||
|
||||
enum class Overflow : u8 {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user