Skip to content

Commit

Permalink
Make blocks with 'overflow' different from 'visible' grow to include …
Browse files Browse the repository at this point in the history
…floating children.

Fix #661.
  • Loading branch information
grewn0uille committed Sep 16, 2019
1 parent 5f7a104 commit 8e267c9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions weasyprint/layout/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,11 @@ def block_container_layout(context, box, max_position_y, skip_stack,
# http://www.w3.org/TR/CSS21/visudet.html#normal-block
# TODO: See float.float_layout
if new_box.height == 'auto':
if context.excluded_shapes and new_box.style['overflow'] != 'visible':
max_float_position_y = max(
float_box.position_y + float_box.margin_height()
for float_box in context.excluded_shapes)
position_y = max(max_float_position_y, position_y)
new_box.height = position_y - new_box.content_box_y()

if new_box.style['position'] == 'relative':
Expand Down
12 changes: 12 additions & 0 deletions weasyprint/tests/test_layout/test_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,3 +705,15 @@ def test_box_decoration_break_slice_bottom_padding():
assert article.height == 20
div, = article.children
assert div.position_y == 0


@assert_no_logs
def test_overflow_auto():
page, = parse('''
<article style="overflow: auto">
<div style="float: left; height: 50px; margin: 10px">bla bla bla</div>
toto toto''')
html, = page.children
body, = html.children
article, = body.children
assert article.height == 50 + 10 + 10

0 comments on commit 8e267c9

Please sign in to comment.