From 79db619502c938f0f6fffb9da8f059701b35af1d Mon Sep 17 00:00:00 2001 From: Jinho Bang Date: Tue, 7 Nov 2017 22:34:21 +0900 Subject: [PATCH 1/5] 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 | 247 +++++++++++++++++++++++++-------------------------------- 1 file changed, 108 insertions(+), 139 deletions(-) diff --git a/source b/source index 50168dcfd4e..a8ee0706c6d 100755 --- a/source +++ b/source @@ -9154,8 +9154,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] @@ -13172,7 +13172,7 @@ interface HTMLLinkElement : HTMLElement { [SameObject, PutForwards=value] readonly attribute DOMTokenList sizes; [CEReactions] attribute DOMString referrerPolicy; }; -HTMLLinkElement implements LinkStyle; +HTMLLinkElement includes LinkStyle;

Uses HTMLLinkElement.
@@ -14815,7 +14815,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.
@@ -15123,7 +15123,7 @@ interface HTMLStyleElement : HTMLElement { HTMLConstructor] interface HTMLBodyElement : HTMLElement {}; -HTMLBodyElement implements WindowEventHandlers; +HTMLBodyElement includes WindowEventHandlers;
Uses HTMLBodyElement.
@@ -19321,7 +19321,7 @@ interface HTMLAnchorElement : HTMLElement { [CEReactions] attribute DOMString referrerPolicy; }; -HTMLAnchorElement implements HTMLHyperlinkElementUtils; +HTMLAnchorElement includes HTMLHyperlinkElementUtils;
Uses HTMLAnchorElement.
@@ -22427,9 +22427,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;
@@ -38573,7 +38572,7 @@ interface HTMLAreaElement : HTMLElement {
   [SameObject, PutForwards=value] readonly attribute DOMTokenList relList;
   [CEReactions] attribute DOMString referrerPolicy;
 };
-HTMLAreaElement implements HTMLHyperlinkElementUtils;
+HTMLAreaElement includes HTMLHyperlinkElementUtils;
Uses HTMLAreaElement.
@@ -59592,32 +59591,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); @@ -59635,15 +59632,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) @@ -59658,8 +59653,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) @@ -59672,8 +59666,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) @@ -59681,22 +59674,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"); @@ -59712,18 +59702,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, From 395a38e11c9164ad45b6fa3e099bd6298e22046c Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 20 Dec 2017 15:19:25 -0500 Subject: [PATCH 2/5] Fix extraneous newlines --- source | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/source b/source index a8ee0706c6d..eac7710059a 100755 --- a/source +++ b/source @@ -22427,8 +22427,7 @@ document.body.appendChild(wbr);

API for a and area elements

-
-interface mixin HTMLHyperlinkElementUtils {
+  
interface mixin HTMLHyperlinkElementUtils {
   [CEReactions] stringifier attribute USVString href;
   readonly attribute USVString origin;
   [CEReactions] attribute USVString protocol;
@@ -73911,8 +73910,7 @@ addShortcutKeyLabel(document.getElementById('c'));

Making document regions editable: The contenteditable content attribute

-
-interface mixin ElementContentEditable {
+  
interface mixin ElementContentEditable {
   [CEReactions] attribute DOMString contentEditable;
   readonly attribute boolean isContentEditable;
   [CEReactions] attribute DOMString inputMode;
@@ -86028,8 +86026,7 @@ interface ApplicationCache : EventTarget {
 
   
 
-  
-interface mixin NavigatorOnLine {
+  
interface mixin NavigatorOnLine {
   readonly attribute boolean onLine;
 };
@@ -90122,8 +90119,7 @@ typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEvent
IDL definitions
-
-interface mixin GlobalEventHandlers {
+  
interface mixin GlobalEventHandlers {
   attribute EventHandler onabort;
   attribute EventHandler onauxclick;
   attribute EventHandler onblur;
@@ -91507,8 +91503,7 @@ interface Navigator {
 
   
Client identification
-
-interface mixin NavigatorID {
+  
interface mixin NavigatorID {
   readonly attribute DOMString appCodeName; // constant "Mozilla"
   readonly attribute DOMString appName; // constant "Netscape"
   readonly attribute DOMString appVersion;
@@ -91694,8 +91689,7 @@ interface mixin NavigatorID {
 
   
Language preferences
-
-interface mixin NavigatorLanguage {
+  
interface mixin NavigatorLanguage {
   readonly attribute DOMString language;
   readonly attribute FrozenArray<DOMString> languages;
 };
@@ -91793,8 +91787,7 @@ interface mixin NavigatorLanguage {
Custom scheme handlers: the registerProtocolHandler() method
-
-interface mixin NavigatorContentUtils {
+  
interface mixin NavigatorContentUtils {
   void registerProtocolHandler(DOMString scheme, USVString url, DOMString title);
   void unregisterProtocolHandler(DOMString scheme, USVString url);
 };
@@ -92114,8 +92107,7 @@ interface mixin NavigatorContentUtils {
Cookies
-
-interface mixin NavigatorCookies {
+  
interface mixin NavigatorCookies {
   readonly attribute boolean cookieEnabled;
 };
@@ -92143,8 +92135,7 @@ interface mixin NavigatorCookies {
Plugins
-
-interface mixin NavigatorPlugins {
+  
interface mixin NavigatorPlugins {
   [SameObject] readonly attribute PluginArray plugins;
   [SameObject] readonly attribute MimeTypeArray mimeTypes;
   boolean javaEnabled();
@@ -97452,8 +97443,7 @@ interface SharedWorkerGlobalScope : WorkerGlobalScope {
   
The AbstractWorker abstract interface
Properties present on both Worker and SharedWorker
-
-interface mixin AbstractWorker {
+  
interface mixin AbstractWorker {
   attribute EventHandler onerror;
 };
@@ -97916,8 +97906,7 @@ interface SharedWorker : EventTarget { -
-interface mixin NavigatorConcurrentHardware {
+  
interface mixin NavigatorConcurrentHardware {
   readonly attribute unsigned long long hardwareConcurrency;
 };
@@ -98425,8 +98414,7 @@ interface Storage {

The sessionStorage attribute

-
-interface mixin WindowSessionStorage {
+  
interface mixin WindowSessionStorage {
   readonly attribute Storage sessionStorage;
 };
 Window includes WindowSessionStorage;
@@ -98490,8 +98478,7 @@ interface mixin WindowSessionStorage {

The localStorage attribute

-
-interface mixin WindowLocalStorage {
+  
interface mixin WindowLocalStorage {
   readonly attribute Storage localStorage;
 };
 Window includes WindowLocalStorage;
From 85408e2001c545679eefb45d46ae223c0d278859 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 20 Dec 2017 15:23:54 -0500 Subject: [PATCH 3/5] Missed the new-ish NoncedElement --- source | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source b/source index eac7710059a..abdd32fc6a1 100755 --- a/source +++ b/source @@ -7036,8 +7036,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;
 };
From cf4322841ed8f458e7f13eebea0fbf61b6959d3c Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 20 Dec 2017 15:29:26 -0500 Subject: [PATCH 4/5] Tweak a heading too --- source | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source b/source index abdd32fc6a1..c888a15c622 100755 --- a/source +++ b/source @@ -97439,7 +97439,8 @@ interface SharedWorkerGlobalScope : WorkerGlobalScope {

Creating workers

-
The AbstractWorker abstract interface
+
The + AbstractWorker mixin
Properties present on both Worker and SharedWorker
interface mixin AbstractWorker {

From caad0e48ca547e2b1adc744d6d376e8fc0f8a79d Mon Sep 17 00:00:00 2001
From: Domenic Denicola 
Date: Wed, 20 Dec 2017 15:31:05 -0500
Subject: [PATCH 5/5] Fix reference to "interfaces" for navigator

---
 source | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source b/source
index c888a15c622..cbd9093da6c 100755
--- a/source
+++ b/source
@@ -91494,8 +91494,8 @@ interface Navigator {
 
   
-

These interfaces are defined separately so that WorkerNavigator can re-use parts - of the Navigator interface.

+

These interface mixins are defined separately so that WorkerNavigator can re-use + parts of the Navigator interface.