mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Clean up and merge some canvas-related WebIDLs (#30606)
* Clean up and merge some canvas-related WebIDLs * Apply `./mach fmt` * WebIDL has `test-tidy` support???
This commit is contained in:
parent
a3d2f0c586
commit
26a3dffd95
9 changed files with 64 additions and 91 deletions
|
@ -13,6 +13,7 @@ typedef (HTMLOrSVGImageElement or
|
|||
HTMLCanvasElement or
|
||||
/*ImageBitmap or*/
|
||||
OffscreenCanvas or
|
||||
/*VideoFrame or*/
|
||||
/*CSSImageValue*/ CSSStyleValue) CanvasImageSource;
|
||||
|
||||
enum CanvasFillRule { "nonzero", "evenodd" };
|
||||
|
@ -39,14 +40,12 @@ CanvasRenderingContext2D includes CanvasPathDrawingStyles;
|
|||
CanvasRenderingContext2D includes CanvasTextDrawingStyles;
|
||||
CanvasRenderingContext2D includes CanvasPath;
|
||||
|
||||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
interface mixin CanvasState {
|
||||
// state
|
||||
undefined save(); // push state on state stack
|
||||
undefined restore(); // pop state stack and restore state
|
||||
};
|
||||
|
||||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
interface mixin CanvasTransform {
|
||||
// transformations (default transform is the identity matrix)
|
||||
undefined scale(unrestricted double x, unrestricted double y);
|
||||
|
@ -70,21 +69,18 @@ interface mixin CanvasTransform {
|
|||
undefined resetTransform();
|
||||
};
|
||||
|
||||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
interface mixin CanvasCompositing {
|
||||
// compositing
|
||||
attribute unrestricted double globalAlpha; // (default 1.0)
|
||||
attribute DOMString globalCompositeOperation; // (default source-over)
|
||||
};
|
||||
|
||||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
interface mixin CanvasImageSmoothing {
|
||||
// image smoothing
|
||||
attribute boolean imageSmoothingEnabled; // (default true)
|
||||
// attribute ImageSmoothingQuality imageSmoothingQuality; // (default low)
|
||||
};
|
||||
|
||||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
interface mixin CanvasFillStrokeStyles {
|
||||
// colours and styles (see also the CanvasDrawingStyles interface)
|
||||
attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (default black)
|
||||
|
@ -96,7 +92,6 @@ interface mixin CanvasFillStrokeStyles {
|
|||
CanvasPattern? createPattern(CanvasImageSource image, [LegacyNullToEmptyString] DOMString repetition);
|
||||
};
|
||||
|
||||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
interface mixin CanvasShadowStyles {
|
||||
// shadows
|
||||
attribute unrestricted double shadowOffsetX; // (default 0)
|
||||
|
@ -105,13 +100,11 @@ interface mixin CanvasShadowStyles {
|
|||
attribute DOMString shadowColor; // (default transparent black)
|
||||
};
|
||||
|
||||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
interface mixin CanvasFilters {
|
||||
// filters
|
||||
//attribute DOMString filter; // (default "none")
|
||||
};
|
||||
|
||||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
interface mixin CanvasRect {
|
||||
// rects
|
||||
undefined clearRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
|
||||
|
@ -119,7 +112,6 @@ interface mixin CanvasRect {
|
|||
undefined strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
|
||||
};
|
||||
|
||||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
interface mixin CanvasDrawPath {
|
||||
// path API (see also CanvasPath)
|
||||
undefined beginPath();
|
||||
|
@ -137,7 +129,6 @@ interface mixin CanvasDrawPath {
|
|||
//boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y);
|
||||
};
|
||||
|
||||
[Exposed=(PaintWorklet, Window)]
|
||||
interface mixin CanvasUserInterface {
|
||||
//void drawFocusIfNeeded(Element element);
|
||||
//void drawFocusIfNeeded(Path2D path, Element element);
|
||||
|
@ -145,7 +136,6 @@ interface mixin CanvasUserInterface {
|
|||
//void scrollPathIntoView(Path2D path);
|
||||
};
|
||||
|
||||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
interface mixin CanvasText {
|
||||
// text (see also the CanvasPathDrawingStyles and CanvasTextDrawingStyles interfaces)
|
||||
[Pref="dom.canvas_text.enabled"]
|
||||
|
@ -157,7 +147,6 @@ interface mixin CanvasText {
|
|||
TextMetrics measureText(DOMString text);
|
||||
};
|
||||
|
||||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
interface mixin CanvasDrawImage {
|
||||
// drawing images
|
||||
[Throws]
|
||||
|
@ -172,7 +161,6 @@ interface mixin CanvasDrawImage {
|
|||
unrestricted double dw, unrestricted double dh);
|
||||
};
|
||||
|
||||
[Exposed=(Window, Worker)]
|
||||
interface mixin CanvasImageData {
|
||||
// pixel manipulation
|
||||
[Throws]
|
||||
|
@ -194,7 +182,6 @@ enum CanvasTextAlign { "start", "end", "left", "right", "center" };
|
|||
enum CanvasTextBaseline { "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" };
|
||||
enum CanvasDirection { "ltr", "rtl", "inherit" };
|
||||
|
||||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
interface mixin CanvasPathDrawingStyles {
|
||||
// line caps/joins
|
||||
attribute unrestricted double lineWidth; // (default 1)
|
||||
|
@ -208,7 +195,6 @@ interface mixin CanvasPathDrawingStyles {
|
|||
//attribute unrestricted double lineDashOffset;
|
||||
};
|
||||
|
||||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
interface mixin CanvasTextDrawingStyles {
|
||||
// text
|
||||
attribute DOMString font; // (default 10px sans-serif)
|
||||
|
@ -218,7 +204,6 @@ interface mixin CanvasTextDrawingStyles {
|
|||
attribute CanvasDirection direction; // "ltr", "rtl", "inherit" (default: "inherit")
|
||||
};
|
||||
|
||||
[Exposed=(PaintWorklet, Window, Worker)]
|
||||
interface mixin CanvasPath {
|
||||
// shared path API methods
|
||||
undefined closePath();
|
||||
|
@ -250,3 +235,29 @@ interface mixin CanvasPath {
|
|||
unrestricted double radius_y, unrestricted double rotation, unrestricted double startAngle,
|
||||
unrestricted double endAngle, optional boolean anticlockwise = false);
|
||||
};
|
||||
|
||||
[Exposed=(Window, PaintWorklet, Worker)]
|
||||
interface CanvasGradient {
|
||||
// opaque object
|
||||
[Throws]
|
||||
undefined addColorStop(double offset, DOMString color);
|
||||
};
|
||||
|
||||
[Exposed=(Window, PaintWorklet, Worker)]
|
||||
interface CanvasPattern {
|
||||
// opaque object
|
||||
//undefined setTransform(optional DOMMatrix2DInit transform = {});
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker),
|
||||
Serializable]
|
||||
interface ImageData {
|
||||
[Throws] constructor(unsigned long sw, unsigned long sh/*, optional ImageDataSettings settings = {}*/);
|
||||
[Throws] constructor(/* Uint8ClampedArray */ object data, unsigned long sw, optional unsigned long sh
|
||||
/*, optional ImageDataSettings settings = {}*/);
|
||||
|
||||
readonly attribute unsigned long width;
|
||||
readonly attribute unsigned long height;
|
||||
readonly attribute Uint8ClampedArray data;
|
||||
//readonly attribute PredefinedColorSpace colorSpace;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue