Skip to content

Commit

Permalink
web-sys: Use mixins instead of [NoInterfaceObject] interfaces and `…
Browse files Browse the repository at this point in the history
…implements`

I think these might all be from before WebIDL mixins existed. Either way,
multiple inheritance of interfaces that don't have exposed interface objects is
equivalent to mixins.
  • Loading branch information
fitzgen committed Aug 15, 2018
1 parent 69cc772 commit b8afa0a
Show file tree
Hide file tree
Showing 99 changed files with 226 additions and 520 deletions.
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;
};
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: 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
11 changes: 5 additions & 6 deletions crates/web-sys/webidls/enabled/DOMException.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
// invalid widl
//interface StackFrame;

[NoInterfaceObject,
Exposed=(Window,Worker,System)]
interface ExceptionMembers
[Exposed=(Window,Worker,System)]
interface mixin ExceptionMembers
{
// The nsresult associated with this exception.
readonly attribute unsigned long result;
Expand All @@ -34,7 +33,7 @@ interface ExceptionMembers
readonly attribute DOMString filename;
// Valid line numbers begin at '1'. '0' indicates unknown.
readonly attribute unsigned long lineNumber;
// Valid column numbers begin at 0.
// Valid column numbers begin at 0.
// We don't have an unambiguous indicator for unknown.
readonly attribute unsigned long columnNumber;

Expand Down Expand Up @@ -62,7 +61,7 @@ interface Exception {
stringifier;
};

Exception implements ExceptionMembers;
Exception includes ExceptionMembers;

// XXXkhuey this is an 'exception', not an interface, but we don't have any
// parser or codegen mechanisms for dealing with exceptions.
Expand Down Expand Up @@ -105,4 +104,4 @@ interface DOMException {

// XXXkhuey copy all of Gecko's non-standard stuff onto DOMException, but leave
// the prototype chain sane.
DOMException implements ExceptionMembers;
DOMException includes ExceptionMembers;
6 changes: 3 additions & 3 deletions crates/web-sys/webidls/enabled/DOMRequest.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

enum DOMRequestReadyState { "pending", "done" };

[Exposed=(Window,Worker,System), NoInterfaceObject]
interface DOMRequestShared {
[Exposed=(Window,Worker,System)]
interface mixin DOMRequestShared {
readonly attribute DOMRequestReadyState readyState;

readonly attribute any result;
Expand All @@ -29,4 +29,4 @@ interface DOMRequest : EventTarget {
void fireDetailedError(DOMException aError);
};

DOMRequest implements DOMRequestShared;
DOMRequest includes DOMRequestShared;
18 changes: 9 additions & 9 deletions crates/web-sys/webidls/enabled/Document.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,12 @@ partial interface Document {
readonly attribute FlashClassification documentFlashClassification;
};

Document implements XPathEvaluator;
Document implements GlobalEventHandlers;
Document implements DocumentAndElementEventHandlers;
Document implements TouchEventHandlers;
Document implements ParentNode;
Document implements OnErrorEventHandlerForNodes;
Document implements GeometryUtils;
Document implements FontFaceSource;
Document implements DocumentOrShadowRoot;
Document includes XPathEvaluator;
Document includes GlobalEventHandlers;
Document includes DocumentAndElementEventHandlers;
Document includes TouchEventHandlers;
Document includes ParentNode;
Document includes OnErrorEventHandlerForNodes;
Document includes GeometryUtils;
Document includes FontFaceSource;
Document includes DocumentOrShadowRoot;
2 changes: 1 addition & 1 deletion crates/web-sys/webidls/enabled/DocumentFragment.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ partial interface DocumentFragment {
NodeList querySelectorAll(DOMString selectors);
};

DocumentFragment implements ParentNode;
DocumentFragment includes ParentNode;
3 changes: 1 addition & 2 deletions crates/web-sys/webidls/enabled/DocumentOrShadowRoot.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
* http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-the-documentorshadowroot-mixin
*/

[NoInterfaceObject]
interface DocumentOrShadowRoot {
interface mixin DocumentOrShadowRoot {
// Not implemented yet: bug 1430308.
// Selection? getSelection();
Element? elementFromPoint (float x, float y);
Expand Down
2 changes: 1 addition & 1 deletion crates/web-sys/webidls/enabled/DocumentType.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ interface DocumentType : Node {
readonly attribute DOMString systemId;
};

DocumentType implements ChildNode;
DocumentType includes ChildNode;
10 changes: 5 additions & 5 deletions crates/web-sys/webidls/enabled/Element.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,11 @@ partial interface Element {
attribute DOMString slot;
};

Element implements ChildNode;
Element implements NonDocumentTypeChildNode;
Element implements ParentNode;
Element implements Animatable;
Element implements GeometryUtils;
Element includes ChildNode;
Element includes NonDocumentTypeChildNode;
Element includes ParentNode;
Element includes Animatable;
Element includes GeometryUtils;

// https://fullscreen.spec.whatwg.org/#api
partial interface Element {
Expand Down
Loading

0 comments on commit b8afa0a

Please sign in to comment.