aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020
Commit message (Collapse)AuthorAgeFilesLines
...
* clippy: Fix various clippy warnings throughout the code (#33003)Ashwin Naren2024-08-133-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * replace u64::max_value() with u64::MAX Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * removed redundant import Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * Fixed dereference Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * Fixed a probable bug Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * fixed imports Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * fixed dereference Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * dereference formatting Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * removed unnessicary number imports Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * removed unnessicary number imports Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * removed excess borrow Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * ran mach fmt Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * fixed doc comment Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * removed deref on an immutable reference Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * fixed minor syntax error Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * reverted clamping Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * formatting Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * reverted final clamp Signed-off-by: Ashwin Naren <arihant2math@gmail.com> --------- Signed-off-by: Ashwin Naren <arihant2math@gmail.com> Co-authored-by: Ashwin Naren <ashwin@pixelators.org>
* layout: Non-auto `z-index` should always make stacking contexts for flex ↵Martin Robinson2024-08-124-15/+42
| | | | | | items (#32961) Fixes #32756. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* layout: Add support for `align-content: stretch` (#32906)Martin Robinson2024-08-061-419/+485
| | | | | | | | | | This adds support for `align-content: stretch` by splitting flex line layout into two phases. The first phase takes place before determing how much extra space to allocate for stretching items. Then line layout finishes, which might cause two layouts for items with `align-self: stretch`. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* deps: Upgrade to WebRender 0.65 (#32930)Martin Robinson2024-08-051-0/+1
| | | Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* layout: Improve documentation and code structure in ↵Martin Robinson2024-08-051-31/+42
| | | | | | | | | | `FlexItemBox::automatic_min_size` (#32911) This change add specification text to comments and restructres the code a bit to better match the specification. In addition, a the `establishes_scroll_container()` helper is used instead of looking at overflow directly. It should not change behavior at all. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* layout: Compute intrinsic sizes for flex items and flex containers (#32854)Delan Azabani2024-08-027-109/+620
| | | | | Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Implement gaps in flexbox layout (#32891)Oriol Brufau2024-07-311-18/+42
| | | | | | As per https://drafts.csswg.org/css-align/#gaps Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* layout: Fix display of new text in `textarea` elements (#32886)Martin Robinson2024-07-301-18/+29
| | | | | | | Previously `<textarea>` was just displaying node contents, which is the original text content, not the one updated by later typing. This change fixes that issue. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* layout: Port `border-image` support for legacy layout (#32874)Martin Robinson2024-07-303-55/+271
| | | Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* layout: Add support for propagating baselines from flexbox (#32841)Martin Robinson2024-07-241-32/+86
| | | | | | | | Some tests are still broken due to missing preferred widths calculation for flexbox and also for missing column layout. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com> Co-authored-by: Delan Azabani <dazabani@igalia.com>
* Upgrade stylo to 2024-07-16 (#32812)Martin Robinson2024-07-243-10/+7
| | | | | | | | | | | | | | * 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>
* Implement the `aspect-ratio` property for replaced elements (#32800)valadaptive2024-07-242-26/+150
| | | | | | | | | | | | | | | | | * Add WPT tests for box-sizing with aspect-ratio Signed-off-by: valadaptive <valadaptive@protonmail.com> * Implement `aspect-ratio` for replaced elements There are two regressions because we don't implement `object-fit`, and one because we don't properly represent non-available <img>s with `alt` attributes. Signed-off-by: valadaptive <valadaptive@protonmail.com> --------- Signed-off-by: valadaptive <valadaptive@protonmail.com>
* layout: Reduce the complexity of `FlexLine::layout` (#32810)Martin Robinson2024-07-192-151/+120
| | | | | | | | Instead of a complex combination of iterators, use a flatter iteration design when laying out a flex line. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com> Co-authored-by: Delan Azabani <dazabani@igalia.com>
* Fix 5 clippy warnings (#32808)rachaelspooky2024-07-193-6/+5
| | | Signed-off-by: Rachael Gentry <rachael.l.gentry@gmail.com>
* Fix sizing of replaced elements with min/max sizes (#32777)valadaptive2024-07-181-171/+228
| | | | | | | | If a (min/max)-(height/width) property is set, we still need to respect the intrinsic ratio of the element if it exists. The previous code was simply clamping the element size after doing the sizing calculations once, but this leads to an incorrect aspect ratio. Signed-off-by: valadaptive <valadaptive@protonmail.com>
* flex: handle ‘align-self: [ first | last ]? && baseline’ (#32787)Delan Azabani2024-07-182-14/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Convert layout to use Gecko's alignment style representation (#32790)Martin Robinson2024-07-171-68/+87
| | | | Signed-off-by: Nico Burns <nico@nicoburns.com> Co-authored-by: Nico Burns <nico@nicoburns.com>
* layout: Properly handle min/max cross container size (#32785)Delan Azabani2024-07-162-20/+41
| | | | | Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Remove unused implementation (#32754)atbrakhi2024-07-101-13/+0
| | | Signed-off-by: atbrakhi <atbrakhi@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-083-4/+13
| | | | | | | | | | | | | | | | | | (#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>
* Remove unused ToWebRender implementation (#32729)atbrakhi2024-07-081-25/+1
|
* layout: Improve layout of table captions (#32695)Martin Robinson2024-07-087-205/+222
| | | | | | | | | | | | | | | | - 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-048-54/+45
| | | | `layout_2020` components (#32674)
* layout: Add support for table captions (#32657)Martin Robinson2024-07-039-62/+482
| | | | | | | | | | | | | 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-037-678/+931
| | | | | | | | | | 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-033-5/+4
|
* fix clippy warning (#32667)atbrakhi2024-07-025-14/+8
|
* layout: Make `geom.rs` logical geoemetry types more ergonomic (#32633)Martin Robinson2024-06-2810-102/+80
| | | | | | 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
|
* layout: Enable parallel layout for tables (#32477)Martin Robinson2024-06-261-74/+87
| | | | | | This simply wraps row and column-based layout of table sells in a `par_iter()` unconditionally enabling parallel layout for tables. In the future we can choose to adjust the conditions under which layout is done in parallel.
* Switch replaced layout to app units (#32625)Oriol Brufau2024-06-262-72/+73
|
* Clean up some unused dependencies (#32600)Oriol Brufau2024-06-251-1/+0
|
* Switch flex layout to app units (#32599)Oriol Brufau2024-06-253-193/+193
|
* 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-2117-283/+274
|
* layout: Simplify `Contents` a little (#32487)Martin Robinson2024-06-214-39/+32
| | | | | | | 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-205-11/+93
| | | | | | | | | | | | | | | | | | 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-197-18/+14
| | | | | | | | | 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-195-252/+224
| | | | | | | | | | | 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>
* Use workspace definitions for all crates and update to the 2021 edition (#32544)Martin Robinson2024-06-181-5/+5
|
* layout: Linebreak the entire InlineFormattingContext at once (#32483)Martin Robinson2024-06-135-165/+321
| | | | | | | | | | | | | 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>
* Fix table track offsets when there is `visibility: collapse` (#32469)Oriol Brufau2024-06-111-16/+20
| | | | | | | | | | | | | Each non-collapsed track used to increase the offset by the subsequent border spacing. Now they will take care of their preceding spacing instead. This way, if a cell spans two rows, and the second is collapsed, the cell won't be forced to be at least as tall as the border spacing. This matches Gecko and Blink (WebKit lacks `visibility: collapse`). This makes visibility-collapse-border-spacing-001.html fail because we generate outlines in a different way than Blink. Gecko also fails it in a similar (but different) way.
* layout: Take into account `display: table` etc in offset* queries (#32448)Martin Robinson2024-06-103-30/+47
| | | | | | | | | | | | | | | * layout: Take into account `display: table` etc in offset* queries The specification says that for deciding whether an element should be used for offset* queries, a browser should take into account whether the element is a table cell or table. This change makes that happen. Co-authored-by: Oriol Brufau <obrufau@igalia.com> * Only tag HTML elements if they are in the HTML namespace --------- Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Fix and unify 'span' attribute for table columns (#32467)Oriol Brufau2024-06-101-34/+41
| | | | | | | | The attribute was only taken into account on columns that are immediate children of tables, and on column groups. It was ignored on columns within column groups. This patch moves the logic into a helper function that is then called from the three consumers.
* Don't shrink table columns when handling cells with greater spanning (#32458)Oriol Brufau2024-06-071-2/+2
| | | | | | | | | | | | | For example: ```html <table border="1"> <tr> <td></td> <td></td> </tr> <tr> <td colspan="2"></td> </tr> </table> ``` We should initially size the columns according to the cells in the first row since they have a span of 1. Then we handle the cell in the second row with a span of 2, this should be able to increase the size of the columns, but never decrease them.
* layout: Properly size absolutely positioned tables (#32447)Martin Robinson2024-06-071-1/+13
| | | Co-authored-by: Oriol Brufau <obrufau@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>