aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/canvasrenderingcontext2d.rs
Commit message (Collapse)AuthorAgeFilesLines
* canvas: Implement line dash setters and getters (#36257)Steven Novaryo2025-04-011-0/+20
| | | | | | | | | | | 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-0/+24
| | | Signed-off-by: Lukas Lihotzki <lukas@lihotzki.de>
* canvas: Update the image as part of update the rendering (#35996)sagudev2025-03-251-6/+11
| | | | | | | | | | | | | | | | | | | | | | | * 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>
* crown: Do not check trait item projections. (#36095)Josh Matthews2025-03-221-1/+0
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Cleanups for future script crate split (#35987)Josh Matthews2025-03-161-1/+1
| | | | | | | | | | | | | | | | | * script: Avoid direct impl blocks on generated dicts and unions. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Remove references to codegen-specific import module. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix tidy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* canvas: Do not update ImageKey during canvas layout (#35719)Samson2025-03-121-25/+12
| | | Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-031-1/+1
| | | | | | | | | | | | | * 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>
* refactor: add CanGc as argument to methods in CanvasRenderingContext2D and ↵Yerkebulan Tulibergenov2025-03-011-12/+7
| | | | | OffscreenCanvasRenderingContext2D (#35732) Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
* Remove `get_ipc_sender` from `OffscreenCanvasRenderingContext2D` (#35625)Samson2025-02-241-4/+0
| | | Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Unify `(Offscreen)CanvasRenderingContext2d` and make ↵Samson2025-02-231-71/+31
| | | | | `PaintRenderingContext2D` standalone (#35619) Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* refactor: propagate CanGc arguments through callers (#35591)Auguste Baum2025-02-231-4/+12
| | | Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
* script: Add `CanvasContext` trait (#35448)Samson2025-02-211-17/+52
| | | | | | | | | | | | | | | | | * trait `CanvasContext` Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * fixup most stuff Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * explain and limit crown `allow(crown::unrooted_must_root)` Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Propagate `CanGc` arguments through callers in constructors (#35541)Auguste Baum2025-02-201-1/+2
| | | Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
* Remove `get_ipc_renderer` from `CanvasRenderingContext2D` (#35285)Samson2025-02-041-7/+18
| | | | | | | | | | | | | * Remove `get_ipc_renderer` from `CanvasRenderingContext2D` Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * fix warnings Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Move various reflector types and traits to script_bindings (#35279)Josh Matthews2025-02-041-1/+1
| | | | | | | | | | | | | * script: Move Reflector to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Extract global() helper from DomObject into new trait. Move DomObject and related traits to script_bindings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Feature-gate all crown support. (#35055)Josh Matthews2025-01-181-1/+1
| | | | | | | | | | | | | * script: Feature-gate all crown support. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Use cfg(crown) instead of a cargo feature. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* script: Limit public exports. (#34915)Josh Matthews2025-01-101-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: Restrict reexport visibility of DOM types. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Mass pub->pub(crate) conversion. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Hide existing dead code warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix unit tests. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * More formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Add CanGc argument to reflect_dom_object (#34606)Domenico Rizzo2024-12-131-1/+1
| | | | | | | | | | | | | | | | | | | | | * applied mach fmt Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> Refinements Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> Modified reflect_dom_object signature and all its calls Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> * fix function calls when parameter is passed up Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> --------- Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
* Generate a trait abstracting over all known DOM interfaces (#34357)Josh Matthews2024-11-241-1/+1
| | | | | | | | | | | | | | | | | * script: Generate trait for all DOM interfaces and parameterize generated Methods traits over it. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Update trait implementations with new generic type. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Formatting. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* CanGc changes from fontfaceset.rs (#33920)chickenleaf2024-10-211-12/+13
| | | | | | | | | | | | | | | | * CanGc changes from fontfaceset.rs Signed-off-by: L Ashwin B <lashwinib@gmail.com> * Update components/script/dom/bindings/codegen/Bindings.conf Co-authored-by: Josh Matthews <josh@joshmatthews.net> Signed-off-by: chickenleaf <lashwinib@gmail.com> --------- Signed-off-by: L Ashwin B <lashwinib@gmail.com> Signed-off-by: chickenleaf <lashwinib@gmail.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* Propagate CanGc through dommatrix, dommatrixreadonly, and testbindings (#33822)chickenleaf2024-10-131-2/+2
| | | | | | | | | | | | | | | | | | | * CanGc fixes starting from dommatrix.rs fixed conflicts Signed-off-by: L Ashwin B <lashwinib@gmail.com> ~ * cleaning up Signed-off-by: L Ashwin B <lashwinib@gmail.com> * fixed cannot find value can_gc in this scope error Signed-off-by: L Ashwin B <lashwinib@gmail.com> --------- Signed-off-by: L Ashwin B <lashwinib@gmail.com>
* CanGc fixes starting from imagedata.rs (#33808)chickenleaf2024-10-111-5/+19
| | | | | | | | | | | | | | | | * CanGc fixes starting from imagedata.rs Signed-off-by: L Ashwin B <lashwinib@gmail.com> * Update components/script/dom/imagedata.rs Co-authored-by: Josh Matthews <josh@joshmatthews.net> Signed-off-by: chickenleaf <lashwinib@gmail.com> --------- Signed-off-by: L Ashwin B <lashwinib@gmail.com> Signed-off-by: chickenleaf <lashwinib@gmail.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* enhance: Implement `CanvasRenderingContext2D.measureText` (#32704)Chocolate Pie2024-07-171-1/+2
| | | | Signed-off-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* script: Reduce the use of `unsafe` in LayoutDom (#31979)Martin Robinson2024-04-031-6/+3
| | | | | | | | | | | | | Remove the use of unsafe code in the layout wrappers of the DOM. The main change here is that `unsafe_get()` no longer needs to be an unsafe method, which allows us to transitively remove or reduce unsafe blocks from callers. The function itself is not renamed, because it's still a bit dangerous to start removing the layers of abstraction from actual DOM nodes. In addition `init_style_and_opaque_layout_data` can be merged into `initialize_data`, which removes one more unsafe method. Finally, a "Safety" section is added to some unsafe methods.
* clippy: Fix option_as_ref_deref warnings (#31936)Oluwatobi Sofela2024-03-291-3/+2
|
* fix: remove unused imports (#31929)Azhar Ismagulova2024-03-281-2/+0
|
* clippy: Fix mem_replace_with_default warnings (#31921)Oluwatobi Sofela2024-03-281-4/+1
|
* clippy: Fix a few clippy problems in `components/scripts/dom` (#31905)Rosemary Ajayi2024-03-281-8/+7
| | | | | * option_as_ref_deref * fix
* clippy: Fix `explicit_auto_deref` warnings in `components/script` (#31837)Oluwatobi Sofela2024-03-231-1/+1
| | | | | | | | | * clippy: Fix explicit auto-deref warnings * clippy: Fix explicit auto-deref warnings * refactor: Tidy up code * refactor: Fix method not found errors
* canvas2d: Implement `.reset()` (#31258)Smitty2024-02-051-1/+6
| | | | | | | | | | | * Implement Canvas2D reset * Update WPT tests * Apply suggestions from code review --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Replace script_plugins with a clippy like rustc driver (named crown) (#30508)Samson2023-12-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove script_plugins * Use crown instead of script_plugins * crown_is_not_used * Use crown in command base * bootstrap crown * tidy happy * disable sccache * Bring crown in tree * Install crown from tree * fix windows ci * fix warning * fix mac libscript_plugins.dylib is not available anymore * Update components/script/lib.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> * Update for nightly-2023-03-18 Mostly just based off https://github.com/servo/servo/pull/30630 * Always install crown it's slow only when there is new version * Run crown test with `mach test-unit` * Small fixups; better trace_in_no_trace tests * Better doc * crown in config.toml * Fix tidy for real * no sccache on rustc_wrapper * document rustc overrides * fixup of compiletest * Make a few minor comment adjustments * Fix a typo in python/servo/platform/base.py Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com> * Proper test types * Ignore tidy on crown/tests --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Allow currentColor in canvas context's shadowColor (#30754)Oriol Brufau2023-11-201-1/+2
| | | | | | This allows unifying the parse_color function and method, aligns Servo with other browsers, and obeys the HTML spec: - https://html.spec.whatwg.org/multipage/canvas.html#shadows - https://html.spec.whatwg.org/multipage/infrastructure.html#parsed-as-a-css-color-value
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-14/+12
| | | | | * strict imports formatting * Reformat all imports
* Enable textAlign, textBaseline and direction attributes for canvasUtsav Oza2020-06-101-0/+33
|
* Store resolved font style in canvas context stateUtsav Oza2020-06-101-1/+2
|
* Query layout to resolve canvas font property valueUtsav Oza2020-06-101-0/+11
|
* Resolve mach build warningsUtsav Oza2020-04-101-10/+2
|
* Remove DomRefCell wrapper for canvas_state from CanvasRenderingContext2DUtsav Oza2020-04-101-118/+72
|
* Update euclidManish Goregaokar2020-04-071-1/+0
|
* Make LayoutCanvasRenderingContext2DHelpers::get_canvas_id be safeAnthony Ramine2020-03-311-7/+11
|
* Make LayoutCanvasRenderingContext2DHelpers methods take selfAnthony Ramine2020-03-291-4/+4
|
* Give a lifetime parameter to LayoutDomAnthony Ramine2020-03-281-1/+1
|
* Add trait DomObjectWrap to provide WRAP functionYUAN LYU2020-03-201-2/+1
|
* Implement CanvasRenderingContext2D.getTransform()pylbrecht2020-02-121-0/+6
|
* Make create_pattern() return None for incomplete imagespylbrecht2020-02-101-1/+1
|
* Addresses issues raised in #24465; removes redundancy in set_bitmap_dimensionsBailey Blankenship2019-11-101-6/+22
| | | | Removed passing test .ini files and moved euclid extensions to euclidext.rs to factor out redundant code
* Moved CanvasState out of canvasrenderingcontextHanif Bin Ariffin2019-10-251-1568/+94
| | | | | | | | | | | | | | | | | Cleaned up imports... Applied clang-tidy Moved CanvasState and some other files Next commit should remove pub modifier from members of CanvasState and use getters/setters instead. Members of CanvasState are now private and applied test-tidy Now have getters that return an immutable reference. Also, I have no idea what to name some_func.rs Removed need for some_func and made pub(crate)
* fix getimagedata returns empty pixelsRasmus Viitanen2019-10-161-28/+21
|
* Support CORS attributes for image elements.Josh Matthews2019-10-041-9/+39
|
* Use the paint worklet's base URL for the 2d canvas' origin checks.Josh Matthews2019-10-041-1/+10
|