From 2545bea68fcf2e9770885bd9593acd7dfc157f52 Mon Sep 17 00:00:00 2001 From: Jinho Bang Date: Tue, 7 Nov 2017 22:34:21 +0900 Subject: [PATCH] Use `interface mixins` instead of `[NoInterfaceObject]` WebIDL recently introduced dedicated syntax for mixins[1]. So, we can replace `[NoInterfaceObject]` and `implements` with `interface mixin` and `includes`. [1] https://github.com/heycam/webidl/commit/45e8173d40ddff8dcf81697326e094bcf8b92920 --- source | 248 +++++++++++++++++++++++++-------------------------------- 1 file changed, 110 insertions(+), 138 deletions(-) diff --git a/source b/source index 312203f2747..261bc586412 100755 --- a/source +++ b/source @@ -9067,8 +9067,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 includes GlobalEventHandlers; +HTMLElement includes DocumentAndElementEventHandlers; +HTMLElement includes ElementContentEditable; // Note: intentionally not [HTMLConstructor] [Exposed=Window] @@ -13093,7 +13093,7 @@ interface HTMLLinkElement : HTMLElement { [CEReactions] attribute DOMString workerType; [CEReactions] attribute DOMString updateViaCache; }; -HTMLLinkElement implements LinkStyle; +HTMLLinkElement includes LinkStyle;

Uses HTMLLinkElement.
@@ -14832,7 +14832,7 @@ interface HTMLStyleElement : HTMLElement { [CEReactions] attribute DOMString media; [CEReactions] attribute DOMString nonce; }; -HTMLStyleElement implements LinkStyle; +HTMLStyleElement includes LinkStyle;
Uses HTMLStyleElement.
@@ -15146,7 +15146,7 @@ interface HTMLStyleElement : HTMLElement { HTMLConstructor] interface HTMLBodyElement : HTMLElement {}; -HTMLBodyElement implements WindowEventHandlers; +HTMLBodyElement includes WindowEventHandlers;
Uses HTMLBodyElement.
@@ -19344,7 +19344,7 @@ interface HTMLAnchorElement : HTMLElement { [CEReactions] attribute DOMString referrerPolicy; }; -HTMLAnchorElement implements HTMLHyperlinkElementUtils; +HTMLAnchorElement includes HTMLHyperlinkElementUtils;
Uses HTMLAnchorElement.
@@ -22450,9 +22450,8 @@ 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;
@@ -38353,7 +38352,7 @@ interface HTMLAreaElement : HTMLElement {
   [SameObject, PutForwards=value] readonly attribute DOMTokenList relList;
   [CEReactions] attribute DOMString referrerPolicy;
 };
-HTMLAreaElement implements HTMLHyperlinkElementUtils;
+HTMLAreaElement includes HTMLHyperlinkElementUtils;
Uses HTMLAreaElement.
@@ -59619,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); @@ -59662,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) @@ -59685,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) @@ -59699,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) @@ -59708,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"); @@ -59739,18 +59729,16 @@ interface CanvasDrawPath { boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y); }; -[Exposed=Window, - NoInterfaceObject] -interface CanvasUserInterface { +[Exposed=Window] +interface mixin CanvasUserInterface { void drawFocusIfNeeded(Element element); void drawFocusIfNeeded(Path2D path, Element element); void scrollPathIntoView(); void scrollPathIntoView(Path2D path); }; -[Exposed=Window, - NoInterfaceObject] -interface CanvasText { +[Exposed=Window] +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);