Skip to content

Commit c07c2c7

Browse files
committed
Remove top border from split grid container
1 parent a0c3373 commit c07c2c7

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

tests/layout/test_grid.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,43 @@ def test_grid_border():
911911
assert article.height == 10
912912

913913

914+
@assert_no_logs
915+
def test_grid_border_split():
916+
page1, page2 = render_pages('''
917+
<style>
918+
@page { size: 5px }
919+
body { font: 2px / 1 weasyprint }
920+
</style>
921+
<article style="display: grid; border-top: 1px solid; border-bottom: 1px solid;
922+
margin: 1px 0; padding: 1px 0">
923+
<div>a<br>b</div>
924+
</article>
925+
''')
926+
html, = page1.children
927+
body, = html.children
928+
article, = body.children
929+
assert article.border_top_width == 1
930+
assert article.border_bottom_width == 0
931+
assert article.margin_height() == 5
932+
section, = article.children
933+
assert section.position_x == 0
934+
assert section.position_y == 3
935+
assert section.width == html.width
936+
assert section.height == 2
937+
938+
html, = page2.children
939+
body, = html.children
940+
article, = body.children
941+
assert article.border_top_width == 0
942+
assert article.border_bottom_width == 1
943+
assert article.margin_height() == 5
944+
section, = article.children
945+
assert section.position_x == 0
946+
assert section.position_y == 0
947+
assert section.width == html.width
948+
assert section.height == 2
949+
950+
914951
@assert_no_logs
915952
def test_grid_margin():
916953
page, = render_pages('''

weasyprint/layout/grid.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,9 @@ def grid_layout(context, box, bottom_space, skip_stack, containing_block,
599599
page_is_empty, absolute_boxes, fixed_boxes):
600600
context.create_block_formatting_context()
601601

602+
if skip_stack and box.style['box_decoration_break'] != 'clone':
603+
box.remove_decoration(start=True, end=False)
604+
602605
# Define explicit grid
603606
grid_areas = box.style['grid_template_areas']
604607
flow = box.style['grid_auto_flow']

0 commit comments

Comments
 (0)