Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
19 changes: 19 additions & 0 deletions tests/layout/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,22 @@ def test_lists_page_break_margin():
assert (
li.children[0].position_y ==
li.children[1].children[0].position_y)


def test_lists_marker_content():
# Regression test for #2918.
page, = render_pages('''
<style>
::marker { content: 'a' }
</style>
<ul>
<li>b</li>
</ul>
''')
html, = page.children
body, = html.children
ul, = body.children
li, = ul.children
marker, li = li.children
assert marker.children[0].children[0].text == 'a'
assert li.children[0].children[0].text == 'b'
2 changes: 2 additions & 0 deletions tests/resources/tests_ua.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ h4 { bookmark-level: 4; bookmark-label: content(text) }
h5 { bookmark-level: 5; bookmark-label: content(text) }
h6 { bookmark-level: 6; bookmark-label: content(text) }

::marker { white-space: pre }

::footnote-call { content: counter(footnote) }
::footnote-marker { content: counter(footnote) '.' }
::note-call { content: counter(note) }
Expand Down
2 changes: 1 addition & 1 deletion weasyprint/formatting_structure/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ def marker_to_box(element, state, parent_style, style_for, get_image_from_uri,
counter_type = style['list_style_type']
if marker_text := counter_style.render_marker(counter_type, counter_value):
box = boxes.TextBox.anonymous_from(box, marker_text)
box.style['white_space'] = 'pre-wrap'
children.append(box)

if not children:
Expand All @@ -376,6 +375,7 @@ def marker_to_box(element, state, parent_style, style_for, get_image_from_uri,
marker_box = boxes.BlockBox.anonymous_from(box, children)
# We can safely edit everything that can't be changed by user style
# See https://drafts.csswg.org/css-pseudo-4/#marker-pseudo
marker_box.style = marker_box.style.copy()
marker_box.style['position'] = 'absolute'
marker_box.is_outside_marker = True
else:
Expand Down
Loading