aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020
Commit message (Collapse)AuthorAgeFilesLines
...
* layout: Remove LayoutRPC and query layout via the `Layout` trait (#31937)Martin Robinson2024-03-291-172/+20
| | | | | | | | | | | | | | | | | Instead of the tricky `LayoutRPC` interface, query layout using the `Layout` trait. This means that now queries will requires calling layout and then running the query. During layout an enum is used to indicate what kind of layout is necessary. This change also removes the mutex-locked `rw_data` from both layout threads. It's no longer necessary since layout runs synchronously. The one downside here is that for resolved style queries, we now have to create two StyleContexts. One for layout and one for the query itself. The creation of this context should not be very expensive though. `LayoutRPC` used to be necessary because layout used to run asynchronously from script, but that no longer happens. With this change, it becomes possible to safely pass nodes to layout from script -- a cleanup that can happen in a followup change.
* Obey `white-space: pre-wrap` when intrinsically sizing an IFC (#31930)Oriol Brufau2024-03-291-10/+20
| | | It was being treated like `pre`, but it allows wrapping lines.
* layout: Use `Au` in `ResolvedMargins` and `CollapsedMargin` (#31848)Ekta Siwach2024-03-284-70/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * change ResolvedMargins to use Au instead of length * made suggested changes removed whitespace changes made suggested changes * Update components/layout_2020/flexbox/layout.rs Co-authored-by: Oriol Brufau <obrufau@igalia.com> * Update components/layout_2020/flow/mod.rs Co-authored-by: Oriol Brufau <obrufau@igalia.com> * fixed errors fixed errors fixed formatting fixed errors * modified changes made suggested changes * Update components/layout_2020/fragment_tree/fragment.rs Co-authored-by: Oriol Brufau <obrufau@igalia.com> updated components/layout_2020/fragment_tree/fragment.rs * Update components/layout_2020/flow/mod.rs Co-authored-by: Oriol Brufau <obrufau@igalia.com> * Update components/layout_2020/flow/mod.rs Co-authored-by: Oriol Brufau <obrufau@igalia.com> * updated changes updated changes * unified all the suggested changes here * fixed formatting * reverted unnecessary changes * fixed unnecessary warnings --------- Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Ignore spaces before atomic inline for the min-content size (#31896)Oriol Brufau2024-03-271-1/+4
| | | | | | | | | | | | | | | * Ignore spaces before atomic inline for the min-content size For the min-content size we should wrap lines wherever is possible, so wrappable spaces shouldn't increase the length of the line, they will just be removed or hang at the end of the line. * Add a clarifying comment Co-authored-by: Martin Robinson <mrobinson@igalia.com> --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* layout: Allow transforming inline replaced elements (#31833)Martin Robinson2024-03-277-33/+63
| | | | | | | | | | This requires passing through information about whether or not the element in question is replaced when checking to see if it's transformable and transitively all functions that make decisions about containing blocks. A new FragmentFlag is added to help track this -- it will be set on both the replaced items BoxFragment container as well as the Fragment for the replaced item itself. Fixes #31806.
* Fix table with rows but no column (#31862)Oriol Brufau2024-03-261-7/+21
| | | | | | | | | | | | | * Fix table with rows but no column We weren't generating any fragment for the rows, which meant that JS APIs like clientWidth would be 0, and also outlines weren't painted. This aligns Servo with Blink and WebKit. Gecko is broken, it distributes twice the table height among the rows. * Feedback * Avoid conflict with #31874
* Pick the first or last baseline as appropriate (#31705)Oriol Brufau2024-03-251-4/+17
| | | | | | | The old logic was always picking the last baseline, but this should only happen for inline-blocks. Since replaced elements and flex containers aren't currently setting their baselines, this is only an improvement for inline-tables.
* Don't update row baseline if cell is empty (#31831)Oriol Brufau2024-03-251-1/+7
| | | | | | | | Gecko, Blink and WebKit agree that the if a row only has empty cells, its baseline should be at the bottom, not at the top. There isn't interoperability when the cells are just empty-ish, so this patch takes the simplest approach, aligning with Blink: any out-of-flow or in-flow content other than collapsed whitespace counts as not empty.
* remove unused code (#31826)atbrakhi2024-03-231-12/+0
|
* layout: use `Au` in `BoxFragment` (#31794)atbrakhi2024-03-2213-100/+98
| | | | | * use au in BoxFragement * review fix
* layout: Take into account `text-indent` for justification (#31777)Martin Robinson2024-03-211-1/+6
| | | | | | This change makes it so that when calculating the space added between words for justification, text-indent is taken into account. Fixes #31775.
* Don't trim leading whitespace of anonymous table cells (#31803)Oriol Brufau2024-03-211-8/+19
| | | | | | A sequence of whitespace shouldn't generate an anonymous table row/cell, but we can't just throw away the leading whitespace, because afterwards we may encounter some other content, and then the leading whitespace should appear in the cell (noticeable with e.g. `white-space: pre`).
* rustdoc: fix warnings in `components/layout_2020/table` (#31738)Azhar Ismagulova2024-03-191-0/+1
| | | | | * fix: fixed rustdoc warnings caused by private intra-doc links * fix: fixed private link warning by allowing private intra doc links
* gfx: Derive `line-through` metrics for fonts on MacOS (#31756)Martin Robinson2024-03-191-1/+0
| | | | | | | | | | | | | There is now platform-specific way to get metrics for `line-through` on MacOS and currently striking through simply does not work. The correct approach here is likely to first search for these metrics in font tables and then falling back to deriving them. Searching the font tables is a larger change, so this change adds the fallback mechanism first. This at least makes sure that strike through renders at all on Mac. In a followup change we can add support for getting metrics via HarfBuzz in a platform-independent way, which is what Gecko does. Fixes #942.
* layout: Enable `text-shadow` (#31734)Martin Robinson2024-03-191-1/+23
| | | | `text-shadow` is enabled for legacy layout, so this just extends support to the modern layout system.
* rustdoc: Correct unresolved link to `handle_cell. (#31708)Aarya Khandelwal2024-03-191-1/+1
|
* rustdoc: Fix some typos in `components/layout_2020/table/mod.rs` (#31644)Ekta Siwach2024-03-191-3/+3
| | | Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Update Stylo to 2023-09-01 (#31609)Oriol Brufau2024-03-181-22/+27
| | | | | | | | | | | | | | | | | | | | | * Update Stylo to 2023-09-01 * Fixup for https://phabricator.services.mozilla.com/D184929 * Fixup for https://phabricator.services.mozilla.com/D184526 * Fixup for https://phabricator.services.mozilla.com/D184525 * Fixup for https://phabricator.services.mozilla.com/D185154 * Fixup for https://phabricator.services.mozilla.com/D184685 * Fixup for https://phabricator.services.mozilla.com/D185916 * Fixup for https://phabricator.services.mozilla.com/D185492 * Fixup for https://phabricator.services.mozilla.com/D186626 * Update test expectations
* clippy: Fix several warnings (#31710)RustAndMetal2024-03-186-16/+11
| | | Signed-off-by: RustAndMetal <111676747+RustAndMetal@users.noreply.github.com>
* rustdoc: Fix two warnings in `components/layout_2020` (#31712)Rhea-Eve2024-03-182-3/+4
| | | | | | | | | | | | | | | | | | * Fix BoxFragment reference. Signed-off-by: Rhea Karty <rheakarty@gmail.com> * Fix reference to InlineFormattingContext. Signed-off-by: Rhea Karty <rheakarty@gmail.com> * Rewrap lines to avoid long length * Remove trailing whitesapce --------- Signed-off-by: Rhea Karty <rheakarty@gmail.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Don't null out the baselines of anonymous tables (#31704)Oriol Brufau2024-03-151-5/+0
|
* layout: Add basic support for `getClientRects()` queries (#31696)Martin Robinson2024-03-153-26/+43
| | | | | | This adds basic support for `getClientRects()` by sharing code with the implementation of `getBoundingClientRect()`. In addition to sharing code, it also shares all of the bugs. Primarily, scrolilng positions are not taken into account when return boundary rectangles.
* rustdoc: Fix errors in `components` and `ports` (#31654)Tumuhairwe2024-03-152-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Fixed warnings in components/gfx/text/shaping/harfbuzz-rs components/layout_2020/fragment_tree ports/servoshell/minibrowser.rs * Fixed warnings in components/gfx/text/shaping/harfbuzz-rs components/layout_2020/fragment_tree ports/servoshell/minibrowser.rs. * Update minibrowser.rs Returned "if" back to "iff" * Update minibrowser.rs Changed ```BrowserManager``` to ```WebViewManager``` * Update fragment.rs Changed ```[SequentialLayoutState]``` to ```[crate::flow::float::SequentialLayoutState]``` * Update fragment.rs Balanced the length of paragraph lines in fragment.rs * Fix tidy errors --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Allow pre-wrap whitespace to hang at the end of the line (#31681)Oriol Brufau2024-03-151-18/+54
| | | | | * Allow pre-wrap whitespace to hang at the end of the line * Use bitflags
* Obey white-space when intrinsically sizing an IFC (#31660)Oriol Brufau2024-03-152-27/+28
| | | | | | | | | | | | | | | | | The old logic was assuming that all whitespace was a break opportunity, and that no newlines would be preserved. Note that text shaping considers the advance of a newline to be the same as a space. This was problematic because if we have a segment with a preserved space and newline, only the advance of the space should contrinute to the size of the block container. Therefore, I'm changing the breaker logic in other to have newline characters in their own segment. Then glyph_run_is_whitespace_ending_with_preserved_newline can just be renamed to glyph_run_is_preserved_newline. This patch is still not perfect because it doesn't check allow_wrap(), so `nowrap` is treated like `normal`, and `pre-wrap` like `pre`.
* dependencies: Upgrade to WebRender 0.64 (#31486)Martin Robinson2024-03-146-99/+126
| | | | | | | | | This brings the version of WebRender used in Servo up-to-date with Gecko upstream. The big change here is that HiDPI is no longer handled via WebRender. Instead this happens via a scale applied to the root layer in the compositor. In addition to this change, various changes are made to Servo to adapt to the new WebRender API. Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* layout: Properly parent table-row and table-row-group (#31619)Martin Robinson2024-03-145-131/+417
| | | | | | | | Put table cell content fragments into a hieararchy of fragments that include their table row and table row group fragments. This ensures that things like relative positioning and transforms set on rows and row groups properly affect cells and cell content. Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Allow finishing anonymous inline-table at the end of inline elements (#31650)Oriol Brufau2024-03-141-0/+2
| | | This avoids inserting it outside of its parent.
* layout: IFCs should not always be marked as containing floats (#31641)Martin Robinson2024-03-142-2/+4
| | | | | | | Marking all IFCs as containing floats shouldn't change layout results, but does prevent parallel layout in some cases. This change fixes an issue where we were marking all IFCs as containing floats. Fixes #31540.
* End ongoing IFC when inserting anonymous block-level table (#31606)Oriol Brufau2024-03-131-0/+1
| | | | So that the table appears after preceding inline-level contents. Fixes #31603.
* rustdoc: Fix warnings in `components/layout_2020` (#31647)Aarya Khandelwal2024-03-131-2/+2
| | | | | * Added a : to make it a clickable link * changed block_offset_of_parent to parent_offset , to make it a clickable link.
* rustdoc: Fix warnings in `components/layout_2020` (#31640)Aarya Khandelwal2024-03-131-3/+3
| | | | | * Changed LineItems to LineItem to make it a clickable link * No variant named Anonymous is present in Fragment.
* Fix vertical alignment at the root of an IFC (#31636)Oriol Brufau2024-03-133-56/+57
| | | | | | | | | | | | | | At the root of an inline formatting context, we used its vertical-align in order to compute the strut. That was wrong, since vertical-align on a block container shouldn't affect the contents, it should only affect the alignment of the block container (if it's inline-level) within the parent IFC. This was only working well if the block container was block-level, since effective_vertical_align_for_inline_layout returned `baseline` for block-level boxes. Instead of the outer display type, this patch changes the logic to check whether we are at the root of the IFC.
* layout: Propagate overflow values from `<body>` to root element (#31618)Martin Robinson2024-03-134-5/+72
| | | | | | | The specification gives instructions for how these values should be propagated. The other big changs here is that they aren't applied to the `<body>`. Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* layout: make `margin` in `pbm` use app unit (#31621)atbrakhi2024-03-138-114/+119
| | | | | | | | | | | * make margin in pbm use app unit * Simplification * Consistently resolve inline margins as Au, like block margins --------- Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* rustdoc: Fix StackingContextFragment error (#31625)Oluwatobi Sofela2024-03-121-2/+2
|
* clippy: Fix warnings in `components/layout_2020` (#31611)eri2024-03-1117-69/+59
| | | | | * clippy: fix warnings in components/layout_2020 * fix: review comments
* layout: Enable rendering of `conical-gradient` and ↵Martin Robinson2024-03-111-26/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | `repeating-conical-gradient` (#31597) This also ignores a clippy warning for a new function (and a similar existing one), until this code can be refactored to use temporary Rust strutures to carry display list building state. There are a few new test failures here: - FAIL [expected PASS] /css/css-images/image-set/image-set-conic-gradient-rendering.html - FAIL [expected PASS] /css/css-images/image-set/image-set-repeating-conic-gradient-rendering.html These fail because Servo does not yet support `image-set()`. - FAIL [expected PASS] /css/filter-effects/filter-function/filter-function-conic-gradient.html - FAIL [expected PASS] /css/filter-effects/filter-function/filter-function-repeating-conic-gradient.html These fail because Servo does not support the very early filter effects specification. - FAIL [expected PASS] /html/canvas/element/manual/fill-and-stroke-styles/conic-gradient-rotation.html - FAIL [expected PASS] /html/canvas/element/manual/fill-and-stroke-styles/conic-gradient.html These fail because this change only adds support for CSS conical gradients. Another set of changes will be necessary to support this for Canvas.
* Take spaces into account in the max-content size of an IFC (#31613)Oriol Brufau2024-03-111-11/+9
| | | | | | They were only considered in min-content sizes. Also avoid some pointless conversions from Au to Length. Fixes #31605.
* Align table cell measures in the block axis to Gecko/Blink/WebKit (#31596)Oriol Brufau2024-03-091-19/+5
|
* layout: Do not inherit node and fragment flags in anonymous boxes (#31586)Martin Robinson2024-03-097-38/+73
| | | | | | | This doesn't really have observable behavior right now, as much as I tried to trigger some kind of bug. On the other hand, it's just wrong and is very obvious when you dump the Fragment tree. If you create a `display: table-cell` that is a child of the `<body>` all parts of the anonymous table are flagged as if they are the `<body>` element.
* Fixed unresolved links by appropriately linking to parent (#31588)Wepngong Maureen2024-03-081-2/+2
| | | Signed-off-by: Wepngong Maureen <maureenwepngong@gmail.com>
* Fix rustdoc warnings in `components/layout 2020/positioned.rs` (#31592)Wepngong Maureen2024-03-081-3/+3
| | | | | | | | | | | | | | | | | * fixed typo in PositioningContext Signed-off-by: Wepngong Maureen <maureenwepngong@gmail.com> * fixed unresolved link to unresolved link to adjust_static_position_of_hoisted_fragments function Signed-off-by: Wepngong Maureen <maureenwepngong@gmail.com> * fixed unresolved link to unresolved link to len() function of PositioningContext Signed-off-by: Wepngong Maureen <maureenwepngong@gmail.com> --------- Signed-off-by: Wepngong Maureen <maureenwepngong@gmail.com>
* Fix rustdoc warnings in `components/layout_2020` (#31587)sandeep2024-03-082-3/+3
| | | | | | | | | | | | | | * fix rustdoc warnings in components/layout_2020 Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> * made suggested changes Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> --------- Signed-off-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local> Co-authored-by: Sandeep Pillai <sandeeppillai@Sandeeps-MacBook-Air.local>
* layout: Add documentation about table layout (#31535)Martin Robinson2024-03-082-6/+61
| | | Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Obey table cell's box-sizing (#31536)Oriol Brufau2024-03-081-45/+39
| | | Instead of assuming `box-sizing: content-box`.
* layout: Fix the pseudo for anonymous tables (#31578)Martin Robinson2024-03-081-3/+1
| | | | | | | Anonymous tables should not use legacy pseudos, as the legacy layout engine had them inherit lots of random properites that lead to bad layout in the new layout engine. Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* layout: Add support for box-shadow to Layout 2020 (#31453)Martin Robinson2024-03-072-0/+41
|
* Enable CSS Tables by default (#31470)Oriol Brufau2024-03-071-10/+4
| | | And remove the pref `layout.tables.enabled`.
* layout: Add start of documentation for inline layout (#31519)Martin Robinson2024-03-062-0/+67
| | | Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>