Skip to content
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

Incorrect layout for inline-block elements in RTL flows #6092

Open
mbrubeck opened this issue May 16, 2015 · 2 comments
Open

Incorrect layout for inline-block elements in RTL flows #6092

mbrubeck opened this issue May 16, 2015 · 2 comments

Comments

@mbrubeck
Copy link
Contributor

@mbrubeck mbrubeck commented May 16, 2015

In this test case, the div should appear at the top right of the page. In Servo it does not appear anywhere on-screen:

<html>
  <head>
    <style>
      body { direction: rtl; }
      div {
        display: inline-block;
        border: 1px solid red;
        width: 100px;
        height: 100px;
      }
    </style>
  </head>
  <body>
    <div></div>
  </body>
</html>

This is probably caused by similar issues to #6006.

@nhirata
Copy link

@nhirata nhirata commented Feb 17, 2016

Not sure if this deserves a separate bug or not, the date is incorrect as well (something from bug 459035; https://bugzilla.mozilla.org/show_bug.cgi?id=459035 )

Firefox doesn't get it right either, and we're not consistent:
I compared servo to firefox :

  1. ./mach run http://people.mozilla.org/~nhirata/html_tp/bug459035.html

screen shot 2016-02-16 at 6 23 24 pm

@Manishearth Manishearth self-assigned this Jan 12, 2018
@mbrubeck
Copy link
Contributor Author

@mbrubeck mbrubeck commented Jan 12, 2018

I don't know exactly where this is going wrong, but it's probably something like this: In various places we need to translate logical sizes or coordinates from a parent box's coordinate system to a child's coordinate system, or vice-versa. For example, if the parent is RTL but the child is LTR, then to determine the child's inline-start (left) position, we need to look at the parent's inline-end (left) padding.

Sometimes this means we change logic based on whether the parent and child writing modes have the same inline direction or opposite directions. Examples:

if kid_mode.is_bidi_ltr() == containing_block_mode.is_bidi_ltr() {

let parent_has_same_direction = container_mode.is_bidi_ltr() == block_mode.is_bidi_ltr();

I believe my theory when I wrote the initial comment above was that we were looking at the wrong parent. In the test case, everything under body should inherit inherit direction: rtl, but the root html element still has the initial value direction: ltr. Maybe this code is incorrectly propagating the direction of the parent's parent, so that the fragments within the div end up looking at their grandparent's writing mode?

for kid in self.base.child_iter_mut() {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.