mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Auto merge of #25734 - pylbrecht:get.transform, r=jdm
Implement CanvasRenderingContext2D.getTransform() <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix part of #25331 <!-- Either: --> - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
2c70db5f5b
16 changed files with 42 additions and 22 deletions
|
@ -18,6 +18,7 @@ use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom};
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::canvasgradient::CanvasGradient;
|
||||
use crate::dom::canvaspattern::CanvasPattern;
|
||||
use crate::dom::dommatrix::DOMMatrix;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::htmlcanvaselement::HTMLCanvasElement;
|
||||
use crate::dom::imagedata::ImageData;
|
||||
|
@ -224,6 +225,11 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
|
|||
self.canvas_state.borrow().transform(a, b, c, d, e, f)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-gettransform
|
||||
fn GetTransform(&self) -> DomRoot<DOMMatrix> {
|
||||
self.canvas_state.borrow().get_transform(&self.global())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-settransform
|
||||
fn SetTransform(&self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64) {
|
||||
self.canvas_state.borrow().set_transform(a, b, c, d, e, f)
|
||||
|
|
|
@ -19,6 +19,7 @@ use crate::dom::bindings::root::{Dom, DomRoot};
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::canvasgradient::CanvasGradient;
|
||||
use crate::dom::canvaspattern::CanvasPattern;
|
||||
use crate::dom::dommatrix::DOMMatrix;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::htmlcanvaselement::HTMLCanvasElement;
|
||||
use crate::dom::imagedata::ImageData;
|
||||
|
@ -470,6 +471,11 @@ impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContex
|
|||
self.canvas_state.borrow().transform(a, b, c, d, e, f)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-gettransform
|
||||
fn GetTransform(&self) -> DomRoot<DOMMatrix> {
|
||||
self.canvas_state.borrow().get_transform(&self.global())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-settransform
|
||||
fn SetTransform(&self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64) {
|
||||
self.canvas_state.borrow().set_transform(a, b, c, d, e, f)
|
||||
|
|
|
@ -20,6 +20,7 @@ use crate::dom::bindings::str::DOMString;
|
|||
use crate::dom::canvasgradient::CanvasGradient;
|
||||
use crate::dom::canvaspattern::CanvasPattern;
|
||||
use crate::dom::canvasrenderingcontext2d::CanvasRenderingContext2D;
|
||||
use crate::dom::dommatrix::DOMMatrix;
|
||||
use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
|
||||
use crate::euclidext::Size2DExt;
|
||||
use canvas_traits::canvas::CanvasImageData;
|
||||
|
@ -119,6 +120,11 @@ impl PaintRenderingContext2DMethods for PaintRenderingContext2D {
|
|||
self.context.Transform(a, b, c, d, e, f)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-gettransform
|
||||
fn GetTransform(&self) -> DomRoot<DOMMatrix> {
|
||||
self.context.GetTransform()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-settransform
|
||||
fn SetTransform(&self, a: f64, b: f64, c: f64, d: f64, e: f64, f: f64) {
|
||||
self.context.SetTransform(a, b, c, d, e, f);
|
||||
|
|
|
@ -59,7 +59,7 @@ interface mixin CanvasTransform {
|
|||
unrestricted double e,
|
||||
unrestricted double f);
|
||||
|
||||
// [NewObject] DOMMatrix getTransform();
|
||||
[NewObject] DOMMatrix getTransform();
|
||||
void setTransform(unrestricted double a,
|
||||
unrestricted double b,
|
||||
unrestricted double c,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
* related or neighboring rights to this work.
|
||||
*/
|
||||
|
||||
[Exposed=(Window,Worker),
|
||||
[Exposed=(Window,Worker,PaintWorklet),
|
||||
LegacyWindowAlias=WebKitCSSMatrix]
|
||||
interface DOMMatrix : DOMMatrixReadOnly {
|
||||
[Throws] constructor(optional (DOMString or sequence<unrestricted double>) init);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
* related or neighboring rights to this work.
|
||||
*/
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
[Exposed=(Window,Worker,PaintWorklet)]
|
||||
interface DOMMatrixReadOnly {
|
||||
[Throws] constructor(optional (DOMString or sequence<unrestricted double>) init);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dompoint
|
||||
[Exposed=(Window,Worker)]
|
||||
[Exposed=(Window,Worker,PaintWorklet)]
|
||||
interface DOMPoint : DOMPointReadOnly {
|
||||
[Throws] constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
|
||||
optional unrestricted double z = 0, optional unrestricted double w = 1);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dompointreadonly
|
||||
[Exposed=(Window,Worker)]
|
||||
[Exposed=(Window,Worker,PaintWorklet)]
|
||||
interface DOMPointReadOnly {
|
||||
[Throws] constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
|
||||
optional unrestricted double z = 0, optional unrestricted double w = 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue