aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/flow
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix precision issue with line heights (#33438)Oriol Brufau2024-09-131-1/+5
| | | | | | | | | When computing the ascent and descent in an inline formatting context, we weren't taking into account that app units have precision limitations. Therefore, in some cases we were getting a line height that was slightly taller than the value specified in `line-height`. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* uses app units in display_list (#33420)atbrakhi2024-09-134-30/+23
| | | | Signed-off-by: atbrakhi <atbrakhi@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Cleanup after #33396 (#33429)Oriol Brufau2024-09-121-4/+3
| | | | | | Mostly formatting improvements, but also recovering a pair of parenthesis that was accidentally removed, changing the logic. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Handle all `white-space` values when intrinsically sizing an IFC (#33343)Oriol Brufau2024-09-112-31/+52
| | | | | | | | | | | There were various cases like `text-wrap-mode: nowrap` and `white-space-collapse: break-spaces` that weren't handled well. Fixes #33335 flexbox_flex-formatting-interop.html fails now because we don't support `table-layout: fixed`. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Let table-related boxes adjust their `overflow` values (#33400)Oriol Brufau2024-09-111-2/+2
| | | | | | | | | | The `overflow` property doesn't apply to table track and track groups, and table elements only accept a few `overflow` values. Therefore, this patch adds an `effective_overflow()` method to get the actual value that needs to be used. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* layout: Right-to-left support for other layout modes (#33375)Martin Robinson2024-09-114-224/+368
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change removes the `effective_writing_mode` concept and tries to properly implement right-to-left layout support for all non-inline writing modes. In general, what needs to happen is that rectangles need to be converted to physical rectangles using the containing block. A right-to-left rectangle's inline start is on the right physical side of the containing block. Likewise a positive inline offset in right-to-left text is a negative physical one. The implementation here is pretty good for most layout modes, but floats are still a bit in process. Currently, floats are processed in the logical layout of the block container, but there still might be issues with float interaction with mixed RTL and LTR. While this does move us closer to supporting vertical writing modes, this is still unsupported. New failures: - Vertical writing mode not supported: - `/css/CSS2/floats/floats-placement-vertical-001b.xht` - `/css/CSS2/floats/floats-placement-vertical-001c.xht` - Absolutes inlines should avoid floats (#33323) - `/css/css-position/position-absolute-dynamic-static-position-floats-004.html` - No support for grid - `/css/css-align/self-alignment/self-align-safe-unsafe-grid-003.html` - `/css/css-position/static-position/inline-level-absolute-in-block-level-context-009.html` - `/css/css-position/static-position/inline-level-absolute-in-block-level-context-010.html` - Cannot reproduce these locally on any platform. Very mysterious: - `/css/css-tables/row-group-margin-border-padding.html` - `/css/css-tables/row-margin-border-padding.html` - Exposes bugs we have related to hanging whitespace in preserved whitespace inlines: - `/css/css-text/white-space/trailing-space-and-text-alignment-rtl-003.html` - `/css/css-text/white-space/white-space-pre-wrap-trailing-spaces-023.html` Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
* layout: Use `Au` in `ComputedValuesExt` (#33396)atbrakhi2024-09-103-71/+62
| | | | | | | | | | | | | | | | | | | | * Use app unit in `ComputedValuesExt` Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: atbrakhi <atbrakhi@igalia.com> * Some miscellaneous fixes Signed-off-by: Martin Robinson <mrobinson@igalia.com> * remove redundant defination of `containing_block_inline_size` Signed-off-by: atbrakhi <atbrakhi@igalia.com> --------- Signed-off-by: atbrakhi <atbrakhi@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Allow breaking line after space with `white-space: break-spaces` (#33376)Oriol Brufau2024-09-101-4/+3
| | | | | | | | | | | | | | `white-space: break-spaces` should allow a soft wrap opportunity *after* every preserved white space. Then, to avoid breaking before the first white space, `TextRunSegment::shape_text()` has some logic to separate it from the following spaces and put it with the preceding text instead. The problem was that, when combined with `word-break: keep-all`, we were then only checking whether there were more white spaces afterwards, ignoring the soft wrap opportunity after the first one. Also removing a duplicated `can_break_anywhere` variable. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* layout: Implement proper absolute child position for flexbox (#33346)Martin Robinson2024-09-093-31/+45
| | | | | | | | | | | This implements the requirements outlined in the [flexbox specification] about how to position absolute children of flex containers. We must establish a static position rectangle (to use if all insets are auto) and also align the child into that rectangle. [flebox specification]: https://drafts.csswg.org/css-flexbox/#abspos-items Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* tidy: Fix rustdoc warnings and add a tidy check for a common URL issue (#33366)Martin Robinson2024-09-083-10/+9
| | | | | | | | This change fixes all rustdoc errors and also adds a tidy check for a very common rustdoc URL issue. Eventually rustdoc warnings should likely cause the build to fail, but this catches those issues sooner in order to not waste so much developer time. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* layout: Lay out absolutes in atomic containing blocks (#33336)Martin Robinson2024-09-061-9/+17
| | | | | | | | | | When inline atomics establish containing blocks for absolute descendants, layout should happen with those atomics as the containing block. This ensures that the absolute descendents have the correct containing block and Fragment parent. This wasn't happening before and this change fixes that. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Fix various issues with replaced elements in flex layout (#33263)Oriol Brufau2024-08-303-8/+6
| | | | | | | | In particular, this takes into account that flex items may be stretched, and if they have an aspect ratio, we ma6y need to convert the stretched size through the ratio. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* layout: Stop using `unicode-segmentation` in layout (#33250)Martin Robinson2024-08-291-3/+4
| | | | | | | `layout` already uses `icu_segmentation` so there's no need to pull in another segmenter. This reduces the number of segmenters used in the crate to 2 from 3. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* layout: Add an indefinite containing block for intrinsic sizing (#33204)Oriol Brufau2024-08-293-56/+76
| | | | | | | | | | | | | | | | | | When computing the min-content or max-content size of an element we need to ignore `inline-size`, `min-inline-size` and `max-inline-size`. However, we should take the block-axis sizing properties into account. That's because the contents could have percentages depending on them, which can then affect their inline size via an aspect ratio. Therefore, this patch adds `IndefiniteContainingBlock`, which is similar to `ContainingBlock`, but it allows an indefinite inline-size. This struct is then passed arround during intrinsic sizing. More refinement will be needed in follow-up patches in order to fully address the problem. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Obey `min-block-size` and `max-block-size` in floats (#33241)Oriol Brufau2024-08-291-1/+1
| | | | | We were using the unclamped `box_size.block` instead of `block_size`. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* 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-216-84/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-164-26/+39
| | | | | | | | | 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-142-5/+9
| | | | | | | | | | | | | | | | | | | | | | `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-145-124/+187
| | | | | | | | | | | | | | | | 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-242-10/+6
| | | | | | | | | | | | | | * 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
|
* fonts: Add support for generic font families and font size configuration ↵Martin Robinson2024-07-081-1/+5
| | | | | | | | | | | | | | | | | | (#32673) This adds support for generic font families in Servo and allows for configuration of them as well as their default font sizes. One interesting fix here is that now monospace default to 13px, like it does in other browsers. In addition to that, this exposes a new interface in Stylo which allows setting a default style. This is quite useful for fonts, but also for other kinds of default style settings -- like text zoom. Fixes #8371. Fixes #14773. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* layout: Improve layout of table captions (#32695)Martin Robinson2024-07-084-102/+134
| | | | | | | | | | | | | | | | - 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: Add support for table captions (#32657)Martin Robinson2024-07-031-4/+4
| | | | | | | | | | | | | This adds initial support for table captions. To do this, the idea of the table wrapper becomes a bit more concrete. Even so, the wrapper is still reponsible for allocating space for the grid's border and padding, as those properties are specified on the wrapper and not grid in CSS. In order to account for this weirdness of HTML/CSS captions and grid are now laid out and placed with a negative offset in the table wrapper content rect. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* layout: Allow rendering LineItems independent of inline box (#32666)Martin Robinson2024-07-035-676/+928
| | | | | | | | | | 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-284-31/+27
| | | | | | 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-215-49/+55
|
* layout: Simplify `Contents` a little (#32487)Martin Robinson2024-06-212-8/+8
| | | | | | | Instead of duplicating some of `NonReplacedContents` in `Contents`, divide it into either replaced and non-replaced content, since this is how the layout system processes `Contents` always. In addition, stop using `TryInto` to match replaced or non-replaced contents, as it is quite confusing to handle an `Err` as a success case.
* layout: Add very basic support for showing text in input boxes (#32365)Martin Robinson2024-06-203-9/+66
| | | | | | | | | | | | | | | | | | 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-194-250/+220
| | | | | | | | | | | 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-036-774/+903
| | | | | | | | | | | | | | | | 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>
* clippy: Fix warnings in `components/layout_2020/flow/text_run.rs` (#32393)Farid2024-05-311-1/+1
| | | | | | | | | | | | | * clippy: Fix warnings in `components/layout_2020/flow/text_run.rs` Signed-off-by: Jujumba <far77578@gmail.com> * clippy: Fix warnings in `components/layout_2020/flow/text_run.rs` Signed-off-by: Jujumba <far77578@gmail.com> --------- Signed-off-by: Jujumba <far77578@gmail.com>
* layout: Add support for `white-space-collapse: break-spaces` (#32388)Martin Robinson2024-05-303-24/+174
| | | | | | | | | | | | | | This change adds support for `white-space-collapse: break-spaces` and adds initial parsing support for `overflow-wrap` and `word-break`. The later two properties are not fully supported, only in their interaction with `break-spaces`. This is a preliminary change preparing to implement them. In addition, `break_and_shape` is now forked and added to Layout 2020. This function is going to change a lot soon and forking is preparation for this. More code that is only used by Layout 2013 is moved from `gfx` to that crate. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
* fonts: Improve font fallback (#32286)Martin Robinson2024-05-271-5/+44
| | | | | | | | | | | | | | | | | | - Better detect situations where emoji is necessary by looking ahead one character while laying out. This allow processing Unicode presentation selectors. When detecting emoji, put emoji fonts at the front of fallback lists for all platforms. This enables monochrome emoji on Windows. Full-color emoji on Windows probably needs full support for processing the COLR table and drawing separate glyph color layers. - Improve the font fallback list on FreeType platforms. Ideally, Servo would be able to look through the entire font list to find the best font for a certain character, but until that time we can make sure the font list contains the "Noto Sans" fonts which cover most situations. Fixes #31664. Fixes #12944.