From c8867a179c21134021dc3435e98c1b9c4542d794 Mon Sep 17 00:00:00 2001
From: Jinho Bang
Date: Thu, 21 Dec 2017 05:39:18 +0900
Subject: [PATCH] Use Web IDL's new-ish interface mixins concept
WebIDL recently introduced dedicated syntax for mixins [1]. This replaces the
existing [NoInterfaceObject] and "implements" syntax with "interface mixin" and
"includes" in the appropriate places.
Closes #3194.
[1]: https://github.com/heycam/webidl/commit/45e8173d40ddff8dcf81697326e094bcf8b92920
---
source | 244 +++++++++++++++++++++++----------------------------------
1 file changed, 100 insertions(+), 144 deletions(-)
diff --git a/source b/source
index cc56cc8e237..637b722fa7c 100755
--- a/source
+++ b/source
@@ -7041,8 +7041,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
NoncedElement
interface defined below. Unless otherwise specified, the slot's value
is the empty string.
- [NoInterfaceObject]
-interface NoncedElement {
+ interface mixin NoncedElement {
attribute DOMString nonce;
};
@@ -9159,8 +9158,8 @@ partial interface Document {
// special event handler IDL attributes that only apply to Document objects
[LenientThis] attribute EventHandler onreadystatechange;
};
-Document implements GlobalEventHandlers;
-Document implements DocumentAndElementEventHandlers;
+Document includes GlobalEventHandlers;
+Document includes DocumentAndElementEventHandlers;
The Document
has an HTTPS state (an HTTPS state value), initially "HTMLElement : Element {
[CEReactions] attribute [TreatNullAs=EmptyString] DOMString innerText;
};
-HTMLElement implements GlobalEventHandlers;
-HTMLElement implements DocumentAndElementEventHandlers;
-HTMLElement implements ElementContentEditable;
-HTMLElement implements NoncedElement;
+HTMLElement includes GlobalEventHandlers;
+HTMLElement includes DocumentAndElementEventHandlers;
+HTMLElement includes ElementContentEditable;
+HTMLElement includes NoncedElement;
// Note: intentionally not [HTMLConstructor]
[Exposed=Window]
@@ -13179,7 +13178,7 @@ interface HTMLLinkElement : HTMLElement {
[SameObject, PutForwards=value] readonly attribute DOMTokenList sizes;
[CEReactions] attribute DOMString referrerPolicy;
};
-HTMLLinkElement implements LinkStyle;
+HTMLLinkElement includes LinkStyle;
Uses HTMLLinkElement
.
@@ -14822,7 +14821,7 @@ people expect to have work and what is necessary.
interface HTMLStyleElement : HTMLElement {
[CEReactions] attribute DOMString media;
};
-HTMLStyleElement implements LinkStyle;
+HTMLStyleElement includes LinkStyle;
Uses HTMLStyleElement
.
@@ -15130,7 +15129,7 @@ interface HTMLStyleElement : HTMLElement {
HTMLConstructor]
interface HTMLBodyElement : HTMLElement {};
-HTMLBodyElement implements WindowEventHandlers;
+HTMLBodyElement includes WindowEventHandlers;
Uses HTMLBodyElement
.
@@ -19328,7 +19327,7 @@ interface HTMLAnchorElement : HTMLElement {
[CEReactions] attribute DOMString referrerPolicy;
};
-HTMLAnchorElement implements HTMLHyperlinkElementUtils;
+HTMLAnchorElement includes HTMLHyperlinkElementUtils;
Uses HTMLAnchorElement
.
@@ -22434,9 +22433,7 @@ document.body.appendChild(wbr);
API for a
and area
elements
- [Exposed=Window,
- NoInterfaceObject]
-interface HTMLHyperlinkElementUtils {
+ interface mixin HTMLHyperlinkElementUtils {
[CEReactions] stringifier attribute USVString href;
readonly attribute USVString origin;
[CEReactions] attribute USVString protocol;
@@ -38580,7 +38577,7 @@ interface HTMLAreaElement : HTMLElement {
[SameObject, PutForwards=value] readonly attribute DOMTokenList relList;
[CEReactions] attribute DOMString referrerPolicy;
};
-HTMLAreaElement implements HTMLHyperlinkElementUtils;
+HTMLAreaElement includes HTMLHyperlinkElementUtils;
Uses HTMLAreaElement
.
@@ -59621,32 +59618,30 @@ interface CanvasRenderingContext2D {
// back-reference to the canvas
readonly attribute HTMLCanvasElement canvas;
};
-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 CanvasPath;
-
-[NoInterfaceObject, Exposed=(Window,Worker)]
-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 CanvasPath;
+
+interface mixin CanvasState {
// state
void save(); // push state on state stack
void restore(); // pop state stack and restore state
};
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface CanvasTransform {
+interface mixin CanvasTransform {
// transformations (default transform is the identity matrix)
void scale(unrestricted double x, unrestricted double y);
void rotate(unrestricted double angle);
@@ -59664,15 +59659,13 @@ interface CanvasTransform {
-->
};
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface CanvasCompositing {
+interface mixin CanvasCompositing {
// compositing
attribute unrestricted double globalAlpha; // (default 1.0)
attribute DOMString globalCompositeOperation; // (default source-over)
};
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface CanvasImageSmoothing {
+interface mixin CanvasImageSmoothing {
// image smoothing
attribute boolean imageSmoothingEnabled; // (default true)
attribute ImageSmoothingQuality imageSmoothingQuality; // (default low)
@@ -59687,8 +59680,7 @@ interface CanvasImageSmoothing {
-->
};
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface CanvasFillStrokeStyles {
+interface mixin CanvasFillStrokeStyles {
// colors and styles (see also the CanvasPathDrawingStyles and CanvasTextDrawingStyles interfaces)
attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (default black)
attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (default black)
@@ -59701,8 +59693,7 @@ interface CanvasFillStrokeStyles {
-->
};
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface CanvasShadowStyles {
+interface mixin CanvasShadowStyles {
// shadows
attribute unrestricted double shadowOffsetX; // (default 0)
attribute unrestricted double shadowOffsetY; // (default 0)
@@ -59710,22 +59701,19 @@ interface CanvasShadowStyles {
attribute DOMString shadowColor; // (default transparent black)
};
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface CanvasFilters {
+interface mixin CanvasFilters {
// filters
attribute DOMString filter; // (default "none")
};
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface CanvasRect {
+interface mixin CanvasRect {
// rects
void clearRect(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);
void strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
};
-[NoInterfaceObject, Exposed=(Window,Worker)]
-interface CanvasDrawPath {
+interface mixin CanvasDrawPath {
// path API (see also CanvasPath)
void beginPath();
void fill(optional CanvasFillRule fillRule = "nonzero");
@@ -59741,18 +59729,14 @@ interface CanvasDrawPath {
boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y);
};
-[Exposed=Window,
- NoInterfaceObject]
-interface CanvasUserInterface {
+interface mixin CanvasUserInterface {
void drawFocusIfNeeded(Element element);
void drawFocusIfNeeded(Path2D path, Element element);
void scrollPathIntoView();
void scrollPathIntoView(Path2D path);
};
-[Exposed=Window,
- NoInterfaceObject]
-interface CanvasText {
+interface mixin CanvasText {
// text (see also the CanvasPathDrawingStyles and CanvasTextDrawingStyles interfaces)
void fillText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
void strokeText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
Jirka Kosek,
Jjgod Jiang,