Repository: Kozea/WeasyPrint (python)

Issue:
v63.0 flexbox issue overflow hidden
With v63.0 the following code breaks:

```
<html>
<head>
<style>
    .wrapper {
      display: flex;
    }
    .cell {
      flex: 1;
      border: 1px solid black;
      padding: 10px;
      overflow: hidden;
    }
  </style>
</head>
<body>
  <div class="wrapper">
    <div class="cell">one</div>
    <div class="cell">two</div>
    <div class="cell">three</div>
    <div class="cell">four</div>
    <div class="cell">five</div>
    <div class="cell">six</div>
    <div class="cell">seven</div>
    <div class="cell">eight</div>
    <div class="cell">nine</div>
  </div>
</body>
</html>
```

When overflow: hidden is added to .cell, all cells appear on top of each other instead of next to each other.

Pull request description:
Don’t avoid floats for flex items
Fix #2292 

Patch:
diff --git a/weasyprint/layout/block.py b/weasyprint/layout/block.py
index 8cc2a87e..ad732ab1 100644
--- a/weasyprint/layout/block.py
+++ b/weasyprint/layout/block.py
@@ -124,9 +124,9 @@ def block_box_layout(context, box, bottom_space, skip_stack,
     result = block_container_layout(
         context, box, bottom_space, skip_stack, page_is_empty,
         absolute_boxes, fixed_boxes, adjoining_margins, discard, max_lines)
-    # TODO: columns shouldn't be block boxes, this condition would then be
-    # useless when this is fixed.
-    if not (new_box := result[0]) or new_box.is_column:
+    # TODO: columns and flex items shouldn't be block boxes, this condition
+    # would then be useless when this is fixed.
+    if not (new_box := result[0]) or new_box.is_column or new_box.is_flex_item:
         return result
     if new_box.is_table_wrapper or new_box.establishes_formatting_context():
         # Don't collide with floats


Test patch:
diff --git a/tests/layout/test_flex.py b/tests/layout/test_flex.py
index a7e03355..77802119 100644
--- a/tests/layout/test_flex.py
+++ b/tests/layout/test_flex.py
@@ -755,3 +755,30 @@ def test_flex_auto_margin2():
     outer, = body.children
     inner, = outer.children
     assert inner.margin_left != 0
+
+
+@assert_no_logs
+def test_flex_overflow():
+    # Regression test for https://github.com/Kozea/WeasyPrint/issues/2292
+    page, = render_pages('''
+<style>
+  article {
+    display: flex;
+  }
+  section {
+    overflow: hidden;
+    width: 5px;
+  }
+</style>
+<article>
+  <section>A</section>
+  <section>B</section>
+</article>
+''')
+    html, = page.children
+    body, = html.children
+    article, = body.children
+    section_1 = article.children[0]
+    section_2 = article.children[1]
+    assert section_1.position_x == 0
+    assert section_2.position_x == 5