1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:37:35 +00:00

LibWeb: Remove special handling of disclosure-open/closed markers

Setting the marker's content width here is causing the text that follows
the marker to be indented a bit too much. This is noticeable when a line
with a disclosure marker is followed by a line with any other marker. It
previously would look something like:

    >    Text inline with disclosure-closed marker
    * Text inline with circle marker
    # Text inline with square marker

Now the disclosure marker line matches other marker types:

    > Text inline with disclosure-closed marker
    * Text inline with circle marker
    # Text inline with square marker
This commit is contained in:
Timothy Flynn 2023-11-21 16:39:10 -05:00 committed by Andreas Kling
parent 16ac2089e3
commit b5162ceabd
3 changed files with 10 additions and 13 deletions

View file

@ -3,12 +3,12 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <body> at (8,8) content-size 784x17.46875 children: not-inline
BlockContainer <(anonymous)> at (8,8) content-size 784x0 children: inline
InlineNode <details>
ListItemBox <summary> at (37,8) content-size 755x17.46875 children: inline
ListItemBox <summary> at (32,8) content-size 760x17.46875 children: inline
line 0 width: 114.625, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 13, rect: [37,8 114.625x17.46875]
frag 0 from TextNode start: 0, length: 13, rect: [32,8 114.625x17.46875]
"I'm a summary"
TextNode <#text>
ListItemMarkerBox <(anonymous)> at (8,8.234375) content-size 17x17 children: not-inline
ListItemMarkerBox <(anonymous)> at (8,8.234375) content-size 12x17 children: not-inline
BlockContainer <(anonymous)> at (8,25.46875) content-size 784x0 children: inline
TextNode <#text>
@ -17,7 +17,7 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x17.46875]
PaintableWithLines (BlockContainer(anonymous)) [8,8 784x0]
InlinePaintable (InlineNode<DETAILS>)
PaintableWithLines (ListItemBox<SUMMARY>) [37,8 755x17.46875]
PaintableWithLines (ListItemBox<SUMMARY>) [32,8 760x17.46875]
TextPaintable (TextNode<#text>)
MarkerPaintable (ListItemMarkerBox(anonymous)) [8,8.234375 17x17]
MarkerPaintable (ListItemMarkerBox(anonymous)) [8,8.234375 12x17]
PaintableWithLines (BlockContainer(anonymous)) [8,25.46875 784x0]

View file

@ -3,12 +3,12 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <body> at (8,8) content-size 784x34.9375 children: not-inline
BlockContainer <(anonymous)> at (8,8) content-size 784x0 children: inline
InlineNode <details>
ListItemBox <summary> at (37,8) content-size 755x17.46875 children: inline
ListItemBox <summary> at (32,8) content-size 760x17.46875 children: inline
line 0 width: 114.625, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 13, rect: [37,8 114.625x17.46875]
frag 0 from TextNode start: 0, length: 13, rect: [32,8 114.625x17.46875]
"I'm a summary"
TextNode <#text>
ListItemMarkerBox <(anonymous)> at (8,8.234375) content-size 17x17 children: not-inline
ListItemMarkerBox <(anonymous)> at (8,8.234375) content-size 12x17 children: not-inline
BlockContainer <slot> at (8,25.46875) content-size 784x17.46875 children: inline
line 0 width: 82.3125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 10, rect: [8,25.46875 82.3125x17.46875]
@ -26,9 +26,9 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x34.9375]
PaintableWithLines (BlockContainer(anonymous)) [8,8 784x0]
InlinePaintable (InlineNode<DETAILS>)
PaintableWithLines (ListItemBox<SUMMARY>) [37,8 755x17.46875]
PaintableWithLines (ListItemBox<SUMMARY>) [32,8 760x17.46875]
TextPaintable (TextNode<#text>)
MarkerPaintable (ListItemMarkerBox(anonymous)) [8,8.234375 17x17]
MarkerPaintable (ListItemMarkerBox(anonymous)) [8,8.234375 12x17]
PaintableWithLines (BlockContainer<SLOT>) [8,25.46875 784x17.46875]
InlinePaintable (InlineNode<SPAN>)
TextPaintable (TextNode<#text>)

View file

@ -1105,9 +1105,6 @@ void BlockFormattingContext::layout_list_item_marker(ListItemBox const& list_ite
marker_state.set_content_height(max(image_height, marker.font().pixel_size_rounded_up() + 1));
if (marker.list_style_type() == CSS::ListStyleType::DisclosureClosed || marker.list_style_type() == CSS::ListStyleType::DisclosureOpen)
marker_state.set_content_width(marker_state.content_height());
auto final_marker_width = marker_state.content_width() + default_marker_width;
if (marker.list_style_position() == CSS::ListStylePosition::Inside) {