Skip to content

Commit

Permalink
Merge pull request rustwasm#711 from fitzgen/get-canvas-example-working
Browse files Browse the repository at this point in the history
Get canvas example working
  • Loading branch information
fitzgen authored Aug 16, 2018
2 parents 13fe2b4 + 34363af commit f8354b3
Show file tree
Hide file tree
Showing 140 changed files with 394 additions and 924 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ members = [
"crates/webidl-tests",
"examples/add",
"examples/asm.js",
"examples/canvas",
"examples/char",
"examples/closures",
"examples/comments",
Expand Down
4 changes: 2 additions & 2 deletions crates/web-sys/webidls/enabled/AbstractWorker.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/

[NoInterfaceObject, Exposed=(Window,Worker,System)]
interface AbstractWorker {
[Exposed=(Window,Worker,System)]
interface mixin AbstractWorker {
attribute EventHandler onerror;
};
3 changes: 0 additions & 3 deletions crates/web-sys/webidls/enabled/AnalyserNode.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,3 @@ interface AnalyserNode : AudioNode {
attribute double smoothingTimeConstant;

};

// Mozilla extension
AnalyserNode implements AudioNodePassThrough;
7 changes: 0 additions & 7 deletions crates/web-sys/webidls/enabled/Attr.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,3 @@ interface Attr : Node {

readonly attribute boolean specified;
};

// Mozilla extensions

partial interface Attr {
[GetterThrows]
readonly attribute Element? ownerElement;
};
3 changes: 0 additions & 3 deletions crates/web-sys/webidls/enabled/AudioBufferSourceNode.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,3 @@ interface AudioBufferSourceNode : AudioScheduledSourceNode {
void start(optional double when = 0, optional double grainOffset = 0,
optional double grainDuration);
};

// Mozilla extensions
AudioBufferSourceNode implements AudioNodePassThrough;
12 changes: 0 additions & 12 deletions crates/web-sys/webidls/enabled/AudioNode.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,3 @@ interface AudioNode : EventTarget {
attribute ChannelInterpretation channelInterpretation;

};

// Mozilla extension
partial interface AudioNode {
[ChromeOnly]
readonly attribute unsigned long id;
};
[NoInterfaceObject]
interface AudioNodePassThrough {
[ChromeOnly]
attribute boolean passThrough;
};

20 changes: 5 additions & 15 deletions crates/web-sys/webidls/enabled/AudioParam.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,25 @@ interface AudioParam {
readonly attribute float minValue;
readonly attribute float maxValue;

// Parameter automation.
// Parameter automation.
[Throws]
AudioParam setValueAtTime(float value, double startTime);
[Throws]
AudioParam linearRampToValueAtTime(float value, double endTime);
[Throws]
AudioParam exponentialRampToValueAtTime(float value, double endTime);

// Exponentially approach the target value with a rate having the given time constant.
// Exponentially approach the target value with a rate having the given time constant.
[Throws]
AudioParam setTargetAtTime(float target, double startTime, double timeConstant);

// Sets an array of arbitrary parameter values starting at time for the given duration.
// The number of values will be scaled to fit into the desired duration.
// Sets an array of arbitrary parameter values starting at time for the given duration.
// The number of values will be scaled to fit into the desired duration.
[Throws]
AudioParam setValueCurveAtTime(Float32Array values, double startTime, double duration);

// Cancels all scheduled parameter changes with times greater than or equal to startTime.
// Cancels all scheduled parameter changes with times greater than or equal to startTime.
[Throws]
AudioParam cancelScheduledValues(double startTime);

};

// Mozilla extension
partial interface AudioParam {
// The ID of the AudioNode this AudioParam belongs to.
[ChromeOnly]
readonly attribute unsigned long parentNodeId;
// The name of the AudioParam
[ChromeOnly]
readonly attribute DOMString name;
};
4 changes: 0 additions & 4 deletions crates/web-sys/webidls/enabled/BiquadFilterNode.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,3 @@ interface BiquadFilterNode : AudioNode {
Float32Array phaseResponse);

};

// Mozilla extension
BiquadFilterNode implements AudioNodePassThrough;

13 changes: 5 additions & 8 deletions crates/web-sys/webidls/enabled/BrowserElement.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ dictionary BrowserElementExecuteScriptOptions {
DOMString? origin;
};

[NoInterfaceObject]
interface BrowserElement {
interface mixin BrowserElement {
};

BrowserElement implements BrowserElementCommon;
BrowserElement implements BrowserElementPrivileged;
BrowserElement includes BrowserElementCommon;
BrowserElement includes BrowserElementPrivileged;

[NoInterfaceObject]
interface BrowserElementCommon {
interface mixin BrowserElementCommon {
[Throws,
Pref="dom.mozBrowserFramesEnabled",
ChromeOnly]
Expand All @@ -39,8 +37,7 @@ interface BrowserElementCommon {
void removeNextPaintListener(BrowserElementNextPaintEventCallback listener);
};

[NoInterfaceObject]
interface BrowserElementPrivileged {
interface mixin BrowserElementPrivileged {
[Throws,
Pref="dom.mozBrowserFramesEnabled",
ChromeOnly]
Expand Down
2 changes: 1 addition & 1 deletion crates/web-sys/webidls/enabled/CSSPseudoElement.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ interface CSSPseudoElement {
};

// https://drafts.csswg.org/web-animations/#extensions-to-the-pseudoelement-interface
CSSPseudoElement implements Animatable;
CSSPseudoElement includes Animatable;
88 changes: 36 additions & 52 deletions crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -107,33 +107,31 @@ interface CanvasRenderingContext2D {
void demote();
};

CanvasRenderingContext2D implements CanvasState;
CanvasRenderingContext2D implements CanvasTransform;
CanvasRenderingContext2D implements CanvasCompositing;
CanvasRenderingContext2D implements CanvasImageSmoothing;
CanvasRenderingContext2D implements CanvasFillStrokeStyles;
CanvasRenderingContext2D implements CanvasShadowStyles;
CanvasRenderingContext2D implements CanvasFilters;
CanvasRenderingContext2D implements CanvasRect;
CanvasRenderingContext2D implements CanvasDrawPath;
CanvasRenderingContext2D implements CanvasUserInterface;
CanvasRenderingContext2D implements CanvasText;
CanvasRenderingContext2D implements CanvasDrawImage;
CanvasRenderingContext2D implements CanvasImageData;
CanvasRenderingContext2D implements CanvasPathDrawingStyles;
CanvasRenderingContext2D implements CanvasTextDrawingStyles;
CanvasRenderingContext2D implements CanvasPathMethods;
CanvasRenderingContext2D implements CanvasHitRegions;

[NoInterfaceObject]
interface CanvasState {
CanvasRenderingContext2D includes CanvasState;
CanvasRenderingContext2D includes CanvasTransform;
CanvasRenderingContext2D includes CanvasCompositing;
CanvasRenderingContext2D includes CanvasImageSmoothing;
CanvasRenderingContext2D includes CanvasFillStrokeStyles;
CanvasRenderingContext2D includes CanvasShadowStyles;
CanvasRenderingContext2D includes CanvasFilters;
CanvasRenderingContext2D includes CanvasRect;
CanvasRenderingContext2D includes CanvasDrawPath;
CanvasRenderingContext2D includes CanvasUserInterface;
CanvasRenderingContext2D includes CanvasText;
CanvasRenderingContext2D includes CanvasDrawImage;
CanvasRenderingContext2D includes CanvasImageData;
CanvasRenderingContext2D includes CanvasPathDrawingStyles;
CanvasRenderingContext2D includes CanvasTextDrawingStyles;
CanvasRenderingContext2D includes CanvasPathMethods;
CanvasRenderingContext2D includes CanvasHitRegions;

interface mixin CanvasState {
// state
void save(); // push state on state stack
void restore(); // pop state stack and restore state
};

[NoInterfaceObject]
interface CanvasTransform {
interface mixin CanvasTransform {
// transformations (default transform is the identity matrix)
// NOT IMPLEMENTED attribute SVGMatrix currentTransform;
[Throws, LenientFloat]
Expand All @@ -151,20 +149,18 @@ interface CanvasTransform {
};

[NoInterfaceObject]
interface CanvasCompositing {
interface mixin CanvasCompositing {
attribute unrestricted double globalAlpha; // (default 1.0)
[Throws]
attribute DOMString globalCompositeOperation; // (default source-over)
};

[NoInterfaceObject]
interface CanvasImageSmoothing {
interface mixin CanvasImageSmoothing {
// drawing images
attribute boolean imageSmoothingEnabled;
};

[NoInterfaceObject]
interface CanvasFillStrokeStyles {
interface mixin CanvasFillStrokeStyles {
// colors and styles (see also the CanvasPathDrawingStyles interface)
attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (default black)
attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (default black)
Expand All @@ -176,8 +172,7 @@ interface CanvasFillStrokeStyles {
CanvasPattern? createPattern(CanvasImageSource image, [TreatNullAs=EmptyString] DOMString repetition);
};

[NoInterfaceObject]
interface CanvasShadowStyles {
interface mixin CanvasShadowStyles {
[LenientFloat]
attribute double shadowOffsetX; // (default 0)
[LenientFloat]
Expand All @@ -187,14 +182,12 @@ interface CanvasShadowStyles {
attribute DOMString shadowColor; // (default transparent black)
};

[NoInterfaceObject]
interface CanvasFilters {
interface mixin CanvasFilters {
[Pref="canvas.filters.enabled", SetterThrows]
attribute DOMString filter; // (default empty string = no filter)
};

[NoInterfaceObject]
interface CanvasRect {
interface mixin CanvasRect {
[LenientFloat]
void clearRect(double x, double y, double w, double h);
[LenientFloat]
Expand All @@ -203,8 +196,7 @@ interface CanvasRect {
void strokeRect(double x, double y, double w, double h);
};

[NoInterfaceObject]
interface CanvasDrawPath {
interface mixin CanvasDrawPath {
// path API (see also CanvasPathMethods)
void beginPath();
void fill(optional CanvasWindingRule winding = "nonzero");
Expand All @@ -224,8 +216,7 @@ interface CanvasDrawPath {
boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y);
};

[NoInterfaceObject]
interface CanvasUserInterface {
interface mixin CanvasUserInterface {
[Pref="canvas.focusring.enabled", Throws] void drawFocusIfNeeded(Element element);
// NOT IMPLEMENTED void drawSystemFocusRing(Path path, HTMLElement element);
[Pref="canvas.customfocusring.enabled"] boolean drawCustomFocusRing(Element element);
Expand All @@ -234,8 +225,7 @@ interface CanvasUserInterface {
// NOT IMPLEMENTED void scrollPathIntoView(Path path);
};

[NoInterfaceObject]
interface CanvasText {
interface mixin CanvasText {
// text (see also the CanvasPathDrawingStyles interface)
[Throws, LenientFloat]
void fillText(DOMString text, double x, double y, optional double maxWidth);
Expand All @@ -245,8 +235,7 @@ interface CanvasText {
TextMetrics measureText(DOMString text);
};

[NoInterfaceObject]
interface CanvasDrawImage {
interface mixin CanvasDrawImage {
[Throws, LenientFloat]
void drawImage(CanvasImageSource image, double dx, double dy);
[Throws, LenientFloat]
Expand All @@ -255,8 +244,7 @@ interface CanvasDrawImage {
void drawImage(CanvasImageSource image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh);
};

[NoInterfaceObject]
interface CanvasImageData {
interface mixin CanvasImageData {
// pixel manipulation
[NewObject, Throws]
ImageData createImageData(double sw, double sh);
Expand All @@ -270,8 +258,7 @@ interface CanvasImageData {
void putImageData(ImageData imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight);
};

[NoInterfaceObject]
interface CanvasPathDrawingStyles {
interface mixin CanvasPathDrawingStyles {
// line caps/joins
[LenientFloat]
attribute double lineWidth; // (default 1)
Expand All @@ -287,17 +274,15 @@ interface CanvasPathDrawingStyles {
[LenientFloat] attribute double lineDashOffset;
};

[NoInterfaceObject]
interface CanvasTextDrawingStyles {
interface mixin CanvasTextDrawingStyles {
// text
[SetterThrows]
attribute DOMString font; // (default 10px sans-serif)
attribute DOMString textAlign; // "start", "end", "left", "right", "center" (default: "start")
attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
};

[NoInterfaceObject]
interface CanvasPathMethods {
interface mixin CanvasPathMethods {
// shared path API methods
void closePath();
[LenientFloat]
Expand All @@ -324,8 +309,7 @@ interface CanvasPathMethods {
void ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, optional boolean anticlockwise = false);
};

[NoInterfaceObject]
interface CanvasHitRegions {
interface mixin CanvasHitRegions {
// hit regions
[Pref="canvas.hitregions.enabled", Throws] void addHitRegion(optional HitRegionOptions options);
[Pref="canvas.hitregions.enabled"] void removeHitRegion(DOMString id);
Expand Down Expand Up @@ -381,4 +365,4 @@ interface Path2D
{
void addPath(Path2D path, optional SVGMatrix transformation);
};
Path2D implements CanvasPathMethods;
Path2D includes CanvasPathMethods;
4 changes: 2 additions & 2 deletions crates/web-sys/webidls/enabled/CharacterData.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ interface CharacterData : Node {
void replaceData(unsigned long offset, unsigned long count, DOMString data);
};

CharacterData implements ChildNode;
CharacterData implements NonDocumentTypeChildNode;
CharacterData includes ChildNode;
CharacterData includes NonDocumentTypeChildNode;
6 changes: 2 additions & 4 deletions crates/web-sys/webidls/enabled/ChildNode.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
* http://dom.spec.whatwg.org/#interface-childnode
*/

[NoInterfaceObject]
interface ChildNode {
interface mixin ChildNode {
[CEReactions, Throws, Unscopable]
void before((Node or DOMString)... nodes);
[CEReactions, Throws, Unscopable]
Expand All @@ -19,8 +18,7 @@ interface ChildNode {
void remove();
};

[NoInterfaceObject]
interface NonDocumentTypeChildNode {
interface mixin NonDocumentTypeChildNode {
[Pure]
readonly attribute Element? previousElementSibling;
[Pure]
Expand Down
4 changes: 0 additions & 4 deletions crates/web-sys/webidls/enabled/ConvolverNode.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ interface ConvolverNode : AudioNode {
attribute boolean normalize;

};

// Mozilla extension
ConvolverNode implements AudioNodePassThrough;

4 changes: 2 additions & 2 deletions crates/web-sys/webidls/enabled/Crypto.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#crypto-interface
*/

[NoInterfaceObject, Exposed=(Window,Worker)]
interface GlobalCrypto {
[Exposed=(Window,Worker)]
interface mixin GlobalCrypto {
[Throws] readonly attribute Crypto crypto;
};

Expand Down
Loading

0 comments on commit f8354b3

Please sign in to comment.