mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 03:08:13 +00:00
LibWeb: Add list-style-type: lower-alpha and lower-latin support
They achieve the same, a list which markers are lowercase (latin) characters.
This commit is contained in:
parent
7dd0fb0086
commit
cb34775c83
4 changed files with 15 additions and 0 deletions
|
@ -5,11 +5,14 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <LibWeb/Layout/ListItemMarkerBox.h>
|
||||
|
||||
namespace Web::Layout {
|
||||
|
||||
constexpr auto lower_alpha = "abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
ListItemMarkerBox::ListItemMarkerBox(DOM::Document& document, CSS::ListStyleType style_type, size_t index)
|
||||
: Box(document, nullptr, CSS::StyleProperties::create())
|
||||
, m_list_style_type(style_type)
|
||||
|
@ -74,6 +77,10 @@ void ListItemMarkerBox::paint(PaintContext& context, PaintPhase phase)
|
|||
m_index < 10 ? String::formatted("0{}.", m_index) : String::formatted("{}.", m_index),
|
||||
Gfx::TextAlignment::Center);
|
||||
break;
|
||||
case CSS::ListStyleType::LowerAlpha:
|
||||
case CSS::ListStyleType::LowerLatin:
|
||||
context.painter().draw_text(enclosing, number_to_alphabet(m_index, lower_alpha), Gfx::TextAlignment::Center);
|
||||
break;
|
||||
case CSS::ListStyleType::None:
|
||||
return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue