-
Notifications
You must be signed in to change notification settings - Fork 110
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
Bi-directional layout support #736
base: main
Are you sure you want to change the base?
Conversation
To answer your questions:
left should mean left, etc.
My intuition on this is that it should happen during the calculations. But I would be open to being persuaded otherwise. As long as whichever implementation we choose is able to pass all the relevant tests and match other browsers I think I'll be happy. Will do a proper review later. |
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.
@tjamaan Actual direction changes look good to me. But we'll want to hook this up to our testing infrastructure to verify that. The process for that is something like:
- Add support for the
direction
property to ourgentest
script- Add support for reading it to
scripts/gentest/test_helper.js
- Add support for generating to
scripts/gentest/main.rs
- Add support for reading it to
- Setup the gentest script to generate every test with both
ltr
andrtl
as the default. - Write some new tests to test mixed direction.
I've also formatted main
using the latest nightly, and I've also removed .cargo/config
from our repo. So if you rebase on latest main
that should get rid of a bunch of unrelated changes from the diff.
/// TODO: documentation | ||
pub direction: Direction, |
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.
Am I correct in thinking that this isn't actually used? If so, it should probably be removed. Removing the direction
field here and the direction
function parameter from the traits would greatly reduce the size of the diff for this PR which would be nice!
match direction { | ||
Direction::Rtl => { | ||
justify_content.flip(); | ||
justify_items.as_mut().map(|x| x.flip()); | ||
} | ||
_ => (), | ||
} |
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.
Maybe use if direction.is_rtl()
here?
Objective
Add support for bi-directional layout (left-to-right and right-to-left) via the
direction
CSS style property.Context
This change attempts to support bidi layout only for horizontal layout direction, i.e. it doesn't support vertical content such as CJK or Mongolian vertical writing systems.
Feedback wanted
Should inset, margin, padding, and border
Rect
s be considered as absolute axis (left means left and right means right) or relative axis (left means layout start, right means layout end)?Should the RTL conversion happen during the calculations or as a separate phase (i.e. calculate as if LTR then flip the horizontal axis)?
General code review is also wanted to be more aligned with the rest of taffy's code :)