mirror of
https://github.com/Kozea/WeasyPrint.git
synced 2024-10-04 07:57:52 +03:00
Copy boxes when using them in stacking contexts
If we don’t copy the boxes, rendering pages twice will fail because creating stacking contexts can change the boxes’ children. Fix #1473.
This commit is contained in:
parent
58c9dbc231
commit
aafb119e29
@ -975,3 +975,12 @@ def test_http():
|
||||
assert HTML(root_url + '/deflate').etree_element.get('test') == 'ok'
|
||||
assert HTML(
|
||||
root_url + '/raw-deflate').etree_element.get('test') == 'ok'
|
||||
|
||||
|
||||
@assert_no_logs
|
||||
def test_page_copy_relative():
|
||||
# Regression test for https://github.com/Kozea/WeasyPrint/issues/1473
|
||||
document = FakeHTML(string='<div style="position: relative">a').render()
|
||||
duplicated_pages = document.copy([*document.pages, *document.pages])
|
||||
pngs = duplicated_pages.write_png(split_images=True)
|
||||
assert pngs[0] == pngs[1]
|
||||
|
@ -136,7 +136,7 @@ class StackingContext:
|
||||
result = dispatch(child)
|
||||
if result is not None:
|
||||
new_children.append(result)
|
||||
box.children = new_children
|
||||
box = box.copy_with_children(new_children)
|
||||
return box
|
||||
|
||||
box = dispatch_children(box)
|
||||
|
Loading…
Reference in New Issue
Block a user