@@ -855,6 +855,16 @@ def find_earlier_page_break(children, absolute_boxes, fixed_boxes):
855
855
856
856
previous_in_flow = None
857
857
for index , child in reversed_enumerate (children ):
858
+ if child .is_in_normal_flow ():
859
+ if previous_in_flow is not None and (
860
+ block_level_page_break (child , previous_in_flow ) not in
861
+ ('avoid' , 'avoid-page' )):
862
+ index += 1 # break after child
863
+ new_children = children [:index ]
864
+ # Get the index in the original parent
865
+ resume_at = (children [index ].index , None )
866
+ break
867
+ previous_in_flow = child
858
868
if child .is_in_normal_flow () and (
859
869
child .style .break_inside not in ('avoid' , 'avoid-page' )):
860
870
if isinstance (child , boxes .BlockBox ):
@@ -870,16 +880,6 @@ def find_earlier_page_break(children, absolute_boxes, fixed_boxes):
870
880
break
871
881
elif isinstance (child , boxes .TableBox ):
872
882
pass # TODO: find an earlier break between table rows.
873
- if child .is_in_normal_flow ():
874
- if previous_in_flow is not None and (
875
- block_level_page_break (child , previous_in_flow ) not in
876
- ('avoid' , 'avoid-page' )):
877
- index += 1 # break after child
878
- new_children = children [:index ]
879
- # Get the index in the original parent
880
- resume_at = (children [index ].index , None )
881
- break
882
- previous_in_flow = child
883
883
else :
884
884
return None
885
885
0 commit comments