From 3bd9a8e01422bafa02d55d199221254edde007e9 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Tue, 5 Jul 2022 16:06:46 +0200 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20limit=20the=20opacity=20groups?= =?UTF-8?q?=20to=20the=20original=20box=20size?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It doesn’t work when elements are displayed outside or when the box is transformed. --- tests/draw/test_transform.py | 22 ++++++++++++++++++++++ weasyprint/draw.py | 5 +---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/draw/test_transform.py b/tests/draw/test_transform.py index 5b908a60c..c8c9ee54a 100644 --- a/tests/draw/test_transform.py +++ b/tests/draw/test_transform.py @@ -285,3 +285,25 @@ def test_2d_transform_13(assert_pixels): font-size: 0 }
''') + + +@assert_no_logs +def test_2d_transform_opacity(assert_pixels): + assert_pixels(''' + __________ + __________ + __________ + _ss_______ + _ss_______ + __________ + __________ + __________ + __________ + __________ + ''', ''' + +
''') diff --git a/weasyprint/draw.py b/weasyprint/draw.py index 32fd21946..692dcb970 100644 --- a/weasyprint/draw.py +++ b/weasyprint/draw.py @@ -108,10 +108,7 @@ def draw_stacking_context(stream, stacking_context): if box.style['opacity'] < 1: original_stream = stream - stream = stream.add_group([ - box.border_box_x(), box.border_box_y(), - box.border_box_x() + box.border_width(), - box.border_box_y() + box.border_height()]) + stream = stream.add_group(stream.page_rectangle) if box.transformation_matrix: if box.transformation_matrix.determinant: