Skip to content

Commit c10c689

Browse files
committed
Display at least one grid row on empty pages
1 parent 6dd6470 commit c10c689

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

weasyprint/layout/grid.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -1063,17 +1063,18 @@ def grid_layout(context, box, bottom_space, skip_stack, containing_block,
10631063
skip_height = 0
10641064
resume_at = None
10651065
for i, row_y in enumerate(rows_positions[skip_row:], start=skip_row):
1066-
# TODO: Check that page is not empty.
10671066
if context.overflows_page(bottom_space, row_y - skip_height):
1068-
if i == 0:
1069-
return None, None, {'break': 'any', 'page': None}, [], False
1070-
resume_row = i - 1
1071-
resume_at = {i-1: None}
1072-
for child in children:
1073-
_, y, _, _ = children_positions[child]
1074-
if skip_row <= y <= i-2:
1075-
this_page_children.append(child)
1076-
break
1067+
if not page_is_empty:
1068+
if i == 0:
1069+
return None, None, {'break': 'any', 'page': None}, [], False
1070+
resume_row = i - 1
1071+
resume_at = {i-1: None}
1072+
for child in children:
1073+
_, y, _, _ = children_positions[child]
1074+
if skip_row <= y <= i-2:
1075+
this_page_children.append(child)
1076+
break
1077+
page_is_empty = False
10771078
else:
10781079
for child in children:
10791080
_, y, _, _ = children_positions[child]

0 commit comments

Comments
 (0)