mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #13747 - scotttrinh:canvas-webidl, r=Ms2ger
Partial fix for #12415: expose Canvas interfaces <!-- Please describe your changes on the following line: --> Fix interface exposure per [the specs](https://html.spec.whatwg.org/multipage/scripting.html#2dcontext). One lingering question I have is if [`CanvasPath`](https://html.spec.whatwg.org/multipage/scripting.html#canvaspath) needs to be added to `interfaces.worker.js` since it *is* exposed to the `Worker` environment. I tried adding it to the `interfaces.worker.js` list but it failed tests at https://github.com/servo/servo/blob/master/tests/wpt/mozilla/tests/mozilla/interfaces.js#L82 --- <!-- 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 contain a partial fix for #12415 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/13747) <!-- Reviewable:end -->
This commit is contained in:
commit
97bcd97ebd
6 changed files with 15 additions and 36 deletions
|
@ -3,7 +3,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#canvasgradient
|
||||
[Exposed=(Window,Worker)]
|
||||
interface CanvasGradient {
|
||||
// opaque object
|
||||
[Throws]
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#canvaspattern
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface CanvasPattern {
|
||||
//void setTransform(SVGMatrix matrix);
|
||||
};
|
||||
|
|
|
@ -12,7 +12,6 @@ typedef (HTMLImageElement or
|
|||
ImageBitmap */) CanvasImageSource;
|
||||
|
||||
//[Constructor(optional unsigned long width, unsigned long height)]
|
||||
[Exposed=(Window,Worker)]
|
||||
interface CanvasRenderingContext2D {
|
||||
|
||||
// back-reference to the canvas
|
||||
|
@ -42,14 +41,14 @@ CanvasRenderingContext2D implements CanvasPathDrawingStyles;
|
|||
CanvasRenderingContext2D implements CanvasTextDrawingStyles;
|
||||
CanvasRenderingContext2D implements CanvasPath;
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
[NoInterfaceObject]
|
||||
interface CanvasState {
|
||||
// state
|
||||
void save(); // push state on state stack
|
||||
void restore(); // pop state stack and restore state
|
||||
};
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
[NoInterfaceObject]
|
||||
interface CanvasTransform {
|
||||
// transformations (default transform is the identity matrix)
|
||||
void scale(unrestricted double x, unrestricted double y);
|
||||
|
@ -73,21 +72,21 @@ interface CanvasTransform {
|
|||
void resetTransform();
|
||||
};
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
[NoInterfaceObject]
|
||||
interface CanvasCompositing {
|
||||
// compositing
|
||||
attribute unrestricted double globalAlpha; // (default 1.0)
|
||||
attribute DOMString globalCompositeOperation; // (default source-over)
|
||||
};
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
[NoInterfaceObject]
|
||||
interface CanvasImageSmoothing {
|
||||
// image smoothing
|
||||
attribute boolean imageSmoothingEnabled; // (default true)
|
||||
// attribute ImageSmoothingQuality imageSmoothingQuality; // (default low)
|
||||
};
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
[NoInterfaceObject]
|
||||
interface CanvasFillStrokeStyles {
|
||||
|
||||
// colours and styles (see also the CanvasDrawingStyles interface)
|
||||
|
@ -100,7 +99,7 @@ interface CanvasFillStrokeStyles {
|
|||
CanvasPattern createPattern(CanvasImageSource image, [TreatNullAs=EmptyString] DOMString repetition);
|
||||
};
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
[NoInterfaceObject]
|
||||
interface CanvasShadowStyles {
|
||||
// shadows
|
||||
attribute unrestricted double shadowOffsetX; // (default 0)
|
||||
|
@ -109,7 +108,7 @@ interface CanvasShadowStyles {
|
|||
attribute DOMString shadowColor; // (default transparent black)
|
||||
};
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
[NoInterfaceObject]
|
||||
interface CanvasRect {
|
||||
// rects
|
||||
//[LenientFloat]
|
||||
|
@ -120,7 +119,7 @@ interface CanvasRect {
|
|||
void strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
|
||||
};
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
[NoInterfaceObject]
|
||||
interface CanvasDrawPath {
|
||||
// path API (see also CanvasPathMethods)
|
||||
void beginPath();
|
||||
|
@ -143,12 +142,12 @@ interface CanvasDrawPath {
|
|||
//boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y);
|
||||
};
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
[NoInterfaceObject]
|
||||
interface CanvasUserInterface {
|
||||
// TODO?
|
||||
};
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
[NoInterfaceObject]
|
||||
interface CanvasText {
|
||||
// text (see also the CanvasDrawingStyles interface)
|
||||
//void fillText(DOMString text, unrestricted double x, unrestricted double y,
|
||||
|
@ -158,7 +157,7 @@ interface CanvasText {
|
|||
//TextMetrics measureText(DOMString text);
|
||||
};
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
[NoInterfaceObject]
|
||||
interface CanvasDrawImage {
|
||||
// drawing images
|
||||
[Throws]
|
||||
|
@ -173,7 +172,7 @@ interface CanvasDrawImage {
|
|||
unrestricted double dw, unrestricted double dh);
|
||||
};
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
[NoInterfaceObject]
|
||||
interface CanvasHitRegion {
|
||||
// hit regions
|
||||
//void addHitRegion(optional HitRegionOptions options);
|
||||
|
@ -181,7 +180,7 @@ interface CanvasHitRegion {
|
|||
//void clearHitRegions();
|
||||
};
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
[NoInterfaceObject]
|
||||
interface CanvasImageData {
|
||||
// pixel manipulation
|
||||
[Throws]
|
||||
|
@ -206,7 +205,7 @@ enum CanvasTextAlign { "start", "end", "left", "right", "center" };
|
|||
enum CanvasTextBaseline { "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" };
|
||||
enum CanvasDirection { "ltr", "rtl", "inherit" };
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
[NoInterfaceObject]
|
||||
interface CanvasPathDrawingStyles {
|
||||
// line caps/joins
|
||||
attribute unrestricted double lineWidth; // (default 1)
|
||||
|
@ -220,7 +219,7 @@ interface CanvasPathDrawingStyles {
|
|||
//attribute unrestricted double lineDashOffset;
|
||||
};
|
||||
|
||||
[NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
[NoInterfaceObject]
|
||||
interface CanvasTextDrawingStyles {
|
||||
// text
|
||||
//attribute DOMString font; // (default 10px sans-serif)
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// https://html.spec.whatwg.org/multipage/#htmlcanvaselement
|
||||
typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext;
|
||||
|
||||
[Exposed=(Window,Worker)]
|
||||
interface HTMLCanvasElement : HTMLElement {
|
||||
[Pure]
|
||||
attribute unsigned long width;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue