aboutsummaryrefslogtreecommitdiffstats
path: root/components/shared/canvas
Commit message (Collapse)AuthorAgeFilesLines
* Introduce snapshot concept of canvas (#36119)sagudev18 hours3-5/+12
| | | | | | | | | | | | | | | | | | Each canvas context returns snapshot instead of just raw bytes. This allows as to hold off conversions (BGRA <-> RGBA, (un)premultiply) to when/if they are actually needed. For example when loading snapshot into webgl we can load both RGBA and BGRA so no conversion is really needed. Currently whole thing is designed to be able to be extend on https://github.com/servo/ipc-channel/pull/356, to make less copies. Hence some commented out code. Fixes #35759 There are tests for these changes in WPT --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* canvas: Implement line dash setters and getters (#36257)Steven Novaryo2025-04-011-0/+2
| | | | | | | | | | | Implement `setLineDash`, `getLineDash`, and `lineDashOffset` from `CanvasPathDrawingStyles` mixin, according to the spec https://html.spec.whatwg.org/multipage/canvas.html#canvaspathdrawingstyles. Testing: Existing WPT. --------- Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
* Add `Path2D` (#35783)Lukas Lihotzki2025-03-261-1/+58
| | | Signed-off-by: Lukas Lihotzki <lukas@lihotzki.de>
* canvas: Update the image as part of update the rendering (#35996)sagudev2025-03-251-5/+0
| | | | | | | | | | | | | | | | | | | | | | | * Create `update_rendering` in `CanvasState` instead of manually updating in layout Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Mark as dirty and do flushes Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * fixup rebase Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Update components/script/dom/htmlcanvaselement.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Cleanup Stylo dependencies (#36046)Oriol Brufau2025-03-191-2/+2
| | | | | | | | | Now that Stylo considers `servo` as the default feature, Servo doesn't need to specify `features = ["servo"]`. Also use the same crate names as Stylo, rather than renaming them with `package`. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* canvas: Do not update ImageKey during canvas layout (#35719)Samson2025-03-122-8/+3
| | | Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Use surfman with glow bindings (take II) (#35422)Samson2025-02-131-11/+5
| | | | | | | | | | | | | | | * Reapply "Use surfman with glow bindings (#34328)" (#35402) This reverts commit 0fed99590a9377d8be071e457ecb1b3284f9ef27. Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * update surfman Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Revert "Use surfman with glow bindings (#34328)" (#35402)Samson2025-02-101-5/+11
| | | | | This reverts commit 503bb10c5b1fafe01ebfb6b320902be2e8671c69. Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Use surfman with glow bindings (#34328)Samson2025-02-051-11/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use glowing surfman Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Port https://github.com/servo/webxr/pull/255 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * fixups rebase Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * fmt Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Update surfman Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Fix stale TODO Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* prefs: Move some `DebugOptions` to `Preferences` and clean up (#34998)Martin Robinson2025-01-171-1/+0
| | | | | | | | | - Move options configuring antialiasing and WebRender shader precache to the `Preferences` to group them with other related WebRender and DOM settings. - Remove the option to disable antialiasing for canvases. This was unused. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* api: Flatten and simplify Servo preferences (#34966)Martin Robinson2025-01-141-1/+1
| | | | | | | | | | | | | | | | | | | Flatten and simplify Servo's preferences code. In addition, have both preferences and options passed in as arguments to `Servo::new()` and make sure not to use the globally set preferences in `servoshell` (as much as possible now). Instead of a complex procedural macro to generate preferences, just expose a very simple derive macro that adds string based getters and setters. - All command-line parsing is moved to servoshell. - There is no longer the concept of a missing preference. - Preferences no longer have to be part of the resources bundle because they now have reasonable default values. - servoshell specific preferences are no longer part of the preferences exposed by the Servo API. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Add initial support for WebGL 2 BlitFramebuffer (#26389)Josh Matthews2025-01-061-0/+1
| | | | | | Add initial support for the WebGL2 BlitFramebuffer call. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Istvan <istvan.miklos@h-lab.eu>
* Replace `sparkle` with `glow` in `components/canvas` (#33918)Samson2024-11-201-11/+39
| | | | | | | | | | | | | * Replace sparkle with glow in components/canvas Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Replace safe_gl with #34300 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Replace sparkle with glow in shared/canvas (#34292)Samson2024-11-192-23/+17
| | | | | Also updates glow to 0.16 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Use `ROUTER::add_typed_route` instead of `ROUTER::add_route` everywhere (#33866)Simon Wülker2024-10-181-1/+1
| | | | | | | | | | | | | * Use ROUTER::add_typed_route where possible Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update webxr, media and ipc-channel Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Add `rust-version` to all `Cargo.toml` files (#33483)Martin Robinson2024-09-171-0/+1
| | | | | | | This is another step preparing for building Servo without `mach`. Fixes #33430. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Trace more functions by adding perfetto tracing events (#33417)atbrakhi2024-09-131-1/+1
| | | Signed-off-by: atbrakhi <atbrakhi@igalia.com>
* Replace the lazy_static crate with `std::sync::LazyLock` in ↵Hayashi Mikihiro2024-08-151-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | components/shared (#33060) * replace in pub_domains.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace in embedder/resources.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace in base/id.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * replace in net/lib.rs Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * remove lazy_static from components/shared Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> --------- Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com>
* Fix panic in Webrender during shutdown (#32897)Taym Haddadi2024-08-061-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix panic in webrender during shutdown Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Pass webgl_threads_sender to WebGLThreads::exit Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * follow the naming convention and use sender instead of webgl_threads_sender Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Avoid deadlock when webgl_threads is None Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Use tuple matching for webgl_threads and webgl_threads_receiver Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> * Remove unused _webgl_threads_sender Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
* Remove the WebXR dependency on ancient `time@0.1` crate (#32862)Martin Robinson2024-07-261-2/+0
| | | | | | | | | | | `webxr` depends on a very old verison of `time`, which allowed serializing monotonic clock output. This isn't possible on all platforms, so newer versions of `time` do not allow this. In order to stop using the old 0.1 versions of `time` we have to stop relying on times passed from `webxr` to Servo. This change does that, at the cost of removing the XR profiling feature. It has to be rewritten in another way in the `webxr` crate. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* enhance: Implement `CanvasRenderingContext2D.measureText` (#32704)Chocolate Pie2024-07-171-0/+17
| | | | Signed-off-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Use workspace definitions for all crates and update to the 2021 edition (#32544)Martin Robinson2024-06-181-5/+5
|
* Move webgl_channel into base crate (#32339)Ngo Iok Ui (Wu Yu Wei)2024-05-246-244/+32
| | | | | | | | | * Move webgl_channel into a shared crate * Add license header * Rename channle types and simplify module * Move module to base
* Upgrade Stylo to 2024-03-01 (#32089)Oriol Brufau2024-04-161-4/+4
| | | | | | | * Upgrade Stylo to 2024-03-01 * Fixup for https://bugzil.la/1882754 * Update test expectations
* Update Stylo to 2023-10-16 (#31932)Oriol Brufau2024-03-302-2/+1
| | | | | | | | | | | | | | | | | | | | | | | * 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
* clippy: fix `result_unit_err` warnings (#31791)eri2024-03-211-12/+20
| | | | | | | | | | | | | | | | | * clippy: fix `result_unit_err` warnings * feat: fix result warnings in script * doc: document `generate_key` return type Co-authored-by: Martin Robinson <mrobinson@igalia.com> * feat: add back result to RangeRequestBounds::get_final Co-authored-by: Martin Robinson <mrobinson@igalia.com> --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Update Stylo to 2023-09-01 (#31609)Oriol Brufau2024-03-181-4/+4
| | | | | | | | | | | | | | | | | | | | | * 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
* rustdoc: Add some basic Safety sections to unsafe functions (#31639)Martin Robinson2024-03-131-0/+5
|
* clippy: fix warnings in components/shared (#31565)eri2024-03-082-49/+31
| | | | | | | * clippy: fix some warnings in components/shared * fix: unit tests * fix: review comments
* Move Stylo to its own repo (#31350)Delan Azabani2024-02-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove packages that were moved to external repo * Add workspace dependencies pointing to 2023-06-14 branch * Fix servo-tidy.toml errors * Update commit to include #31346 * Update commit to include servo/stylo#2 * Move css-properties.json lookup to target/doc/stylo * Remove dependency on vendored mako in favour of pypi dependency This also removes etc/ci/generate_workflow.py, which has been unused since at least 9e71bd6a7010d6e5723831696ae0ebe26b47682f. * Add temporary code to debug Windows test failures * Fix failures on Windows due to custom target dir * Update commit to include servo/stylo#3 * Fix license in tests/unit/style/build.rs * Document how to build with local Stylo in Cargo.toml
* canvas2d: Implement `.reset()` (#31258)Smitty2024-02-051-1/+1
| | | | | | | | | | | * Implement Canvas2D reset * Update WPT tests * Apply suggestions from code review --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* rustdoc: Fix many rustdoc errors (#31147)Martin Robinson2024-01-221-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.
* Move `*_traits` and other shared types to `shared`Martin Robinson2023-11-037-0/+2207
This is the start of the organization of types that are in their own crates in order to break dependency cycles between other crates. The idea here is that putting these packages into their own directory is the first step toward cleaning them up. They have grown organically and it is difficult to explain to new folks where to put new shared types. Many of these crates contain more than traits or don't contain traits at all. Notably, `script_traits` isn't touched because it is vendored from Gecko. Eventually this will move to `third_party`.