aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/flow/inline
Commit message (Collapse)AuthorAgeFilesLines
...
* Bump xi_unicode to latest version (#33246)Jonathan Schwender2024-08-291-1/+1
| | | | | | | | | | | | | | | | | | * Bump xi_unicode to latest version Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * dep: update XI_LINE_BREAKING_CLASS_ZWJ constant to 42 This matches the value returned by xi-unicode's linebreak_property for `u200D` codepoint in v0.3.0 of the crate. Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> --------- Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Fix clippy wanings in layout (#33215)atbrakhi2024-08-272-5/+2
| | | Signed-off-by: atbrakhi <atbrakhi@igalia.com>
* Respect min/max constraints in the block axis of block containers (#33203)Oriol Brufau2024-08-271-17/+21
| | | | | | | | | | | | | | | Consider a block container that establishes an inline formatting context and has a definite `block-size` which is clamped by `min-block-size` or `max-block-size`. We were already sizing such container correctly, however, its contents were resolving their percentages against the unclamped `block-size` value. This patch fixes the `ContainingBlock` that we pass to the contents so that they resolve percentages correctly. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* layout: Clean up inline layout data structures (#33149)Martin Robinson2024-08-223-194/+154
| | | | | | | | | | | | | | | | - Rename `InlineFormattingContextState` to `InlineFormattingContextLayout`. - Have `InlineFormattingContextLayout` hold a reference to the `InlineFormattingContext`, so that it does not need to be passed around as an argument - Have `LineItemLayout` hold a reference to `InlineFormattingContextLayout` to avoid duplicating so much data. - Rename some members of `LineItemLayout` to make it clearer what they do. - Give beter names to many lifetimes and combine some that are effectively the same. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
* layout: Add initial support for bidirectional text (BiDi) (#33148)Martin Robinson2024-08-214-81/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* layout: Prepare for bidi by guarding all access to `writing-mode` (#33082)Martin Robinson2024-08-162-12/+12
| | | | | | | | | We want to selectively enable right-to-left writing modes per layout context. This change makes that possible by allowing access to `writing-mode` though an interface that always returns the default horizontal top-to-bottom (implicitly left-to-right) writing mode. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
* layout: Initial implementation of `flex-direction: column` and ↵Martin Robinson2024-08-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | `column-reverse` (#33031) This change removes restrictions on using the column layout mode of flexbox and adds an initial implementation of sizing for that flex direction. There's a lot of missing pieces still, but in some cases this does render column flexbox. In particular, there are now two code paths for preferred widths (intrinsic size) calcuation: one in the main axis (row) and one in the cross axis (column) corresponding to the flex direciton with horizontal writing modes. In addition, `FlexItemBox::inline_content_sizes` is removed in favor of making `sizing::outer_inline` / `IndependentFormattingContext::outer_inline_content_sizes` generic enough to handle using a different value for auto minimum sizes, which flexbox needs. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* layout: Convert the FragmentTree to physical geometry (#33030)Martin Robinson2024-08-142-44/+68
| | | | | | | | | | | | | | | | This converts all geometry in the FragmentTree into physical geometry, doing conversions ahead of time instead of when traversing the fragment tree. This is necessary to properly implement BiDi in Servo as we need to know what side borders are on in mixed RTL and LTR contexts. In addition, fragments are laid out in a particular context and only that context knows its writing mode. There were issues where were using one writing mode to lay out and another to convert to phyisical coordinates. This isn't an issue now since we only use the default writing mode, but starts to be an issue with BiDi text. Closes #25564. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Upgrade stylo to 2024-07-16 (#32812)Martin Robinson2024-07-241-3/+3
| | | | | | | | | | | | | | * Upgrade stylo to 2024-07-16 Signed-off-by: Martin Robinson <mrobinson@igalia.com> * Use the new `dom` crate from stylo Signed-off-by: Martin Robinson <mrobinson@igalia.com> --------- Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Fix 5 clippy warnings (#32808)rachaelspooky2024-07-191-3/+2
| | | Signed-off-by: Rachael Gentry <rachael.l.gentry@gmail.com>
* flex: handle ‘align-self: [ first | last ]? && baseline’ (#32787)Delan Azabani2024-07-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * flex: handle ‘align-self: baseline’ Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * FIXME: css/css-flexbox/align-items-baseline-overflow-non-visible.html Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * Fix baseline selection Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * Fix baseline calculation with padding/border/margin Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * Fix compile errors and warnings Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * Implement ‘align-self: last baseline’ Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * Fix bug where non-baseline-aligned items affected max baseline Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * Update expectations Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * Rename method Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> --------- Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* use au in inline (#32728)atbrakhi2024-07-092-112/+91
| | | Signed-off-by: atbrakhi <atbrakhi@igalia.com>
* Fix more clippy (#32740)石蕊 (Pi-Cla)2024-07-091-2/+2
|
* layout: Improve layout of table captions (#32695)Martin Robinson2024-07-083-99/+131
| | | | | | | | | | | | | | | | - Instead of treating captions as a `BlockFormattingContext`, treat it as a `NonReplacedFormattingContext`, which allows reusing flow layout for captions -- fixing some issues with sizing. - Pass in the proper size of the containing block when laying out, fixing margin calculation. - Follow the unspecified rules about how various size properties on captions affect their size. - Improve linebreaking around atomics, which is tested by caption-related tests. This fixes intrinsic size calculation regarding soft wrap opportunities around atomic and also makes the code making these actual soft wrap opportunities a bit better. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* clippy: Fix warnings in `shared` and `config`, `fonts`, `layout`, and ↵Martin Robinson2024-07-041-5/+1
| | | | `layout_2020` components (#32674)
* layout: Allow rendering LineItems independent of inline box (#32666)Martin Robinson2024-07-034-675/+926
| | | | | | | | | | Refactor inline layout to allow rendering line items in the second stage to be rendered in any order, independent of their parent inline box. This will allow line items to be reordered, effectively allowing the splitting of inline boxes, for the purposes of BiDi and any other inline reordering feature. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
* use au in TextFragment (#32653)atbrakhi2024-07-031-1/+1
|
* fix clippy warning (#32667)atbrakhi2024-07-022-3/+3
|
* layout: Make `geom.rs` logical geoemetry types more ergonomic (#32633)Martin Robinson2024-06-282-18/+16
| | | | | | Make using the logical geometry types more ergonomic by having them all implement `Copy` (at most 4 64-bit numbers), similar to what `euclid` does. In addition add an implementation of `Neg` for `LogicalVec` and `LogicalSides` as it will be used in upcoming table implementation code.
* use au in AtomicLineItem (#32630)atbrakhi2024-06-271-3/+3
|
* Upgrade stylo to 2024-05-31 (#32474)Oriol Brufau2024-06-241-13/+15
| | | | | | | | | | | * Upgrade stylo to 2024-05-31 * Fixup for https://phabricator.services.mozilla.com/D211731 * Fixup for https://phabricator.services.mozilla.com/D207779 * Fixup for https://phabricator.services.mozilla.com/D207781 * Update test expectations
* use app unit in box_fragement (#32349)atbrakhi2024-06-212-30/+32
|
* layout: Add very basic support for showing text in input boxes (#32365)Martin Robinson2024-06-202-9/+63
| | | | | | | | | | | | | | | | | | This only paints text in input fields. Selection and cursor are still not painted. In addition to adding this feature, the change also updates the user-agent.css with the latest from the HTML specification. Extra padding and extraneous settings (such as a bogus line-height and min-height) are also removed from servo.css. This leads to some new passes. There are some new passes, this introduces failures as inserting text reveals issues that were hidden before. Notably: - failures in `/html/editing/editing-0/spelling-and-grammar-checking/`: We do not support spell-checking. - Most of the rest of the new failures are missing features of input boxes that are also missing in legacy layout.
* Rename `gfx` to `fonts` (#32556)Martin Robinson2024-06-193-10/+8
| | | | | | | | | This crate only takes care of fonts now as graphics related things are split into other crates. In addition, this exposes data structures at the top of the crate, hiding the implementation details and making it simpler to import them. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* layout: Flatten inline box storage in InlineFormattingContexts (#32539)Martin Robinson2024-06-192-237/+201
| | | | | | | | | | | This accomplishes two things: 1. Makes it easier to iterate through all inline formatting context items. 2. Will make it possible to easily move back and forth through the tree of inline boxes, in order to enable reordering and splitting inline boxes on lines -- necessary for BiDi. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
* layout: Allocate inline box start space on segment (#32486)Martin Robinson2024-06-181-12/+12
| | | | | | Instead of allocating the inline padding and border space on the line, allocate it on the segment -- which where the inline box start goes. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
* layout: Linebreak the entire InlineFormattingContext at once (#32483)Martin Robinson2024-06-134-164/+319
| | | | | | | | | | | | | Instead of linebreaking inside each single-font text segment, linebreak the entire inline formatting context at once. This has several benefits: 1. It allows us to use `icu_segmenter` (already in use from style), which is written against a newer version of the Unicode spec -- preventing breaking emoji clusters. 2. Opens up the possibility of changing the way that linebreaking and shaping work -- eventually allowing shaping across inline box boundaries and line breaking *after* shaping. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
* layout: Don't default to fallback fonts for spaces (#32442)Martin Robinson2024-06-051-1/+1
| | | | | | | | | | | | Previously, when deciding the font for a space, preference was given to the previous used font. This could means that the font chosen was a fallback font instead of the first font that supporting the space character in the font preference list. This caused an issue rendering emojis surrounded by spaces with "Noto Color Emoji" which has a space character the same size as the emoji, leading to too much spacing between them. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
* layout: Add a `InlineFormattingContextBuilder` (#32415)Martin Robinson2024-06-034-0/+4311
The main change here is that collapsed and `text-transform`'d text is computed as it's processed by DOM traversal. This single transformed text is stored in the root of the `InlineFormattingContext`. This will eventually allow performing linebreaking and shaping of the entire inline formatting context at once. Allowing for intelligent processing of linebreaking and also shaping across elements. This matches more closely what LayoutNG does. This shouldn't have any (or negligable) behavioral changes, but will allow us to prevent linebreaking inside of clusters in a followup change. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>