Skip to content

Commit

Permalink
Reorder flex items before skipping already drawn elements
Browse files Browse the repository at this point in the history
One more fix for flex boxes that will cause painful regressions. Will be fully
fixed when this whole file is finally rewritten…

Fix #1992.
  • Loading branch information
liZe committed Oct 24, 2023
1 parent bbae60e commit 4f322a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions weasyprint/layout/flex.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def flex_layout(context, box, bottom_space, skip_stack, containing_block,
parent_box.width = preferred.flex_max_content_width(
context, parent_box)
original_skip_stack = skip_stack
children = sorted(children, key=lambda item: item.style['order'])
if skip_stack is not None:
(skip, skip_stack), = skip_stack.items()
if box.style['flex_direction'].endswith('-reverse'):
Expand Down Expand Up @@ -263,8 +264,7 @@ def flex_layout(context, box, bottom_space, skip_stack, containing_block,
line = []
line_size = 0
axis_size = getattr(box, axis)
for i, child in enumerate(
sorted(children, key=lambda item: item.style['order'])):
for i, child in enumerate(children):
if not child.is_flex_item:
continue
line_size += child.hypothetical_main_size
Expand Down

0 comments on commit 4f322a2

Please sign in to comment.