mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Update CanvasRenderingContext2D WebIDL definition
CanvasImageSource was never supposed to include CanvasRenderingContext2D.
This commit is contained in:
parent
2b574bbdf8
commit
3528ef30e5
3 changed files with 76 additions and 106 deletions
|
@ -246,8 +246,6 @@ impl CanvasRenderingContext2D {
|
||||||
CanvasImageSource::HTMLCanvasElement(canvas) => {
|
CanvasImageSource::HTMLCanvasElement(canvas) => {
|
||||||
canvas.origin_is_clean()
|
canvas.origin_is_clean()
|
||||||
}
|
}
|
||||||
CanvasImageSource::CanvasRenderingContext2D(image) =>
|
|
||||||
image.origin_is_clean(),
|
|
||||||
CanvasImageSource::HTMLImageElement(image) => {
|
CanvasImageSource::HTMLImageElement(image) => {
|
||||||
let image_origin = image.get_origin().expect("Image's origin is missing");
|
let image_origin = image.get_origin().expect("Image's origin is missing");
|
||||||
image_origin.same_origin(GlobalScope::entry().origin())
|
image_origin.same_origin(GlobalScope::entry().origin())
|
||||||
|
@ -294,11 +292,6 @@ impl CanvasRenderingContext2D {
|
||||||
sx, sy, sw, sh,
|
sx, sy, sw, sh,
|
||||||
dx, dy, dw, dh)
|
dx, dy, dw, dh)
|
||||||
}
|
}
|
||||||
CanvasImageSource::CanvasRenderingContext2D(ref image) => {
|
|
||||||
self.draw_html_canvas_element(&image.Canvas(),
|
|
||||||
sx, sy, sw, sh,
|
|
||||||
dx, dy, dw, dh)
|
|
||||||
}
|
|
||||||
CanvasImageSource::HTMLImageElement(ref image) => {
|
CanvasImageSource::HTMLImageElement(ref image) => {
|
||||||
// https://html.spec.whatwg.org/multipage/#img-error
|
// https://html.spec.whatwg.org/multipage/#img-error
|
||||||
// If the image argument is an HTMLImageElement object that is in the broken state,
|
// If the image argument is an HTMLImageElement object that is in the broken state,
|
||||||
|
@ -1216,12 +1209,6 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
|
||||||
|
|
||||||
canvas.fetch_all_data().ok_or(Error::InvalidState)?
|
canvas.fetch_all_data().ok_or(Error::InvalidState)?
|
||||||
},
|
},
|
||||||
CanvasImageSource::CanvasRenderingContext2D(ref context) => {
|
|
||||||
let canvas = context.Canvas();
|
|
||||||
let _ = canvas.get_or_init_2d_context();
|
|
||||||
|
|
||||||
canvas.fetch_all_data().ok_or(Error::InvalidState)?
|
|
||||||
}
|
|
||||||
CanvasImageSource::CSSStyleValue(ref value) => {
|
CanvasImageSource::CSSStyleValue(ref value) => {
|
||||||
value.get_url(self.base_url.clone())
|
value.get_url(self.base_url.clone())
|
||||||
.and_then(|url| self.fetch_image_data(url))
|
.and_then(|url| self.fetch_image_data(url))
|
||||||
|
|
|
@ -6,12 +6,12 @@ use canvas_traits::canvas::CanvasImageData;
|
||||||
use canvas_traits::canvas::CanvasMsg;
|
use canvas_traits::canvas::CanvasMsg;
|
||||||
use canvas_traits::canvas::FromLayoutMsg;
|
use canvas_traits::canvas::FromLayoutMsg;
|
||||||
use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule;
|
use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasFillRule;
|
||||||
|
use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasImageSource;
|
||||||
use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineCap;
|
use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineCap;
|
||||||
use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineJoin;
|
use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasLineJoin;
|
||||||
use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasRenderingContext2DMethods;
|
use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasRenderingContext2DMethods;
|
||||||
use dom::bindings::codegen::Bindings::PaintRenderingContext2DBinding;
|
use dom::bindings::codegen::Bindings::PaintRenderingContext2DBinding;
|
||||||
use dom::bindings::codegen::Bindings::PaintRenderingContext2DBinding::PaintRenderingContext2DMethods;
|
use dom::bindings::codegen::Bindings::PaintRenderingContext2DBinding::PaintRenderingContext2DMethods;
|
||||||
use dom::bindings::codegen::UnionTypes::HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2DOrCSSStyleValue;
|
|
||||||
use dom::bindings::codegen::UnionTypes::StringOrCanvasGradientOrCanvasPattern;
|
use dom::bindings::codegen::UnionTypes::StringOrCanvasGradientOrCanvasPattern;
|
||||||
use dom::bindings::error::ErrorResult;
|
use dom::bindings::error::ErrorResult;
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
|
@ -194,37 +194,40 @@ impl PaintRenderingContext2DMethods for PaintRenderingContext2D {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
|
||||||
fn DrawImage(&self,
|
fn DrawImage(
|
||||||
image: HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2DOrCSSStyleValue,
|
&self,
|
||||||
dx: f64,
|
image: CanvasImageSource,
|
||||||
dy: f64)
|
dx: f64,
|
||||||
-> ErrorResult {
|
dy: f64,
|
||||||
|
) -> ErrorResult {
|
||||||
self.context.DrawImage(image, dx, dy)
|
self.context.DrawImage(image, dx, dy)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
|
||||||
fn DrawImage_(&self,
|
fn DrawImage_(
|
||||||
image: HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2DOrCSSStyleValue,
|
&self,
|
||||||
dx: f64,
|
image: CanvasImageSource,
|
||||||
dy: f64,
|
dx: f64,
|
||||||
dw: f64,
|
dy: f64,
|
||||||
dh: f64)
|
dw: f64,
|
||||||
-> ErrorResult {
|
dh: f64,
|
||||||
|
) -> ErrorResult {
|
||||||
self.context.DrawImage_(image, dx, dy, dw, dh)
|
self.context.DrawImage_(image, dx, dy, dw, dh)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-drawimage
|
||||||
fn DrawImage__(&self,
|
fn DrawImage__(
|
||||||
image: HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2DOrCSSStyleValue,
|
&self,
|
||||||
sx: f64,
|
image: CanvasImageSource,
|
||||||
sy: f64,
|
sx: f64,
|
||||||
sw: f64,
|
sy: f64,
|
||||||
sh: f64,
|
sw: f64,
|
||||||
dx: f64,
|
sh: f64,
|
||||||
dy: f64,
|
dx: f64,
|
||||||
dw: f64,
|
dy: f64,
|
||||||
dh: f64)
|
dw: f64,
|
||||||
-> ErrorResult {
|
dh: f64,
|
||||||
|
) -> ErrorResult {
|
||||||
self.context.DrawImage__(image, sx, sy, sw, sh, dx, dy, dw, dh)
|
self.context.DrawImage__(image, sx, sy, sw, sh, dx, dy, dw, dh)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,10 +324,11 @@ impl PaintRenderingContext2DMethods for PaintRenderingContext2D {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-createpattern
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-createpattern
|
||||||
fn CreatePattern(&self,
|
fn CreatePattern(
|
||||||
image: HTMLImageElementOrHTMLCanvasElementOrCanvasRenderingContext2DOrCSSStyleValue,
|
&self,
|
||||||
repetition: DOMString)
|
image: CanvasImageSource,
|
||||||
-> Fallible<DomRoot<CanvasPattern>> {
|
repetition: DOMString,
|
||||||
|
) -> Fallible<DomRoot<CanvasPattern>> {
|
||||||
self.context.CreatePattern(image, repetition)
|
self.context.CreatePattern(image, repetition)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,30 +2,25 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/#2dcontext
|
||||||
|
|
||||||
|
// typedef (HTMLImageElement or
|
||||||
|
// SVGImageElement) HTMLOrSVGImageElement;
|
||||||
|
typedef HTMLImageElement HTMLOrSVGImageElement;
|
||||||
|
|
||||||
|
typedef (HTMLOrSVGImageElement or
|
||||||
|
/*HTMLVideoElement or*/
|
||||||
|
HTMLCanvasElement or
|
||||||
|
/*ImageBitmap or*/
|
||||||
|
/*OffscreenCanvas or*/
|
||||||
|
/*CSSImageValue*/ CSSStyleValue) CanvasImageSource;
|
||||||
|
|
||||||
enum CanvasFillRule { "nonzero", "evenodd" };
|
enum CanvasFillRule { "nonzero", "evenodd" };
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#2dcontext
|
[Exposed=Window]
|
||||||
typedef (HTMLImageElement or
|
|
||||||
/* HTMLVideoElement or */
|
|
||||||
HTMLCanvasElement or
|
|
||||||
CanvasRenderingContext2D or
|
|
||||||
/* ImageBitmap or */
|
|
||||||
// This should probably be a CSSImageValue
|
|
||||||
// https://github.com/w3c/css-houdini-drafts/issues/416
|
|
||||||
CSSStyleValue) CanvasImageSource;
|
|
||||||
|
|
||||||
//[Constructor(optional unsigned long width, unsigned long height)]
|
|
||||||
interface CanvasRenderingContext2D {
|
interface CanvasRenderingContext2D {
|
||||||
|
|
||||||
// back-reference to the canvas
|
// back-reference to the canvas
|
||||||
readonly attribute HTMLCanvasElement canvas;
|
readonly attribute HTMLCanvasElement canvas;
|
||||||
|
|
||||||
// canvas dimensions
|
|
||||||
// attribute unsigned long width;
|
|
||||||
// attribute unsigned long height;
|
|
||||||
|
|
||||||
// for contexts that aren't directly fixed to a specific canvas
|
|
||||||
//void commit(); // push the image to the output bitmap
|
|
||||||
};
|
};
|
||||||
CanvasRenderingContext2D implements CanvasState;
|
CanvasRenderingContext2D implements CanvasState;
|
||||||
CanvasRenderingContext2D implements CanvasTransform;
|
CanvasRenderingContext2D implements CanvasTransform;
|
||||||
|
@ -33,25 +28,25 @@ CanvasRenderingContext2D implements CanvasCompositing;
|
||||||
CanvasRenderingContext2D implements CanvasImageSmoothing;
|
CanvasRenderingContext2D implements CanvasImageSmoothing;
|
||||||
CanvasRenderingContext2D implements CanvasFillStrokeStyles;
|
CanvasRenderingContext2D implements CanvasFillStrokeStyles;
|
||||||
CanvasRenderingContext2D implements CanvasShadowStyles;
|
CanvasRenderingContext2D implements CanvasShadowStyles;
|
||||||
|
CanvasRenderingContext2D implements CanvasFilters;
|
||||||
CanvasRenderingContext2D implements CanvasRect;
|
CanvasRenderingContext2D implements CanvasRect;
|
||||||
CanvasRenderingContext2D implements CanvasDrawPath;
|
CanvasRenderingContext2D implements CanvasDrawPath;
|
||||||
CanvasRenderingContext2D implements CanvasUserInterface;
|
CanvasRenderingContext2D implements CanvasUserInterface;
|
||||||
CanvasRenderingContext2D implements CanvasText;
|
CanvasRenderingContext2D implements CanvasText;
|
||||||
CanvasRenderingContext2D implements CanvasDrawImage;
|
CanvasRenderingContext2D implements CanvasDrawImage;
|
||||||
CanvasRenderingContext2D implements CanvasHitRegion;
|
|
||||||
CanvasRenderingContext2D implements CanvasImageData;
|
CanvasRenderingContext2D implements CanvasImageData;
|
||||||
CanvasRenderingContext2D implements CanvasPathDrawingStyles;
|
CanvasRenderingContext2D implements CanvasPathDrawingStyles;
|
||||||
CanvasRenderingContext2D implements CanvasTextDrawingStyles;
|
CanvasRenderingContext2D implements CanvasTextDrawingStyles;
|
||||||
CanvasRenderingContext2D implements CanvasPath;
|
CanvasRenderingContext2D implements CanvasPath;
|
||||||
|
|
||||||
[NoInterfaceObject, Exposed=(Window, PaintWorklet)]
|
[Exposed=(PaintWorklet, Window), NoInterfaceObject]
|
||||||
interface CanvasState {
|
interface CanvasState {
|
||||||
// state
|
// state
|
||||||
void save(); // push state on state stack
|
void save(); // push state on state stack
|
||||||
void restore(); // pop state stack and restore state
|
void restore(); // pop state stack and restore state
|
||||||
};
|
};
|
||||||
|
|
||||||
[NoInterfaceObject, Exposed=(Window, PaintWorklet)]
|
[Exposed=(PaintWorklet, Window), NoInterfaceObject]
|
||||||
interface CanvasTransform {
|
interface CanvasTransform {
|
||||||
// transformations (default transform is the identity matrix)
|
// transformations (default transform is the identity matrix)
|
||||||
void scale(unrestricted double x, unrestricted double y);
|
void scale(unrestricted double x, unrestricted double y);
|
||||||
|
@ -75,23 +70,22 @@ interface CanvasTransform {
|
||||||
void resetTransform();
|
void resetTransform();
|
||||||
};
|
};
|
||||||
|
|
||||||
[NoInterfaceObject, Exposed=(Window, PaintWorklet)]
|
[Exposed=(PaintWorklet, Window), NoInterfaceObject]
|
||||||
interface CanvasCompositing {
|
interface CanvasCompositing {
|
||||||
// compositing
|
// compositing
|
||||||
attribute unrestricted double globalAlpha; // (default 1.0)
|
attribute unrestricted double globalAlpha; // (default 1.0)
|
||||||
attribute DOMString globalCompositeOperation; // (default source-over)
|
attribute DOMString globalCompositeOperation; // (default source-over)
|
||||||
};
|
};
|
||||||
|
|
||||||
[NoInterfaceObject, Exposed=(Window, PaintWorklet)]
|
[Exposed=(PaintWorklet, Window), NoInterfaceObject]
|
||||||
interface CanvasImageSmoothing {
|
interface CanvasImageSmoothing {
|
||||||
// image smoothing
|
// image smoothing
|
||||||
attribute boolean imageSmoothingEnabled; // (default true)
|
attribute boolean imageSmoothingEnabled; // (default true)
|
||||||
// attribute ImageSmoothingQuality imageSmoothingQuality; // (default low)
|
// attribute ImageSmoothingQuality imageSmoothingQuality; // (default low)
|
||||||
};
|
};
|
||||||
|
|
||||||
[NoInterfaceObject, Exposed=(Window, PaintWorklet)]
|
[Exposed=(PaintWorklet, Window), NoInterfaceObject]
|
||||||
interface CanvasFillStrokeStyles {
|
interface CanvasFillStrokeStyles {
|
||||||
|
|
||||||
// colours and styles (see also the CanvasDrawingStyles interface)
|
// colours and styles (see also the CanvasDrawingStyles interface)
|
||||||
attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (default black)
|
attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (default black)
|
||||||
attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (default black)
|
attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (default black)
|
||||||
|
@ -102,7 +96,7 @@ interface CanvasFillStrokeStyles {
|
||||||
CanvasPattern createPattern(CanvasImageSource image, [TreatNullAs=EmptyString] DOMString repetition);
|
CanvasPattern createPattern(CanvasImageSource image, [TreatNullAs=EmptyString] DOMString repetition);
|
||||||
};
|
};
|
||||||
|
|
||||||
[NoInterfaceObject, Exposed=(Window, PaintWorklet)]
|
[Exposed=(PaintWorklet, Window), NoInterfaceObject]
|
||||||
interface CanvasShadowStyles {
|
interface CanvasShadowStyles {
|
||||||
// shadows
|
// shadows
|
||||||
attribute unrestricted double shadowOffsetX; // (default 0)
|
attribute unrestricted double shadowOffsetX; // (default 0)
|
||||||
|
@ -111,32 +105,30 @@ interface CanvasShadowStyles {
|
||||||
attribute DOMString shadowColor; // (default transparent black)
|
attribute DOMString shadowColor; // (default transparent black)
|
||||||
};
|
};
|
||||||
|
|
||||||
[NoInterfaceObject, Exposed=(Window, PaintWorklet)]
|
[Exposed=(PaintWorklet, Window), NoInterfaceObject]
|
||||||
|
interface CanvasFilters {
|
||||||
|
// filters
|
||||||
|
//attribute DOMString filter; // (default "none")
|
||||||
|
};
|
||||||
|
|
||||||
|
[Exposed=(PaintWorklet, Window), NoInterfaceObject]
|
||||||
interface CanvasRect {
|
interface CanvasRect {
|
||||||
// rects
|
// rects
|
||||||
//[LenientFloat]
|
|
||||||
void clearRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
|
void clearRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
|
||||||
//[LenientFloat]
|
|
||||||
void fillRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
|
void fillRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
|
||||||
//[LenientFloat]
|
|
||||||
void strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
|
void strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
|
||||||
};
|
};
|
||||||
|
|
||||||
[NoInterfaceObject, Exposed=(Window, PaintWorklet)]
|
[Exposed=(PaintWorklet, Window), NoInterfaceObject]
|
||||||
interface CanvasDrawPath {
|
interface CanvasDrawPath {
|
||||||
// path API (see also CanvasPathMethods)
|
// path API (see also CanvasPath)
|
||||||
void beginPath();
|
void beginPath();
|
||||||
void fill(optional CanvasFillRule fillRule = "nonzero");
|
void fill(optional CanvasFillRule fillRule = "nonzero");
|
||||||
//void fill(Path2D path, optional CanvasFillRule fillRule = "nonzero");
|
//void fill(Path2D path, optional CanvasFillRule fillRule = "nonzero");
|
||||||
void stroke();
|
void stroke();
|
||||||
//void stroke(Path2D path);
|
//void stroke(Path2D path);
|
||||||
//void drawFocusIfNeeded(Element element);
|
|
||||||
//void drawFocusIfNeeded(Path2D path, Element element);
|
|
||||||
//void scrollPathIntoView();
|
|
||||||
//void scrollPathIntoView(Path2D path);
|
|
||||||
void clip(optional CanvasFillRule fillRule = "nonzero");
|
void clip(optional CanvasFillRule fillRule = "nonzero");
|
||||||
//void clip(Path2D path, optional CanvasFillRule fillRule = "nonzero");
|
//void clip(Path2D path, optional CanvasFillRule fillRule = "nonzero");
|
||||||
//void resetClip();
|
|
||||||
boolean isPointInPath(unrestricted double x, unrestricted double y,
|
boolean isPointInPath(unrestricted double x, unrestricted double y,
|
||||||
optional CanvasFillRule fillRule = "nonzero");
|
optional CanvasFillRule fillRule = "nonzero");
|
||||||
//boolean isPointInPath(Path2D path, unrestricted double x, unrestricted double y,
|
//boolean isPointInPath(Path2D path, unrestricted double x, unrestricted double y,
|
||||||
|
@ -145,14 +137,17 @@ interface CanvasDrawPath {
|
||||||
//boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y);
|
//boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y);
|
||||||
};
|
};
|
||||||
|
|
||||||
[NoInterfaceObject]
|
[Exposed=(PaintWorklet, Window), NoInterfaceObject]
|
||||||
interface CanvasUserInterface {
|
interface CanvasUserInterface {
|
||||||
// TODO?
|
//void drawFocusIfNeeded(Element element);
|
||||||
|
//void drawFocusIfNeeded(Path2D path, Element element);
|
||||||
|
//void scrollPathIntoView();
|
||||||
|
//void scrollPathIntoView(Path2D path);
|
||||||
};
|
};
|
||||||
|
|
||||||
[NoInterfaceObject]
|
[Exposed=(PaintWorklet, Window), NoInterfaceObject]
|
||||||
interface CanvasText {
|
interface CanvasText {
|
||||||
// text (see also the CanvasDrawingStyles interface)
|
// text (see also the CanvasPathDrawingStyles and CanvasTextDrawingStyles interfaces)
|
||||||
[Pref="dom.canvas-text.enabled"]
|
[Pref="dom.canvas-text.enabled"]
|
||||||
void fillText(DOMString text, unrestricted double x, unrestricted double y,
|
void fillText(DOMString text, unrestricted double x, unrestricted double y,
|
||||||
optional unrestricted double maxWidth);
|
optional unrestricted double maxWidth);
|
||||||
|
@ -161,7 +156,7 @@ interface CanvasText {
|
||||||
//TextMetrics measureText(DOMString text);
|
//TextMetrics measureText(DOMString text);
|
||||||
};
|
};
|
||||||
|
|
||||||
[NoInterfaceObject, Exposed=(Window, PaintWorklet)]
|
[Exposed=(PaintWorklet, Window), NoInterfaceObject]
|
||||||
interface CanvasDrawImage {
|
interface CanvasDrawImage {
|
||||||
// drawing images
|
// drawing images
|
||||||
[Throws]
|
[Throws]
|
||||||
|
@ -176,15 +171,7 @@ interface CanvasDrawImage {
|
||||||
unrestricted double dw, unrestricted double dh);
|
unrestricted double dw, unrestricted double dh);
|
||||||
};
|
};
|
||||||
|
|
||||||
[NoInterfaceObject]
|
[Exposed=Window, NoInterfaceObject]
|
||||||
interface CanvasHitRegion {
|
|
||||||
// hit regions
|
|
||||||
//void addHitRegion(optional HitRegionOptions options);
|
|
||||||
//void removeHitRegion(DOMString id);
|
|
||||||
//void clearHitRegions();
|
|
||||||
};
|
|
||||||
|
|
||||||
[NoInterfaceObject]
|
|
||||||
interface CanvasImageData {
|
interface CanvasImageData {
|
||||||
// pixel manipulation
|
// pixel manipulation
|
||||||
[Throws]
|
[Throws]
|
||||||
|
@ -199,9 +186,6 @@ interface CanvasImageData {
|
||||||
double dirtyX, double dirtyY,
|
double dirtyX, double dirtyY,
|
||||||
double dirtyWidth, double dirtyHeight);
|
double dirtyWidth, double dirtyHeight);
|
||||||
};
|
};
|
||||||
CanvasRenderingContext2D implements CanvasPathDrawingStyles;
|
|
||||||
CanvasRenderingContext2D implements CanvasTextDrawingStyles;
|
|
||||||
CanvasRenderingContext2D implements CanvasPath;
|
|
||||||
|
|
||||||
enum CanvasLineCap { "butt", "round", "square" };
|
enum CanvasLineCap { "butt", "round", "square" };
|
||||||
enum CanvasLineJoin { "round", "bevel", "miter"};
|
enum CanvasLineJoin { "round", "bevel", "miter"};
|
||||||
|
@ -209,12 +193,12 @@ enum CanvasTextAlign { "start", "end", "left", "right", "center" };
|
||||||
enum CanvasTextBaseline { "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" };
|
enum CanvasTextBaseline { "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" };
|
||||||
enum CanvasDirection { "ltr", "rtl", "inherit" };
|
enum CanvasDirection { "ltr", "rtl", "inherit" };
|
||||||
|
|
||||||
[NoInterfaceObject, Exposed=(Window, PaintWorklet)]
|
[Exposed=(PaintWorklet, Window), NoInterfaceObject]
|
||||||
interface CanvasPathDrawingStyles {
|
interface CanvasPathDrawingStyles {
|
||||||
// line caps/joins
|
// line caps/joins
|
||||||
attribute unrestricted double lineWidth; // (default 1)
|
attribute unrestricted double lineWidth; // (default 1)
|
||||||
attribute CanvasLineCap lineCap; // "butt", "round", "square" (default "butt")
|
attribute CanvasLineCap lineCap; // (default "butt")
|
||||||
attribute CanvasLineJoin lineJoin; // "round", "bevel", "miter" (default "miter")
|
attribute CanvasLineJoin lineJoin; // (default "miter")
|
||||||
attribute unrestricted double miterLimit; // (default 10)
|
attribute unrestricted double miterLimit; // (default 10)
|
||||||
|
|
||||||
// dashed lines
|
// dashed lines
|
||||||
|
@ -223,7 +207,7 @@ interface CanvasPathDrawingStyles {
|
||||||
//attribute unrestricted double lineDashOffset;
|
//attribute unrestricted double lineDashOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
[NoInterfaceObject]
|
[Exposed=(PaintWorklet, Window), NoInterfaceObject]
|
||||||
interface CanvasTextDrawingStyles {
|
interface CanvasTextDrawingStyles {
|
||||||
// text
|
// text
|
||||||
//attribute DOMString font; // (default 10px sans-serif)
|
//attribute DOMString font; // (default 10px sans-serif)
|
||||||
|
@ -233,7 +217,7 @@ interface CanvasTextDrawingStyles {
|
||||||
//attribute CanvasDirection direction; // "ltr", "rtl", "inherit" (default: "inherit")
|
//attribute CanvasDirection direction; // "ltr", "rtl", "inherit" (default: "inherit")
|
||||||
};
|
};
|
||||||
|
|
||||||
[NoInterfaceObject, Exposed=(Window, Worker, PaintWorklet)]
|
[Exposed=(PaintWorklet, Window), NoInterfaceObject]
|
||||||
interface CanvasPath {
|
interface CanvasPath {
|
||||||
// shared path API methods
|
// shared path API methods
|
||||||
void closePath();
|
void closePath();
|
||||||
|
@ -253,17 +237,12 @@ interface CanvasPath {
|
||||||
void arcTo(unrestricted double x1, unrestricted double y1,
|
void arcTo(unrestricted double x1, unrestricted double y1,
|
||||||
unrestricted double x2, unrestricted double y2,
|
unrestricted double x2, unrestricted double y2,
|
||||||
unrestricted double radius);
|
unrestricted double radius);
|
||||||
// [LenientFloat] void arcTo(double x1, double y1, double x2, double y2,
|
|
||||||
// double radiusX, double radiusY, double rotation);
|
|
||||||
|
|
||||||
void rect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
|
void rect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
|
||||||
|
|
||||||
[Throws]
|
[Throws]
|
||||||
void arc(unrestricted double x, unrestricted double y, unrestricted double radius,
|
void arc(unrestricted double x, unrestricted double y, unrestricted double radius,
|
||||||
unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
|
unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
|
||||||
// [LenientFloat] void ellipse(double x, double y, double radiusX, double radiusY,
|
|
||||||
// double rotation, double startAngle, double endAngle,
|
|
||||||
// boolean anticlockwise);
|
|
||||||
|
|
||||||
[Throws]
|
[Throws]
|
||||||
void ellipse(unrestricted double x, unrestricted double y, unrestricted double radius_x,
|
void ellipse(unrestricted double x, unrestricted double y, unrestricted double radius_x,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue