servo/components/layout_2020
Martin Robinson 56280c6242
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>
2024-08-21 14:28:54 +00:00
..
display_list layout: Prepare for bidi by guarding all access to writing-mode (#33082) 2024-08-16 11:38:04 +00:00
flexbox layout: Add initial support for bidirectional text (BiDi) (#33148) 2024-08-21 14:28:54 +00:00
flow layout: Add initial support for bidirectional text (BiDi) (#33148) 2024-08-21 14:28:54 +00:00
fragment_tree layout: Prepare for bidi by guarding all access to writing-mode (#33082) 2024-08-16 11:38:04 +00:00
table Fix floating point errors in table layout (#33098) 2024-08-21 10:41:43 +00:00
tests Remove lazy static (#33078) 2024-08-16 03:57:09 +00:00
Cargo.toml layout: Add initial support for bidirectional text (BiDi) (#33148) 2024-08-21 14:28:54 +00:00
cell.rs Strict import formatting (grouping and granularity) (#30325) 2023-09-11 19:16:54 +00:00
context.rs Rename gfx to fonts (#32556) 2024-06-19 20:26:19 +00:00
dom.rs clippy: Fix warnings in shared and config, fonts, layout, and layout_2020 components (#32674) 2024-07-04 14:18:58 +00:00
dom_traversal.rs layout: Fix display of new text in textarea elements (#32886) 2024-07-30 14:39:17 +00:00
formatting_contexts.rs layout: Prepare for bidi by guarding all access to writing-mode (#33082) 2024-08-16 11:38:04 +00:00
geom.rs layout: Add initial support for bidirectional text (BiDi) (#33148) 2024-08-21 14:28:54 +00:00
layout_debug.rs clippy: Fix warnings in shared and config, fonts, layout, and layout_2020 components (#32674) 2024-07-04 14:18:58 +00:00
lib.rs layout: Prepare for bidi by guarding all access to writing-mode (#33082) 2024-08-16 11:38:04 +00:00
lists.rs layout: Add a basic support for list-style-position: outside (#32114) 2024-04-22 14:23:35 +00:00
positioned.rs layout: Prepare for bidi by guarding all access to writing-mode (#33082) 2024-08-16 11:38:04 +00:00
query.rs layout: Prepare for bidi by guarding all access to writing-mode (#33082) 2024-08-16 11:38:04 +00:00
replaced.rs layout: Prepare for bidi by guarding all access to writing-mode (#33082) 2024-08-16 11:38:04 +00:00
sizing.rs Take into account the intrinsic block size when computing the main size of a column flex container (#33135) 2024-08-20 11:30:27 +00:00
style_ext.rs layout: Add initial support for bidirectional text (BiDi) (#33148) 2024-08-21 14:28:54 +00:00
traversal.rs script: Split style and layout data in DOM nodes (#31985) 2024-04-04 07:56:51 +00:00