mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 01:59:31 +00:00
LibWeb: Fix inside list style overriding content offset
Previously, if a horizontal margin was set on a list-item and it was list-style-position: inside, it would effectively remove that margin.
This commit is contained in:
parent
b272bb3373
commit
60fd406903
Notes:
github-actions[bot]
2025-03-27 23:11:11 +00:00
Author: https://github.com/CanadaHonk
Commit: 60fd406903
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4130
Reviewed-by: https://github.com/gmta ✅
3 changed files with 25 additions and 1 deletions
|
@ -1233,7 +1233,7 @@ void BlockFormattingContext::layout_list_item_marker(ListItemBox const& list_ite
|
|||
auto final_marker_width = marker_state.content_width() + default_marker_width;
|
||||
|
||||
if (marker.list_style_position() == CSS::ListStylePosition::Inside) {
|
||||
list_item_state.set_content_offset({ final_marker_width, list_item_state.offset.y() });
|
||||
list_item_state.set_content_x(list_item_state.offset.x() + final_marker_width);
|
||||
list_item_state.set_content_width(list_item_state.content_width() - final_marker_width);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x417 [BFC] children: not-inline
|
||||
BlockContainer <body> at (8,200) content-size 784x17 children: not-inline
|
||||
ListItemBox <span> at (232,200) content-size 360x17 children: not-inline
|
||||
ListItemMarkerBox <(anonymous)> at (208,200) content-size 12x17 children: not-inline
|
||||
BlockContainer <(anonymous)> at (8,400) content-size 784x0 children: inline
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x417]
|
||||
PaintableWithLines (BlockContainer<BODY>) [8,200 784x17]
|
||||
PaintableWithLines (ListItemBox<SPAN>) [232,200 360x17] overflow: [208,200 384x17]
|
||||
MarkerPaintable (ListItemMarkerBox(anonymous)) [208,200 12x17]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [8,400 784x0]
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
span {
|
||||
display: list-item;
|
||||
list-style-position: inside;
|
||||
|
||||
margin: 200px;
|
||||
}
|
||||
</style>
|
||||
<span></span>
|
Loading…
Add table
Add a link
Reference in a new issue