-
-
Notifications
You must be signed in to change notification settings - Fork 696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flexbox: initial attempt to add support for RTL direction #1225
Conversation
weasyprint/layout/flex.py
Outdated
position_axis += free_space / len(line) / 2 | ||
elif justify_content == 'space-evenly': | ||
position_axis += free_space / (len(line) + 1) | ||
if box.style['direction'] == 'rtl': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logical part here is good. A nice improvement would be to multiply free_space
by -1
here if direction is rtl
, it would help keeping only one block below instead of duplicating it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried to add what you required but it breaks the flex items
article.position_x + article.width) | ||
assert div_1.position_x > div_2.position_x > div_3.position_x | ||
|
||
|
||
@assert_no_logs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding tests here with rtl
+ column
is a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -58,7 +58,9 @@ def test_flex_direction_row_rtl(): | |||
div_2.position_y == | |||
div_3.position_y == | |||
article.position_y) | |||
assert div_1.position_x == article.width - div_1.padding_width() | |||
assert ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@liZe please verify if this test is correct.
assert ( | ||
div_3.position_x + div_3.width == | ||
article.position_x + article.width) | ||
assert div_3.position_x == article.position_x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@liZe please verify if this test is correct.
Thanks a lot! No problem, I’ll simplify the "if rtl" part of your PR in a future commit. |
I have added:
related #601
related #106