mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
LibWeb: Base marker size on font height rather than line height
This fixes the oversized markers on GitHub
This commit is contained in:
parent
69218b92a5
commit
61a703816c
Notes:
sideshowbarker
2024-07-17 09:34:26 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/61a703816c Pull-request: https://github.com/SerenityOS/serenity/pull/14505
1 changed files with 8 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue