layout: Add initial support for bidirectional text (BiDi) (#33148)

This adds supports for right-to-left text assigning bidi levels to all
line items when necessary. This includes support for the `dir` attribute
as well as corresponding CSS properties like `unicode-bidi`. It only
implements right-to-left rendering for inline layout at the moment and
doesn't include support for `dir=auto`. Because of missing features,
this causes quite a few tests to start failing, as references become
incorrect due to right-to-left rendering being active in some cases,
but not others (before it didn't exist at all).

Analysis of most of the new failures:

```
- /css/css-flexbox/gap-001-rtl.html
  /css/css-flexbox/gap-004-rtl.html
 - Require implementing BiDi in Flexbox, because the start and
   end inline margins are opposite the order of items.

- /css/CSS2/bidi-text/direction-applies-to-*.xht
  /css/CSS2/bidi-text/direction-applies-to-002.xht
  /css/CSS2/bidi-text/direction-applies-to-003.xht
  /css/CSS2/bidi-text/direction-applies-to-004.xht
  - Broken due to a bug in tables, not allocating the
    right amount of width for a column.

- /css/css-lists/inline-list.html
  - This fails because we wrongly insert a soft wrap opportunity between the
    start of an inline box and its first content.

- /css/css-text/bidi/bidi-lines-001.html
  /css/css-text/bidi/bidi-lines-002.html
  /css/CSS2/text/bidi-flag-emoji.html
  - We do not fully support unicode-bidi: plaintext

- /css/css-text/text-align/text-align-end-010.html
  /css/css-text/text-align/text-align-justify-006.html
  /css/css-text/text-align/text-align-start-010.html
  /html/dom/elements/global-attributes/*
  - We do not support dir=auto yet.

- /css/css-text/white-space/tab-bidi-001.html
  - Servo doesn't support tab stops

- /css/CSS2/positioning/abspos-block-level-001.html
  /css/css-text/word-break/word-break-normal-ar-000.html
  - Do not yet support RTL layout in block

- /css/css-text/white-space/pre-wrap-018.html
  - Even in RTL contexts, spaces at the end of the line must hang and
    not be reordered

- /css/css-text/white-space/trailing-space-and-text-alignment-rtl-002.html
  - We are letting spaces hang with white-space: pre, but they shouldn't
    hang.
```

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
This commit is contained in:
Martin Robinson 2024-08-21 07:28:54 -07:00 committed by GitHub
parent 65bd5a3b99
commit 56280c6242
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
189 changed files with 547 additions and 762 deletions

View file

@ -1,355 +1,34 @@
[unicode-bidi-ua-rules.html]
[UA stylesheet rule for unicode-bidi, for <address>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <blockquote>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <center>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <div>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <figure>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <figcaption>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <footer>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <form>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <header>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <hr>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <legend>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <listing>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <main>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <p>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <plaintext>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <pre>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <summary>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <xmp>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <article>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <aside>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <h1>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <h2>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <h3>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <h4>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <h5>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <h6>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <hgroup>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <nav>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <section>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <search>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <table>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <caption>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <colgroup>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <col>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <thead>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <tbody>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <tfoot>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <tr>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <td>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <th>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <dir>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <dd>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <dl>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <dt>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <menu>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <ol>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <ul>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <li>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <bdi>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <output>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <a>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <abbr>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <area>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <audio>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <b>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <base>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <body>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <br>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <button>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <canvas>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <cite>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <code>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <data>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <datalist>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <del>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <details>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <dfn>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <dialog>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <em>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <embed>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <fieldset>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <head>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <html>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <i>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <iframe>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <img>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <ins>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <kbd>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <label>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <link>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <map>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <mark>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <meta>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <meter>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <noscript>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <object>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <optgroup>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <option>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <param>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <progress>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <q>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <rp>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <rt>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <ruby>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <s>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <samp>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <script>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <select>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <slot>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <small>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <source>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <span>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <strong>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <style>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <sub>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <sup>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <template>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <time>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <title>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <track>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <u>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <var>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <video>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <wbr>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <bdo>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=hidden>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=text>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=search>]
expected: FAIL
@ -361,48 +40,3 @@
[UA stylesheet rule for unicode-bidi, for <input type=email>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=password>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=date>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=time>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=datetime-local>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=number>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=range>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=color>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=checkbox>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=radio>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=file>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=submit>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=image>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=reset>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <input type=button>]
expected: FAIL
[UA stylesheet rule for unicode-bidi, for <textarea>]
expected: FAIL

View file

@ -0,0 +1,2 @@
[textarea-padding-iend-overlaps-content-001.tentative.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[textarea-padding-istart-moves-content-001.tentative.html]
expected: FAIL