Skip to content

Commit

Permalink
Display at least one grid row on empty pages
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed May 4, 2024
1 parent 6dd6470 commit c10c689
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions weasyprint/layout/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -1063,17 +1063,18 @@ def grid_layout(context, box, bottom_space, skip_stack, containing_block,
skip_height = 0
resume_at = None
for i, row_y in enumerate(rows_positions[skip_row:], start=skip_row):
# TODO: Check that page is not empty.
if context.overflows_page(bottom_space, row_y - skip_height):
if i == 0:
return None, None, {'break': 'any', 'page': None}, [], False
resume_row = i - 1
resume_at = {i-1: None}
for child in children:
_, y, _, _ = children_positions[child]
if skip_row <= y <= i-2:
this_page_children.append(child)
break
if not page_is_empty:
if i == 0:
return None, None, {'break': 'any', 'page': None}, [], False
resume_row = i - 1
resume_at = {i-1: None}
for child in children:
_, y, _, _ = children_positions[child]
if skip_row <= y <= i-2:
this_page_children.append(child)
break
page_is_empty = False
else:
for child in children:
_, y, _, _ = children_positions[child]
Expand Down

0 comments on commit c10c689

Please sign in to comment.