aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/offscreencanvasrenderingcontext2d.rs
Commit message (Collapse)AuthorAgeFilesLines
* canvas: Apply large size limitations (#36445)Andrei Volykhin22 hours1-1/+1
| | | | | | | | | | | | | | | | | | | | | To prevent any potential crash/OOM issues with "canvas" element from "rogue" applications let's apply large size limitations for context canvas2d's draw target to Servo (similar approach in Firefox/Chromium - they limits width and height to 32767/65535 pixels). Fixes: #36155, #34117, #30164, #24710 -- - [x] ./mach build -d does not report any errors - [x] ./mach test-tidy does not report any errors - [x] There are tests for these changes tests/wpt/tests/html/canvas/element/canvas-host/2d.canvas.host.size.large.html tests/wpt/tests/html/canvas/offscreen/canvas-host/2d.canvas.host.size.large.html tests/wpt/tests/html/canvas/offscreen/canvas-host/2d.canvas.host.size.large.worker.js Signed-off-by: Andrei Volykhin <andrei.volykhin@gmail.com>
* Introduce snapshot concept of canvas (#36119)sagudev7 days1-3/+3
| | | | | | | | | | | | | | | | | | 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/+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/+21
| | | Signed-off-by: Lukas Lihotzki <lukas@lihotzki.de>
* refactor: add CanGc as argument to methods in CanvasRenderingContext2D and ↵Yerkebulan Tulibergenov2025-03-011-3/+7
| | | | | OffscreenCanvasRenderingContext2D (#35732) Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
* Remove `get_ipc_sender` from `OffscreenCanvasRenderingContext2D` (#35625)Samson2025-02-241-8/+4
| | | Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
* Unify `(Offscreen)CanvasRenderingContext2d` and make ↵Samson2025-02-231-140/+100
| | | | | `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>
* Propagate `CanGc` arguments through callers in constructors (#35541)Auguste Baum2025-02-201-1/+2
| | | Signed-off-by: Auguste Baum <auguste.apple@gmail.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-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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/+3
| | | | | | | | | | | | | | | | | * 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/+12
| | | | | | | | | | | | | | | | * 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-7/+27
| | | | | | | | | | | | | | | | * 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>
* clippy: Fix option_as_ref_deref warnings (#31936)Oluwatobi Sofela2024-03-291-21/+10
|
* canvas2d: Implement `.reset()` (#31258)Smitty2024-02-051-0/+5
| | | | | | | | | | | * 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-13/+10
| | | | | * 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-6/+7
|
* Query layout to resolve canvas font property valueUtsav Oza2020-06-101-0/+11
|
* Resolve mach build warningsUtsav Oza2020-04-101-1/+0
|
* Remove DomRefCell wrapper for canvas_state from ↵Utsav Oza2020-04-101-89/+62
| | | | OffscreenCanvasRenderingContext2D
* Add trait DomObjectWrap to provide WRAP functionYUAN LYU2020-03-201-6/+1
|
* Implement CanvasRenderingContext2D.getTransform()pylbrecht2020-02-121-0/+6
|
* Make create_pattern() return None for incomplete imagespylbrecht2020-02-101-1/+1
|
* Addresses Issue: Support OffscreenCanvas as CanvasImageSource #24269Bailey Blankenship2019-12-041-0/+18
| | | | | | Added methods to canvas_data to support drawing an offscreen canvas onto another canvas Bug fix: Swapped OffscreenCanvas width and height parameters to match Mozilla spec Tests: Updated metadata for 866 tests
* Addresses issues raised in #24465; removes redundancy in set_bitmap_dimensionsBailey Blankenship2019-11-101-26/+20
| | | | 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-65/+71
| | | | | | | | | | | | | | | | | 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-3/+7
|
* Temporary implementation of Canvas.MeasureTextPaul Rouget2019-09-251-0/+6
|
* Update euclid.Emilio Cobos Álvarez2019-07-231-1/+1
| | | | | | | | There are a few canvas2d-related dependencies that haven't updated, but they only use euclid internally so that's not blocking landing the rest of the changes. Given the size of this patch, I think it's useful to get this landed as-is.
* Extract canvas operations for reuse by OffscreenCanvas.Maharsh2019-05-221-3/+444
|
* Auto merge of #23363 - Darkspirit:https, r=jdmbors-servo2019-05-141-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | More https * Disabled unused legacy TLS. It will be disabled for Nightly 72 or 73 in 5-7 months and ride the [trains](https://wiki.mozilla.org/Release_Management/Calendar). https://blog.mozilla.org/security/2018/10/15/removing-old-versions-of-tls/ * Updated MPL license in a few files. It would be nice if a new version of https://pypi.org/project/servo_tidy/ could be released to update WebRender as well. * Switched servo-deps.s3.amazonaws.com back to https. This was recently regressed by 10585be25c334bd15710d1a6d93391a9acb6d543 and fc28073dfba05cb2d3fda624c135b2125c1b90af. * Made https the default protocol for address bar on desktop. Press Ctrl+L on the Glutin port and enter `example.com`: Servo previously assumed you meant `http://example.com/`, now it is `https://example.com/`. --- - [x] `./mach build --release` does not report any errors - [x] `./mach test-tidy` does not report any errors <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23363) <!-- Reviewable:end -->
| * Update MPL license to httpsJan Andre Ikenmeyer2019-05-101-1/+1
| |
* | removed commentsMaharsh2019-05-131-11/+8
| |
* | Updated Testcases and FormattingMaharsh2019-05-111-1/+1
| |
* | Changes for sender recieverMaharsh2019-05-091-1/+1
| |
* | Created CanvasRect fro OffscreenCanvas and Updated TestcasesMaharsh2019-03-291-0/+22
|/
* Initial Steps OffScreenCanvas APIMaharsh2019-01-151-0/+55