aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/display_list
Commit message (Collapse)AuthorAgeFilesLines
* layout: Combine `layout_2020` and `layout_thread_2020` into a crate called ↵Martin Robinson9 days6-0/+4507
| | | | | | | | | | | | | | | | | | `layout` (#36613) Now that legacy layout has been removed, the name `layout_2020` doesn't make much sense any longer, also it's 2025 now for better or worse. The split between the "layout thread" and "layout" also doesn't make as much sense since layout doesn't run on it's own thread. There's a possibility that it will in the future, but that should be something that the user of the crate controls rather than layout iself. This is part of the larger layout interface cleanup and optimization that @Looriool and I are doing. Testing: Covered by existing tests as this is just code movement. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Remove legacy layout (layout 2013) (#35943)Oriol Brufau2025-03-138-5368/+0
| | | | | | We were already not compiling it and not running tests on it by default. So it's simpler to just completely remove it. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* canvas: Do not update ImageKey during canvas layout (#35719)Samson2025-03-121-6/+6
| | | Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-033-7/+7
| | | | | | | | | | | | | * Use 2024 style edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Reformat all code Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* clippy: Fix a couple clippy warnings on macOS (#35703)Martin Robinson2025-02-271-1/+1
| | | | | | The new version of rust has more checks trying to prevent mistakes around order of operations and shifts. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* layout: Implement overflow scroll support for different axes (#35414)Euclid Ye2025-02-143-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * layout: Add AxesScrollSensitivity to enable control of scroll in axis Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * layout_2013: Be compatible with AxesScrollSensitivity Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * layout: update struct AxesScrollSensitivity to euclid::Vector2D Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * display_list: implement From<Overflow> for ScrollSensitivity Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * layout: simplify and reuse scroll related logic Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * layout_2013: simplify and reuse scroll related logic Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * layout, layout_2013: revert AxesScrollSensitivity to pair struct Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * layout: Reimport ComputedOverflow as #35103 depends on it Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * layout: Add AxesOverflow to replace PhysicalVec Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * layout: implement scroll of viewport for different axes Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * layout: explicitly handle overflow match Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> * Update components/shared/webrender/Cargo.toml Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> --------- Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* deps: Upgrade to `webrender@0.66` (#35325)Martin Robinson2025-02-071-0/+1
| | | | | | | | | In addition to some small API changes, this downstream version of WebRender no longer depends on a very old version of time. This is the last step toward removing the dependency on `time0.1`. The review for this commit should also include: https://github.com/servo/webrender/commit/9f552bebab81a73e62068c42d94be2f9c0586ce4 Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Upgrade Stylo to 2025-02-03 (#35289)Oriol Brufau2025-02-051-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | * Upgrade Stylo to 2025-02-03 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Fixup for https://phabricator.services.mozilla.com/D233218 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Fixup for https://phabricator.services.mozilla.com/D233758 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Fixup for https://phabricator.services.mozilla.com/D231255 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Update test expectations Signed-off-by: Oriol Brufau <obrufau@igalia.com> --------- Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Let `resolve_color()` take its parameter by reference (#35247)Oriol Brufau2025-01-312-13/+10
| | | | | | | | Bumps Stylo to https://github.com/servo/stylo/pull/116 This way the callers don't have to clone it if they don't have ownership or want to use the value later. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* config: Remove legacy-layout and unused `Preferences` and `Opts` (#34994)Martin Robinson2025-01-141-235/+4
| | | | | | There are some preferences and options that are only used by legacy layout or not used at all. This PR removes them. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* script: Manage `<iframe>` sizes in `Window` (#34643)Martin Robinson2024-12-161-10/+18
| | | | | | | | Manage `<iframe>` size updates in `Window`. In addition to removing duplicated code, this will allow setting `<iframe>` sizes synchronously on child `Pipeline`s of the same origin in the script process in a followup change. The goal is remove flakiness from `<iframe>` sizing. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Use `webrender_api::units::DevicePixel` rather than ↵Nico Burns2024-11-251-2/+7
| | | | | | | | | | | | | | | `style_traits::DevicePixel` unless interfacing with Stylo (#34353) * Use webrender_api::units::DevicePixel rather than style_traits::DevicePixel unless interfacing with Stylo Signed-off-by: Nico Burns <nico@nicoburns.com> * Fix OpenHarmony build Signed-off-by: Nico Burns <nico@nicoburns.com> --------- Signed-off-by: Nico Burns <nico@nicoburns.com>
* Improve how intrinsic sizes work for videos (#31746)eri2024-10-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * feat: patch for video layout sizes added rebase from main 2024/10/05 Co-authored-by: Josh Matthews <josh@joshmatthews.net> Signed-off-by: eri <epazos@igalia.com> * feat: take width and height parameters if provided Signed-off-by: eri <epazos@igalia.com> * chore: tidy the code and update test expectations Signed-off-by: eri <epazos@igalia.com> * feat: handle removing poster Signed-off-by: eri <epazos@igalia.com> * chore: update test expectations and remove debug code Signed-off-by: eri <epazos@igalia.com> * fix: issues after rebasing to main Signed-off-by: eri <epazos@igalia.com> * feat: pass src remove test and tidy Signed-off-by: eri <epazos@igalia.com> * chore: clippy fixes Signed-off-by: eri <epazos@igalia.com> * chore: update passing test expectations Signed-off-by: eri <epazos@igalia.com> * fix object-position-svg test Signed-off-by: eri <epazos@igalia.com> * fix unintentional override of video size and resize events Signed-off-by: eri <epazos@igalia.com> * change how resize events are sent to better match the spec Signed-off-by: eri <epazos@igalia.com> * simplify poster mutation handling Co-authored-by: Oriol Brufau <obrufau@igalia.com> Signed-off-by: eri <eri@inventati.org> * improved handling of intrinsic sizes - differentiate between natural size and css size - presentational attributes - fallback ratio for video element - handle more cases where the src/poster are added/removed - aspect ratio hints Signed-off-by: eri <epazos@igalia.com> * update test expectations Signed-off-by: eri <epazos@igalia.com> * fix cleaning current frame Signed-off-by: eri <epazos@igalia.com> * update test expectations Signed-off-by: eri <epazos@igalia.com> * Apply suggestions from code review Co-authored-by: Oriol Brufau <obrufau@igalia.com> Signed-off-by: eri <eri@inventati.org> * More code review suggestions Signed-off-by: eri <epazos@igalia.com> * Prevent aspect-ratio:auto from pulling the ratio from the default object size As resolved in https://github.com/w3c/csswg-drafts/issues/7524#issuecomment-1204462924 Signed-off-by: Oriol Brufau <obrufau@igalia.com> --------- Signed-off-by: eri <epazos@igalia.com> Signed-off-by: eri <eri@inventati.org> Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* layout: Add support for `mix-blend-mode: plus-lighter` (#34057)Martin Robinson2024-10-291-0/+1
| | | | | This just requires translating the style value into a WebRender value. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Add `HTMLCanvasDataSource::Empty` that represent transparent black instead ↵Samson2024-09-221-13/+11
| | | | | | | | | | | | | | | of `HTMLCanvasDataSource::Image(None)` (#33519) * `HTMLCanvasDataSource::Empty` that represent transparent black instead of Image(None) Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Fix warning from 3a0d27b2312c6396e85178615290ac2ec3592ce1 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* fix many clippy warnings (#33510)Gae242024-09-211-9/+9
| | | Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
* Replace .map_or(false with Option::is_some_and (#33468)Simon Wülker2024-09-161-13/+17
| | | Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Update stylo for latest changes. (#33079)Josh Matthews2024-08-161-1/+1
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* legacy-layout: Fix display list building after WebRender upgrade (#33073)Martin Robinson2024-08-161-25/+87
| | | | | | | | The most recent version of WebRender tracks stacking context offsets in a different way, which broke legacy layout. It's easier just to track the stacking context offset in Servo and apply them to the items manually like we do in non-legacy layout. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Fix warnings after latest rust upgrade (#33043)Martin Robinson2024-08-141-8/+1
| | | | | | | This fixes various unused code warnings after the recent rust upgrade. Some of the dead code is maintained, as it is quite likely that it will be used in future changes. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* deps: Upgrade to WebRender 0.65 (#32930)Martin Robinson2024-08-052-0/+2
| | | Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* clippy: Fix warnings in `shared` and `config`, `fonts`, `layout`, and ↵Martin Robinson2024-07-041-1/+1
| | | | `layout_2020` components (#32674)
* Rename `gfx` to `fonts` (#32556)Martin Robinson2024-06-191-1/+1
| | | | | | | | | 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: Add support for `white-space-collapse: break-spaces` (#32388)Martin Robinson2024-05-301-1/+1
| | | | | | | | | | | | | | 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>
* compositor: Move WebRender-ish messages and types to `webrender_traits` (#32315)Mukilan Thiyagarajan2024-05-203-6/+6
| | | | | | | | | | | | | | | | | | | | * Move WebRender related types to `webrender_traits` This refactor moves several WebRender related types from `compositing_traits`, `script_traits` and `net_traits` crates to the `webrender_traits` crate. This change also moves the `Image` type and associated function out of `net_traits` and into the `pixels` crate. Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * Move `script_traits::WebrenderIpcSender` to `webrender_traits::WebRenderScriptApi` --------- Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Move non-gfx things out of `gfx_traits` and create a `base` crate (#32296)Martin Robinson2024-05-174-7/+33
| | | | | | | | | | | | | | | | | | | | | | | For a long time, `gfx_traits` has held a lot of things unrelated to graphics and also unrelated to the `gfx` crate (which is mostly about fonts). This is a cleanup which does a few things: 1. Move non `gfx` crate things out of `gfx_traits`. This is important in order to prevent dependency cycles with a different integration between layout, script, and fonts. 2. Rename the `msg` crate to `base`. It didn't really contain anything to do with messages and instead mostly holds ids, which are used across many different crates in Servo. This new crate will hold the *rare* data types that are widely used. Details: - All BackgroundHangMonitor-related things from base to a new `background_hang_monitor_api` crate. - Moved `TraversalDirection` to `script_traits` - Moved `Epoch`-related things from `gfx_traits` to `base`. - Moved `PrintTree` to base. This should be widely useful in Servo. - Moved `WebrenderApi` from `base` to `webrender_traits` and renamed it to `WebRenderFontApi`.
* chore: Clean up use of `gfx` and `constellation` types (#31981)Martin Robinson2024-04-092-5/+4
| | | | | | | | | | | | This change contains three semi-related clean ups: 1. the `to_webrender()` and `from_webrender()` functions on Pipeline are turned into more-idiomatic `From` and `Into` implementations. 2. `combine_id_with_fragment_type` now returns a `u64` as that is what is expected for all callers and not a `usize`. 3. The `query_scroll_id` query is removed entirely. The `ExternalScrollId` that this queries is easily generated directly from the node's opaque id. Querying into layout isn't necessary at all.
* clippy: Allow `too_many_arguments` for existing functions (#31974)eri2024-04-023-6/+4
| | | | | * Allow `too_many_arguments` for existing functions * fix: Surround ASCII with code block in rustdoc
* Update Stylo to 2023-10-16 (#31932)Oriol Brufau2024-03-301-4/+0
| | | | | | | | | | | | | | | | | | | | | | | * Update Stylo to 2023-10-16 * Fixup for https://phabricator.services.mozilla.com/D185154 * Fixup for https://phabricator.services.mozilla.com/D188216 * Fixup for https://phabricator.services.mozilla.com/D185677 * Fixup for https://phabricator.services.mozilla.com/D188566 * Fixup for https://phabricator.services.mozilla.com/D188727 * Fixup for https://phabricator.services.mozilla.com/D189475 * Fixup for https://phabricator.services.mozilla.com/D189521 * Fixup for https://phabricator.services.mozilla.com/D188812 * Fixup for https://phabricator.services.mozilla.com/D189484 * Update test expectations
* Update Stylo to 2023-09-01 (#31609)Oriol Brufau2024-03-182-11/+15
| | | | | | | | | | | | | | | | | | | | | * 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
* dependencies: Upgrade to WebRender 0.64 (#31486)Martin Robinson2024-03-144-80/+130
| | | | | | | | | 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: Propagate overflow values from `<body>` to root element (#31618)Martin Robinson2024-03-131-1/+7
| | | | | | | 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: Enable rendering of `conical-gradient` and ↵Martin Robinson2024-03-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | `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.
* clippy: Fix warnings in `components/layout` (#31612)eri2024-03-113-12/+18
| | | | | * clippy: fix warnings in components/layout * fix: formatting
* clippy: fix warnings in various modules in components (#31568)eri2024-03-081-2/+2
| | | | | | | | | * clippy: fix warnings in various modules in components * fix: unit tests * fix: build on android * fix: all samplers use new_boxed
* Update Stylo to 2023-07-23 (#31437)Oriol Brufau2024-02-292-4/+25
| | | | | | | | | | | | | | | | | | | * Update Stylo to 2023-07-23 * to_shmem should be local when working with Stylo * Fixup for https://phabricator.services.mozilla.com/D180769 * Fixup for https://phabricator.services.mozilla.com/D181125 * Fixup for https://phabricator.services.mozilla.com/D181162 * Fixup for https://phabricator.services.mozilla.com/D181798 * Fixup for https://phabricator.services.mozilla.com/D182514 * Fixup for https://phabricator.services.mozilla.com/D182539 * Update test expectations
* style: Remove dependency on servo_url (#31358)Martin Robinson2024-02-161-2/+2
| | | | | In order for stylo to be a separate crate, it needs to depend on less things from Servo. This change makes it so that stylo no longer depends on servo_url.
* Lint layout_2013 with clippy (#31221)Oriol Brufau2024-01-303-41/+38
| | | | | | | | | * Lint layout_2013 with clippy CARGO_BUILD_RUSTC=rustc cargo clippy --fix -p layout_2013 --broken-code * ./mach fmt * Cosmetic adjustments
* rustdoc: Fix many rustdoc errors (#31147)Martin Robinson2024-01-222-2/+2
| | | | This fixes many rustdoc errors that occur due to raw URLs in rustdoc comments as well as unescaped Rust code that should be in backticks.
* layout: Make all word separators justification opportunities (#30866)Martin Robinson2023-12-211-1/+1
| | | | | This change adapts both layout and legacy layout to the specification which gives a list of word separators to use as justification opportunities.
* Add initial support for sticky positioning for non-legacy layout (#30686)Martin Robinson2023-11-291-5/+4
| | | | | | | | | | * Add initial support for sticky positioning for non-legacy layout Many tests still fail for a variety of reasons. One of the primary ones is that CSSOM currently does not return correct values for elements positioned by sticky nodes. This requires changes to WebRender to work properly. * Fix an assertion failure in the legacy layout sticky code
* Further changes required by ServoOriol Brufau2023-11-241-1/+1
|
* Further changes required by ServoOriol Brufau2023-11-212-13/+18
|
* Fix transform assertion failures in Layout 2013 and Layout 2020 (#30713)Martin Robinson2023-11-131-2/+2
| | | | | | | Layout asserts that it never creates stacking contexts that have a zero scale, yet it doesn't prevent the creation of those stacking contexts. This change stops their creation at an earlier stage. Fixes #30118.
* Only access hit test items for the current epoch in the compositor (#30491)Martin Robinson2023-10-041-1/+2
| | | | | | | | | | | | | | | When display lists update quickly, a hit test result might be returned for a previous display list / list of hit test items. When that happens, ignore the hit test result. This fixes a crash, but there might be situations where we can do something better, such as wait for display list processing to finish before performing the hit test. A future change might do this for events like mouse clicks and touch events that should never be thrown away. Ultimately, the best thing is likely moving hit testing back to layout or script so a valid hit test can always be performed against the current DOM. Fixes #29796.
* Implement support for the `drop-shadow` filter (#30439)Ennui Langeweile2023-10-043-7/+24
| | | | | | | | | | | | | | | | | | * Implement support for `drop-shadow` * Clean up remnant from early attempts * Fix misleading comments on GenericSimpleShadow If Servo-specific `style` changes will need to be upstreamed anyway, I might as well fix a thing that had thrown me off! * Revert "Fix misleading comments on GenericSimpleShadow" This reverts commit cdc810b826ac082041adc212c24649ee3b86ca0a. * Clean up an import * Update test expectations * Fix missing expectation on Layout 2013
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-117-50/+50
| | | | | * strict imports formatting * Reformat all imports
* Upgrade WebRender to e491e1ae637b2eed1e7195855d88357e5eb3ddf9 (#30323)Martin Robinson2023-09-104-29/+54
| | | | | | | | | | | | | | | | | | * Upgrade vendored version of WebRender * Patch WebRender: upgrade version of gleam * Restore hit testing implementation * Fix WebRender warnings * Adapt Servo to new WebRender * Update results * Add a workaround for #30313 This slightly expands text boundaries in order to take into account the fact that layout isn't measuring glyph boundaries.
* Layout 2013: Don't make gradient display items for zero-sized gradients (#30321)Martin Robinson2023-09-092-7/+22
| | | | | | Before WebRender would ignore these, but newer version of WebRender have issues with them. This change simply prevents legacy layout from creating display items for these types of gradients. This is already the behavior of non-legacy layout.
* remove `extern crate` (#30311)Samson2023-09-083-0/+4
| | | | | | | | | | | * remove extern crate * Update components/script_plugins/lib.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>