Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: incorrect position of the text of the list markers
  • Loading branch information
tordex committed Jun 25, 2025
commit 09d37f7d803314273ec6aac1d3e04439ae3313d1
2 changes: 1 addition & 1 deletion include/litehtml/html_tag.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ namespace litehtml
string dump_get_name() override;

protected:
void draw_list_marker( uint_ptr hdc, const position &pos );
void draw_list_marker( uint_ptr hdc, const position &pos, const std::shared_ptr<render_item> &ri );
string get_list_marker_text(int index);
element::ptr get_element_before(const style& style, bool create);
element::ptr get_element_after(const style& style, bool create);
Expand Down
11 changes: 6 additions & 5 deletions src/html_tag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ void litehtml::html_tag::draw(uint_ptr hdc, int x, int y, const position *clip,
get_document()->container()->set_clip(pos, bdr_radius);
}

draw_list_marker(hdc, pos);
draw_list_marker(hdc, pos, ri);

if(m_css.get_overflow() > overflow_visible)
{
Expand Down Expand Up @@ -1047,7 +1047,7 @@ bool litehtml::html_tag::is_replaced() const
return false;
}

void litehtml::html_tag::draw_list_marker( uint_ptr hdc, const position& pos )
void litehtml::html_tag::draw_list_marker( uint_ptr hdc, const position& pos, const std::shared_ptr<render_item> &ri )
{
list_marker lm;

Expand All @@ -1072,8 +1072,10 @@ void litehtml::html_tag::draw_list_marker( uint_ptr hdc, const position& pos )

if (css().get_list_style_type() >= list_style_type_armenian)
{
lm.pos.y = pos.y;
lm.pos.height = pos.height;
auto li_baseline = pos.y + ri->get_first_baseline() - ri->content_offset_top();
lm.pos.y = li_baseline - css().get_font_metrics().ascent;
lm.pos.height = css().get_font_metrics().height;

lm.index = atoi(get_attr("list_index", "0"));
}
else
Expand Down Expand Up @@ -1121,7 +1123,6 @@ void litehtml::html_tag::draw_list_marker( uint_ptr hdc, const position& pos )
if (m_css.get_list_style_type() >= list_style_type_armenian)
{
auto marker_text = get_list_marker_text(lm.index);
lm.pos.height = ln_height;
if (marker_text.empty())
{
get_document()->container()->draw_list_marker(hdc, lm);
Expand Down