diff options
author | MacDue <macdue@dueutil.tech> | 2022-07-07 01:40:05 +0100 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2022-07-09 09:28:31 +0100 |
commit | 61a703816cdae1569ef66b146fe8045832ec9c63 (patch) | |
tree | a1124665349f9aa5d9e8343dd04562453bd0320b /Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp | |
parent | 69218b92a51a0852736fc3b1253605fe2c020053 (diff) | |
download | serenity-61a703816cdae1569ef66b146fe8045832ec9c63.zip |
LibWeb: Base marker size on font height rather than line height
This fixes the oversized markers on GitHub
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index 003818d4c1..f4438f089c 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -767,16 +767,21 @@ void BlockFormattingContext::layout_list_item_marker(ListItemBox const& list_ite image_height = list_style_image->rect().height(); } + int default_marker_width = max(4, marker.font().glyph_height() - 4); + if (marker.text().is_empty()) { - marker_state.content_width = image_width + 4; + marker_state.content_width = image_width + default_marker_width; } else { auto text_width = marker.font().width(marker.text()); marker_state.content_width = image_width + text_width; } - marker_state.content_height = max(image_height, marker.line_height()); + marker_state.content_height = max(image_height, marker.font().glyph_height() + 1); - marker_state.offset = { -(marker_state.content_width + 4), 0 }; + marker_state.offset = { + -(marker_state.content_width + default_marker_width), + max(0.f, (marker.line_height() - marker_state.content_height) / 2.f) + }; if (marker_state.content_height > list_item_state.content_height) list_item_state.content_height = marker_state.content_height; |