Don't translate rtl columns twice

Fix #574.
This commit is contained in:
Guillaume Ayoub 2018-02-20 02:11:45 +01:00
parent 981045d661
commit 19342fb93f
2 changed files with 3 additions and 1 deletions

View File

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

View File

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