Skip to content

Commit

Permalink
Layout positioned boxes in page margins
Browse files Browse the repository at this point in the history
Fix #1540.
  • Loading branch information
liZe committed Jan 24, 2022
1 parent cd8a463 commit 0ae65b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion tests/layout/test_page.py
Expand Up @@ -1362,7 +1362,6 @@ def test_running_img():
''')


@pytest.mark.xfail
@assert_no_logs
def test_running_absolute():
# Test regression: https://github.com/Kozea/WeasyPrint/issues/1540
Expand Down
9 changes: 7 additions & 2 deletions weasyprint/layout/page.py
Expand Up @@ -433,11 +433,16 @@ def make_box(at_keyword, containing_block):

def margin_box_content_layout(context, page, box):
"""Layout a margin box’s content once the box has dimensions."""
positioned_boxes = []
box, resume_at, next_page, _, _ = block_container_layout(
context, box, bottom_space=-float('inf'), skip_stack=None,
page_is_empty=True, absolute_boxes=[], fixed_boxes=[],
adjoining_margins=None, discard=False)
page_is_empty=True, absolute_boxes=positioned_boxes,
fixed_boxes=positioned_boxes, adjoining_margins=None, discard=False)
assert resume_at is None
for absolute_box in positioned_boxes:
absolute_layout(
context, absolute_box, box, positioned_boxes, bottom_space=0,
skip_stack=None)

vertical_align = box.style['vertical_align']
# Every other value is read as 'top', ie. no change.
Expand Down

0 comments on commit 0ae65b8

Please sign in to comment.