1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-05 00:21:15 +03:00

Make blocks with 'overflow' different from 'visible' grow to include floating children.

Fix #661.
This commit is contained in:
grewn0uille 2019-09-16 16:33:13 +02:00
parent 5f7a104c62
commit 8e267c90df
2 changed files with 17 additions and 0 deletions

View File

@ -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':

View File

@ -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