Include applicable state information alongside all the other other property information

This makes it easier to consume the data in the frontend.

Bug: 1325812
Change-Id: I37979a7266af728399a9c4938bf97f77e5781b5b
Signed-off-by: Victor Porof <victorporof@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3702682
Reviewed-by: Mathias Bynens <mathias@chromium.org>
diff --git a/scripts/webidl-properties/index.js b/scripts/webidl-properties/index.js
index d8c6099..6911d97 100644
--- a/scripts/webidl-properties/index.js
+++ b/scripts/webidl-properties/index.js
@@ -21,8 +21,8 @@
 const specs = await Promise.all(names.map(name => files[name].parse().then(idls => ({name, idls}))));
 
 const output = addMetadata(getIDLProps(specs));
-const missing = getMissingTypes(output);
 
+const missing = getMissingTypes(output);
 for (const type of missing) {
   console.warn('Found missing type:', type);
 }
@@ -51,6 +51,8 @@
   // A bitfield of the specs in which the property is found.
   // If missing, it implies the default spec: "html".
   specs?: number;
+  // The "states" in which this property is "applicable".
+  rules?: Array<DOMPinnedWebIDLRule>;
 }
 
 export interface DOMPinnedWebIDLType {
@@ -64,12 +66,12 @@
     [PropName: string]: DOMPinnedWebIDLProp,
   };
   // The "states" in which only certain properties are "applicable".
-  states?: {
-    // A CSS selector such as "[type=checkbox]".
-    [State: string]: {
-      [PropName: string]: DOMPinnedWebIDLProp,
-    },
-  };
+  rules?: Array<DOMPinnedWebIDLRule>;
+}
+
+export interface DOMPinnedWebIDLRule {
+  when: string;
+  is: string;
 }
 
 export interface DOMPinnedPropertiesDataset {