From 19342fb93f3dd02905155871423fdc746d91523a Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Tue, 20 Feb 2018 02:11:45 +0100 Subject: [PATCH] Don't translate rtl columns twice Fix #574. --- weasyprint/formatting_structure/boxes.py | 1 + weasyprint/layout/blocks.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/weasyprint/formatting_structure/boxes.py b/weasyprint/formatting_structure/boxes.py index 8af75ec1..6f095aec 100644 --- a/weasyprint/formatting_structure/boxes.py +++ b/weasyprint/formatting_structure/boxes.py @@ -83,6 +83,7 @@ class Box(object): # Default, may be overriden on instances. is_table_wrapper = False is_for_root_element = False + is_column = False transformation_matrix = None bookmark_label = None string_set = None diff --git a/weasyprint/layout/blocks.py b/weasyprint/layout/blocks.py index 3830ec12..f839bbb2 100644 --- a/weasyprint/layout/blocks.py +++ b/weasyprint/layout/blocks.py @@ -173,6 +173,7 @@ def columns_layout(context, box, max_position_y, skip_stack, containing_block, column_box = box.anonymous_from(box, children=[ child.copy() for child in box.children]) resolve_percentages(column_box, containing_block) + column_box.is_column = True column_box.width = width column_box.position_x = box.content_box_x() column_box.position_y = box.content_box_y() @@ -347,7 +348,7 @@ def block_level_width(box, containing_block): margin_r = box.margin_right = 0 if width != 'auto' and margin_l != 'auto' and margin_r != 'auto': # The equation is over-constrained. - if containing_block.style.direction == 'rtl': + if containing_block.style['direction'] == 'rtl' and not box.is_column: box.position_x += ( cb_width - paddings_plus_borders - width - margin_r - margin_l) # Do nothing in ltr.