001package Torello.Browser;
002
003import java.util.*;
004import javax.json.*;
005import javax.json.stream.*;
006import java.io.*;
007
008import java.lang.reflect.Method;
009import java.lang.reflect.Parameter;
010import java.util.function.Function;
011
012import Torello.Java.Additional.*;
013
014import static Torello.Java.Additional.JFlag.*;
015
016import Torello.Java.StrCmpr;
017import Torello.JavaDoc.StaticFunctional;
018import Torello.JavaDoc.JDHeaderBackgroundImg;
019import Torello.JavaDoc.Excuse;
020
021/**
022 * <SPAN CLASS=CopiedJDK><B>This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles)
023 * have an associated <CODE>id</CODE> used in subsequent operations on the related object. Each object type has
024 * a specific <CODE>id</CODE> structure, and those are not interchangeable between objects of different kinds.
025 * CSS objects can be loaded using the <CODE>get*ForNode()</CODE> calls (which accept a DOM node id). A client
026 * can also keep track of stylesheets via the <CODE>styleSheetAdded</CODE>/<CODE>styleSheetRemoved</CODE> events and
027 * subsequently load the required stylesheet contents using the <CODE>getStyleSheet[Text]()</CODE> methods.</B></SPAN>
028 * 
029 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE>
030 */
031@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION})
032@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE")
033public class CSS
034{
035    // ********************************************************************************************
036    // ********************************************************************************************
037    // Class Header Stuff
038    // ********************************************************************************************
039    // ********************************************************************************************
040
041
042    // No Pubic Constructors
043    private CSS () { }
044
045    // These two Vector's are used by all the "Methods" exported by this class.  java.lang.reflect
046    // is used to generate the JSON String's.  It saves thousands of lines of Auto-Generated Code.
047    private static final Map<String, Vector<String>>    parameterNames = new HashMap<>();
048    private static final Map<String, Vector<Class<?>>>  parameterTypes = new HashMap<>();
049
050    // Some Methods do not take any parameters - for instance all the "enable()" and "disable()"
051    // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now,
052    // offically, two empty-vectors.  One for String's, and the other for Classes.
053
054    private static final Vector<String>     EMPTY_VEC_STR = new Vector<>();
055    private static final Vector<Class<?>>   EMPTY_VEC_CLASS = new Vector<>();
056
057    static
058    {
059        for (Method m : CSS.class.getMethods())
060        {
061            // This doesn't work!  The parameter names are all "arg0" ... "argN"
062            // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter!
063            //
064            // Vector<String> parameterNamesList = new Vector<>(); -- NOPE!
065
066            Vector<Class<?>> parameterTypesList = new Vector<>();
067        
068            for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType());
069
070            parameterTypes.put(
071                m.getName(),
072                (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS
073            );
074        }
075    }
076
077    static
078    {
079        Vector<String> v = null;
080
081        v = new Vector<String>(3);
082        parameterNames.put("addRule", v);
083        Collections.addAll(v, new String[]
084        { "styleSheetId", "ruleText", "location", });
085
086        v = new Vector<String>(1);
087        parameterNames.put("collectClassNames", v);
088        Collections.addAll(v, new String[]
089        { "styleSheetId", });
090
091        v = new Vector<String>(1);
092        parameterNames.put("createStyleSheet", v);
093        Collections.addAll(v, new String[]
094        { "frameId", });
095
096        parameterNames.put("disable", EMPTY_VEC_STR);
097
098        parameterNames.put("enable", EMPTY_VEC_STR);
099
100        v = new Vector<String>(2);
101        parameterNames.put("forcePseudoState", v);
102        Collections.addAll(v, new String[]
103        { "nodeId", "forcedPseudoClasses", });
104
105        v = new Vector<String>(1);
106        parameterNames.put("getBackgroundColors", v);
107        Collections.addAll(v, new String[]
108        { "nodeId", });
109
110        v = new Vector<String>(1);
111        parameterNames.put("getComputedStyleForNode", v);
112        Collections.addAll(v, new String[]
113        { "nodeId", });
114
115        v = new Vector<String>(1);
116        parameterNames.put("getInlineStylesForNode", v);
117        Collections.addAll(v, new String[]
118        { "nodeId", });
119
120        v = new Vector<String>(1);
121        parameterNames.put("getMatchedStylesForNode", v);
122        Collections.addAll(v, new String[]
123        { "nodeId", });
124
125        parameterNames.put("getMediaQueries", EMPTY_VEC_STR);
126
127        v = new Vector<String>(1);
128        parameterNames.put("getPlatformFontsForNode", v);
129        Collections.addAll(v, new String[]
130        { "nodeId", });
131
132        v = new Vector<String>(1);
133        parameterNames.put("getStyleSheetText", v);
134        Collections.addAll(v, new String[]
135        { "styleSheetId", });
136
137        v = new Vector<String>(1);
138        parameterNames.put("trackComputedStyleUpdates", v);
139        Collections.addAll(v, new String[]
140        { "propertiesToTrack", });
141
142        parameterNames.put("takeComputedStyleUpdates", EMPTY_VEC_STR);
143
144        v = new Vector<String>(3);
145        parameterNames.put("setEffectivePropertyValueForNode", v);
146        Collections.addAll(v, new String[]
147        { "nodeId", "propertyName", "value", });
148
149        v = new Vector<String>(3);
150        parameterNames.put("setKeyframeKey", v);
151        Collections.addAll(v, new String[]
152        { "styleSheetId", "range", "keyText", });
153
154        v = new Vector<String>(3);
155        parameterNames.put("setMediaText", v);
156        Collections.addAll(v, new String[]
157        { "styleSheetId", "range", "text", });
158
159        v = new Vector<String>(3);
160        parameterNames.put("setContainerQueryText", v);
161        Collections.addAll(v, new String[]
162        { "styleSheetId", "range", "text", });
163
164        v = new Vector<String>(3);
165        parameterNames.put("setRuleSelector", v);
166        Collections.addAll(v, new String[]
167        { "styleSheetId", "range", "selector", });
168
169        v = new Vector<String>(2);
170        parameterNames.put("setStyleSheetText", v);
171        Collections.addAll(v, new String[]
172        { "styleSheetId", "text", });
173
174        v = new Vector<String>(1);
175        parameterNames.put("setStyleTexts", v);
176        Collections.addAll(v, new String[]
177        { "edits", });
178
179        parameterNames.put("startRuleUsageTracking", EMPTY_VEC_STR);
180
181        parameterNames.put("stopRuleUsageTracking", EMPTY_VEC_STR);
182
183        parameterNames.put("takeCoverageDelta", EMPTY_VEC_STR);
184
185        v = new Vector<String>(1);
186        parameterNames.put("setLocalFontsEnabled", v);
187        Collections.addAll(v, new String[]
188        { "enabled", });
189    }
190
191
192    // ********************************************************************************************
193    // ********************************************************************************************
194    // Types - Static Inner Classes
195    // ********************************************************************************************
196    // ********************************************************************************************
197
198    // public static class StyleSheetId => String
199    
200    /**
201     * Stylesheet type: "injected" for stylesheets injected via extension, "user-agent" for user-agent
202     * stylesheets, "inspector" for stylesheets created by the inspector (i.e. those holding the "via
203     * inspector" rules), "regular" for regular stylesheets.
204     */
205    public static final String[] StyleSheetOrigin =
206    { "injected", "user-agent", "inspector", "regular", };
207    
208    /** CSS rule collection for a single pseudo style. */
209    public static class PseudoElementMatches extends BaseType
210    {
211        /** For Object Serialization.  java.io.Serializable */
212        protected static final long serialVersionUID = 1;
213        
214        public boolean[] optionals()
215        { return new boolean[] { false, false, }; }
216        
217        /** Pseudo element type. */
218        public final String pseudoType;
219        
220        /** Matches of CSS rules applicable to the pseudo style. */
221        public final CSS.RuleMatch[] matches;
222        
223        /**
224         * Constructor
225         *
226         * @param pseudoType Pseudo element type.
227         * 
228         * @param matches Matches of CSS rules applicable to the pseudo style.
229         */
230        public PseudoElementMatches(String pseudoType, CSS.RuleMatch[] matches)
231        {
232            // Exception-Check(s) to ensure that if any parameters which are not declared as
233            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
234            
235            if (pseudoType == null) BRDPC.throwNPE("pseudoType");
236            if (matches == null)    BRDPC.throwNPE("matches");
237            
238            // Exception-Check(s) to ensure that if any parameters which must adhere to a
239            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
240            
241            BRDPC.checkIAE("pseudoType", pseudoType, "DOM.PseudoType", DOM.PseudoType);
242            
243            this.pseudoType  = pseudoType;
244            this.matches     = matches;
245        }
246        
247        /**
248         * JSON Object Constructor
249         * @param jo A Json-Object having data about an instance of {@code 'PseudoElementMatches'}.
250         */
251        public PseudoElementMatches (JsonObject jo)
252        {
253            this.pseudoType  = ReadJSON.getString(jo, "pseudoType", false, true);
254            this.matches     = (jo.getJsonArray("matches") == null)
255            ? null
256            : ReadArrJSON.DimN.objArr(jo.getJsonArray("matches"), null, 0, CSS.RuleMatch[].class);
257        }
258        
259    }
260    
261    /** Inherited CSS rule collection from ancestor node. */
262    public static class InheritedStyleEntry extends BaseType
263    {
264        /** For Object Serialization.  java.io.Serializable */
265        protected static final long serialVersionUID = 1;
266        
267        public boolean[] optionals()
268        { return new boolean[] { true, false, }; }
269        
270        /**
271         * The ancestor node's inline style, if any, in the style inheritance chain.
272         * <BR />
273         * <BR /><B>OPTIONAL</B>
274         */
275        public final CSS.CSSStyle inlineStyle;
276        
277        /** Matches of CSS rules matching the ancestor node in the style inheritance chain. */
278        public final CSS.RuleMatch[] matchedCSSRules;
279        
280        /**
281         * Constructor
282         *
283         * @param inlineStyle The ancestor node's inline style, if any, in the style inheritance chain.
284         * <BR /><B>OPTIONAL</B>
285         * 
286         * @param matchedCSSRules Matches of CSS rules matching the ancestor node in the style inheritance chain.
287         */
288        public InheritedStyleEntry(CSS.CSSStyle inlineStyle, CSS.RuleMatch[] matchedCSSRules)
289        {
290            // Exception-Check(s) to ensure that if any parameters which are not declared as
291            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
292            
293            if (matchedCSSRules == null) BRDPC.throwNPE("matchedCSSRules");
294            
295            this.inlineStyle      = inlineStyle;
296            this.matchedCSSRules  = matchedCSSRules;
297        }
298        
299        /**
300         * JSON Object Constructor
301         * @param jo A Json-Object having data about an instance of {@code 'InheritedStyleEntry'}.
302         */
303        public InheritedStyleEntry (JsonObject jo)
304        {
305            this.inlineStyle      = ReadJSON.XL.getObject(jo, "inlineStyle", CSS.CSSStyle.class, true, false);
306            this.matchedCSSRules  = (jo.getJsonArray("matchedCSSRules") == null)
307            ? null
308            : ReadArrJSON.DimN.objArr(jo.getJsonArray("matchedCSSRules"), null, 0, CSS.RuleMatch[].class);
309        }
310        
311    }
312    
313    /** Match data for a CSS rule. */
314    public static class RuleMatch extends BaseType
315    {
316        /** For Object Serialization.  java.io.Serializable */
317        protected static final long serialVersionUID = 1;
318        
319        public boolean[] optionals()
320        { return new boolean[] { false, false, }; }
321        
322        /** CSS rule in the match. */
323        public final CSS.CSSRule rule;
324        
325        /** Matching selector indices in the rule's selectorList selectors (0-based). */
326        public final int[] matchingSelectors;
327        
328        /**
329         * Constructor
330         *
331         * @param rule CSS rule in the match.
332         * 
333         * @param matchingSelectors Matching selector indices in the rule's selectorList selectors (0-based).
334         */
335        public RuleMatch(CSS.CSSRule rule, int[] matchingSelectors)
336        {
337            // Exception-Check(s) to ensure that if any parameters which are not declared as
338            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
339            
340            if (rule == null)              BRDPC.throwNPE("rule");
341            if (matchingSelectors == null) BRDPC.throwNPE("matchingSelectors");
342            
343            this.rule               = rule;
344            this.matchingSelectors  = matchingSelectors;
345        }
346        
347        /**
348         * JSON Object Constructor
349         * @param jo A Json-Object having data about an instance of {@code 'RuleMatch'}.
350         */
351        public RuleMatch (JsonObject jo)
352        {
353            this.rule               = ReadJSON.XL.getObject(jo, "rule", CSS.CSSRule.class, false, true);
354            this.matchingSelectors  = (jo.getJsonArray("matchingSelectors") == null)
355            ? null
356            : ReadArrJSON.DimN.intArr(jo.getJsonArray("matchingSelectors"), -1, 0, null, int[].class);;
357        }
358        
359    }
360    
361    /** Data for a simple selector (these are delimited by commas in a selector list). */
362    public static class Value extends BaseType
363    {
364        /** For Object Serialization.  java.io.Serializable */
365        protected static final long serialVersionUID = 1;
366        
367        public boolean[] optionals()
368        { return new boolean[] { false, true, }; }
369        
370        /** Value text. */
371        public final String text;
372        
373        /**
374         * Value range in the underlying resource (if available).
375         * <BR />
376         * <BR /><B>OPTIONAL</B>
377         */
378        public final CSS.SourceRange range;
379        
380        /**
381         * Constructor
382         *
383         * @param text Value text.
384         * 
385         * @param range Value range in the underlying resource (if available).
386         * <BR /><B>OPTIONAL</B>
387         */
388        public Value(String text, CSS.SourceRange range)
389        {
390            // Exception-Check(s) to ensure that if any parameters which are not declared as
391            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
392            
393            if (text == null) BRDPC.throwNPE("text");
394            
395            this.text   = text;
396            this.range  = range;
397        }
398        
399        /**
400         * JSON Object Constructor
401         * @param jo A Json-Object having data about an instance of {@code 'Value'}.
402         */
403        public Value (JsonObject jo)
404        {
405            this.text   = ReadJSON.getString(jo, "text", false, true);
406            this.range  = ReadJSON.XL.getObject(jo, "range", CSS.SourceRange.class, true, false);
407        }
408        
409    }
410    
411    /** Selector list data. */
412    public static class SelectorList extends BaseType
413    {
414        /** For Object Serialization.  java.io.Serializable */
415        protected static final long serialVersionUID = 1;
416        
417        public boolean[] optionals()
418        { return new boolean[] { false, false, }; }
419        
420        /** Selectors in the list. */
421        public final CSS.Value[] selectors;
422        
423        /** Rule selector text. */
424        public final String text;
425        
426        /**
427         * Constructor
428         *
429         * @param selectors Selectors in the list.
430         * 
431         * @param text Rule selector text.
432         */
433        public SelectorList(CSS.Value[] selectors, String text)
434        {
435            // Exception-Check(s) to ensure that if any parameters which are not declared as
436            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
437            
438            if (selectors == null) BRDPC.throwNPE("selectors");
439            if (text == null)      BRDPC.throwNPE("text");
440            
441            this.selectors  = selectors;
442            this.text       = text;
443        }
444        
445        /**
446         * JSON Object Constructor
447         * @param jo A Json-Object having data about an instance of {@code 'SelectorList'}.
448         */
449        public SelectorList (JsonObject jo)
450        {
451            this.selectors  = (jo.getJsonArray("selectors") == null)
452            ? null
453            : ReadArrJSON.DimN.objArr(jo.getJsonArray("selectors"), null, 0, CSS.Value[].class);
454            this.text       = ReadJSON.getString(jo, "text", false, true);
455        }
456        
457    }
458    
459    /** CSS stylesheet metainformation. */
460    public static class CSSStyleSheetHeader extends BaseType
461    {
462        /** For Object Serialization.  java.io.Serializable */
463        protected static final long serialVersionUID = 1;
464        
465        public boolean[] optionals()
466        { return new boolean[] { false, false, false, true, false, false, true, false, true, false, false, false, false, false, false, false, false, }; }
467        
468        /** The stylesheet identifier. */
469        public final String styleSheetId;
470        
471        /** Owner frame identifier. */
472        public final String frameId;
473        
474        /**
475         * Stylesheet resource URL. Empty if this is a constructed stylesheet created using
476         * new CSSStyleSheet() (but non-empty if this is a constructed sylesheet imported
477         * as a CSS module script).
478         */
479        public final String sourceURL;
480        
481        /**
482         * URL of source map associated with the stylesheet (if any).
483         * <BR />
484         * <BR /><B>OPTIONAL</B>
485         */
486        public final String sourceMapURL;
487        
488        /** Stylesheet origin. */
489        public final String origin;
490        
491        /** Stylesheet title. */
492        public final String title;
493        
494        /**
495         * The backend id for the owner node of the stylesheet.
496         * <BR />
497         * <BR /><B>OPTIONAL</B>
498         */
499        public final Integer ownerNode;
500        
501        /** Denotes whether the stylesheet is disabled. */
502        public final boolean disabled;
503        
504        /**
505         * Whether the sourceURL field value comes from the sourceURL comment.
506         * <BR />
507         * <BR /><B>OPTIONAL</B>
508         */
509        public final Boolean hasSourceURL;
510        
511        /**
512         * Whether this stylesheet is created for STYLE tag by parser. This flag is not set for
513         * document.written STYLE tags.
514         */
515        public final boolean isInline;
516        
517        /**
518         * Whether this stylesheet is mutable. Inline stylesheets become mutable
519         * after they have been modified via CSSOM API.
520         * &lt;link&gt; element's stylesheets become mutable only if DevTools modifies them.
521         * Constructed stylesheets (new CSSStyleSheet()) are mutable immediately after creation.
522         */
523        public final boolean isMutable;
524        
525        /**
526         * True if this stylesheet is created through new CSSStyleSheet() or imported as a
527         * CSS module script.
528         */
529        public final boolean isConstructed;
530        
531        /** Line offset of the stylesheet within the resource (zero based). */
532        public final Number startLine;
533        
534        /** Column offset of the stylesheet within the resource (zero based). */
535        public final Number startColumn;
536        
537        /** Size of the content (in characters). */
538        public final Number length;
539        
540        /** Line offset of the end of the stylesheet within the resource (zero based). */
541        public final Number endLine;
542        
543        /** Column offset of the end of the stylesheet within the resource (zero based). */
544        public final Number endColumn;
545        
546        /**
547         * Constructor
548         *
549         * @param styleSheetId The stylesheet identifier.
550         * 
551         * @param frameId Owner frame identifier.
552         * 
553         * @param sourceURL 
554         * Stylesheet resource URL. Empty if this is a constructed stylesheet created using
555         * new CSSStyleSheet() (but non-empty if this is a constructed sylesheet imported
556         * as a CSS module script).
557         * 
558         * @param sourceMapURL URL of source map associated with the stylesheet (if any).
559         * <BR /><B>OPTIONAL</B>
560         * 
561         * @param origin Stylesheet origin.
562         * 
563         * @param title Stylesheet title.
564         * 
565         * @param ownerNode The backend id for the owner node of the stylesheet.
566         * <BR /><B>OPTIONAL</B>
567         * 
568         * @param disabled Denotes whether the stylesheet is disabled.
569         * 
570         * @param hasSourceURL Whether the sourceURL field value comes from the sourceURL comment.
571         * <BR /><B>OPTIONAL</B>
572         * 
573         * @param isInline 
574         * Whether this stylesheet is created for STYLE tag by parser. This flag is not set for
575         * document.written STYLE tags.
576         * 
577         * @param isMutable 
578         * Whether this stylesheet is mutable. Inline stylesheets become mutable
579         * after they have been modified via CSSOM API.
580         * &lt;link&gt; element's stylesheets become mutable only if DevTools modifies them.
581         * Constructed stylesheets (new CSSStyleSheet()) are mutable immediately after creation.
582         * 
583         * @param isConstructed 
584         * True if this stylesheet is created through new CSSStyleSheet() or imported as a
585         * CSS module script.
586         * 
587         * @param startLine Line offset of the stylesheet within the resource (zero based).
588         * 
589         * @param startColumn Column offset of the stylesheet within the resource (zero based).
590         * 
591         * @param length Size of the content (in characters).
592         * 
593         * @param endLine Line offset of the end of the stylesheet within the resource (zero based).
594         * 
595         * @param endColumn Column offset of the end of the stylesheet within the resource (zero based).
596         */
597        public CSSStyleSheetHeader(
598                String styleSheetId, String frameId, String sourceURL, String sourceMapURL, 
599                String origin, String title, Integer ownerNode, boolean disabled, 
600                Boolean hasSourceURL, boolean isInline, boolean isMutable, boolean isConstructed, 
601                Number startLine, Number startColumn, Number length, Number endLine, Number endColumn
602            )
603        {
604            // Exception-Check(s) to ensure that if any parameters which are not declared as
605            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
606            
607            if (styleSheetId == null) BRDPC.throwNPE("styleSheetId");
608            if (frameId == null)      BRDPC.throwNPE("frameId");
609            if (sourceURL == null)    BRDPC.throwNPE("sourceURL");
610            if (origin == null)       BRDPC.throwNPE("origin");
611            if (title == null)        BRDPC.throwNPE("title");
612            if (startLine == null)    BRDPC.throwNPE("startLine");
613            if (startColumn == null)  BRDPC.throwNPE("startColumn");
614            if (length == null)       BRDPC.throwNPE("length");
615            if (endLine == null)      BRDPC.throwNPE("endLine");
616            if (endColumn == null)    BRDPC.throwNPE("endColumn");
617            
618            // Exception-Check(s) to ensure that if any parameters which must adhere to a
619            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
620            
621            BRDPC.checkIAE("origin", origin, "CSS.StyleSheetOrigin", CSS.StyleSheetOrigin);
622            
623            this.styleSheetId   = styleSheetId;
624            this.frameId        = frameId;
625            this.sourceURL      = sourceURL;
626            this.sourceMapURL   = sourceMapURL;
627            this.origin         = origin;
628            this.title          = title;
629            this.ownerNode      = ownerNode;
630            this.disabled       = disabled;
631            this.hasSourceURL   = hasSourceURL;
632            this.isInline       = isInline;
633            this.isMutable      = isMutable;
634            this.isConstructed  = isConstructed;
635            this.startLine      = startLine;
636            this.startColumn    = startColumn;
637            this.length         = length;
638            this.endLine        = endLine;
639            this.endColumn      = endColumn;
640        }
641        
642        /**
643         * JSON Object Constructor
644         * @param jo A Json-Object having data about an instance of {@code 'CSSStyleSheetHeader'}.
645         */
646        public CSSStyleSheetHeader (JsonObject jo)
647        {
648            this.styleSheetId   = ReadJSON.getString(jo, "styleSheetId", false, true);
649            this.frameId        = ReadJSON.getString(jo, "frameId", false, true);
650            this.sourceURL      = ReadJSON.getString(jo, "sourceURL", false, true);
651            this.sourceMapURL   = ReadJSON.getString(jo, "sourceMapURL", true, false);
652            this.origin         = ReadJSON.getString(jo, "origin", false, true);
653            this.title          = ReadJSON.getString(jo, "title", false, true);
654            this.ownerNode      = ReadJSON.getINTEGER(jo, "ownerNode", true);
655            this.disabled       = ReadJSON.getBoolean(jo, "disabled");
656            this.hasSourceURL   = ReadJSON.getBOOLEAN(jo, "hasSourceURL", true);
657            this.isInline       = ReadJSON.getBoolean(jo, "isInline");
658            this.isMutable      = ReadJSON.getBoolean(jo, "isMutable");
659            this.isConstructed  = ReadJSON.getBoolean(jo, "isConstructed");
660            this.startLine      = ReadJSON.getNUMBER(jo, "startLine", false, true);
661            this.startColumn    = ReadJSON.getNUMBER(jo, "startColumn", false, true);
662            this.length         = ReadJSON.getNUMBER(jo, "length", false, true);
663            this.endLine        = ReadJSON.getNUMBER(jo, "endLine", false, true);
664            this.endColumn      = ReadJSON.getNUMBER(jo, "endColumn", false, true);
665        }
666        
667    }
668    
669    /** CSS rule representation. */
670    public static class CSSRule extends BaseType
671    {
672        /** For Object Serialization.  java.io.Serializable */
673        protected static final long serialVersionUID = 1;
674        
675        public boolean[] optionals()
676        { return new boolean[] { true, false, false, false, true, true, }; }
677        
678        /**
679         * The css style sheet identifier (absent for user agent stylesheet and user-specified
680         * stylesheet rules) this rule came from.
681         * <BR />
682         * <BR /><B>OPTIONAL</B>
683         */
684        public final String styleSheetId;
685        
686        /** Rule selector data. */
687        public final CSS.SelectorList selectorList;
688        
689        /** Parent stylesheet's origin. */
690        public final String origin;
691        
692        /** Associated style declaration. */
693        public final CSS.CSSStyle style;
694        
695        /**
696         * Media list array (for rules involving media queries). The array enumerates media queries
697         * starting with the innermost one, going outwards.
698         * <BR />
699         * <BR /><B>OPTIONAL</B>
700         */
701        public final CSS.CSSMedia[] media;
702        
703        /**
704         * Container query list array (for rules involving container queries).
705         * The array enumerates container queries starting with the innermost one, going outwards.
706         * <BR />
707         * <BR /><B>OPTIONAL</B>
708         * <BR /><B>EXPERIMENTAL</B>
709         */
710        public final CSS.CSSContainerQuery[] containerQueries;
711        
712        /**
713         * Constructor
714         *
715         * @param styleSheetId 
716         * The css style sheet identifier (absent for user agent stylesheet and user-specified
717         * stylesheet rules) this rule came from.
718         * <BR /><B>OPTIONAL</B>
719         * 
720         * @param selectorList Rule selector data.
721         * 
722         * @param origin Parent stylesheet's origin.
723         * 
724         * @param style Associated style declaration.
725         * 
726         * @param media 
727         * Media list array (for rules involving media queries). The array enumerates media queries
728         * starting with the innermost one, going outwards.
729         * <BR /><B>OPTIONAL</B>
730         * 
731         * @param containerQueries 
732         * Container query list array (for rules involving container queries).
733         * The array enumerates container queries starting with the innermost one, going outwards.
734         * <BR /><B>OPTIONAL</B>
735         * <BR /><B>EXPERIMENTAL</B>
736         */
737        public CSSRule(
738                String styleSheetId, CSS.SelectorList selectorList, String origin, 
739                CSS.CSSStyle style, CSS.CSSMedia[] media, CSS.CSSContainerQuery[] containerQueries
740            )
741        {
742            // Exception-Check(s) to ensure that if any parameters which are not declared as
743            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
744            
745            if (selectorList == null) BRDPC.throwNPE("selectorList");
746            if (origin == null)       BRDPC.throwNPE("origin");
747            if (style == null)        BRDPC.throwNPE("style");
748            
749            // Exception-Check(s) to ensure that if any parameters which must adhere to a
750            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
751            
752            BRDPC.checkIAE("origin", origin, "CSS.StyleSheetOrigin", CSS.StyleSheetOrigin);
753            
754            this.styleSheetId      = styleSheetId;
755            this.selectorList      = selectorList;
756            this.origin            = origin;
757            this.style             = style;
758            this.media             = media;
759            this.containerQueries  = containerQueries;
760        }
761        
762        /**
763         * JSON Object Constructor
764         * @param jo A Json-Object having data about an instance of {@code 'CSSRule'}.
765         */
766        public CSSRule (JsonObject jo)
767        {
768            this.styleSheetId      = ReadJSON.getString(jo, "styleSheetId", true, false);
769            this.selectorList      = ReadJSON.XL.getObject(jo, "selectorList", CSS.SelectorList.class, false, true);
770            this.origin            = ReadJSON.getString(jo, "origin", false, true);
771            this.style             = ReadJSON.XL.getObject(jo, "style", CSS.CSSStyle.class, false, true);
772            this.media             = (jo.getJsonArray("media") == null)
773            ? null
774            : ReadArrJSON.DimN.objArr(jo.getJsonArray("media"), null, 0, CSS.CSSMedia[].class);
775            this.containerQueries  = (jo.getJsonArray("containerQueries") == null)
776            ? null
777            : ReadArrJSON.DimN.objArr(jo.getJsonArray("containerQueries"), null, 0, CSS.CSSContainerQuery[].class);
778        }
779        
780    }
781    
782    /** CSS coverage information. */
783    public static class RuleUsage extends BaseType
784    {
785        /** For Object Serialization.  java.io.Serializable */
786        protected static final long serialVersionUID = 1;
787        
788        public boolean[] optionals()
789        { return new boolean[] { false, false, false, false, }; }
790        
791        /**
792         * The css style sheet identifier (absent for user agent stylesheet and user-specified
793         * stylesheet rules) this rule came from.
794         */
795        public final String styleSheetId;
796        
797        /** Offset of the start of the rule (including selector) from the beginning of the stylesheet. */
798        public final Number startOffset;
799        
800        /** Offset of the end of the rule body from the beginning of the stylesheet. */
801        public final Number endOffset;
802        
803        /** Indicates whether the rule was actually used by some element in the page. */
804        public final boolean used;
805        
806        /**
807         * Constructor
808         *
809         * @param styleSheetId 
810         * The css style sheet identifier (absent for user agent stylesheet and user-specified
811         * stylesheet rules) this rule came from.
812         * 
813         * @param startOffset Offset of the start of the rule (including selector) from the beginning of the stylesheet.
814         * 
815         * @param endOffset Offset of the end of the rule body from the beginning of the stylesheet.
816         * 
817         * @param used Indicates whether the rule was actually used by some element in the page.
818         */
819        public RuleUsage
820            (String styleSheetId, Number startOffset, Number endOffset, boolean used)
821        {
822            // Exception-Check(s) to ensure that if any parameters which are not declared as
823            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
824            
825            if (styleSheetId == null) BRDPC.throwNPE("styleSheetId");
826            if (startOffset == null)  BRDPC.throwNPE("startOffset");
827            if (endOffset == null)    BRDPC.throwNPE("endOffset");
828            
829            this.styleSheetId  = styleSheetId;
830            this.startOffset   = startOffset;
831            this.endOffset     = endOffset;
832            this.used          = used;
833        }
834        
835        /**
836         * JSON Object Constructor
837         * @param jo A Json-Object having data about an instance of {@code 'RuleUsage'}.
838         */
839        public RuleUsage (JsonObject jo)
840        {
841            this.styleSheetId  = ReadJSON.getString(jo, "styleSheetId", false, true);
842            this.startOffset   = ReadJSON.getNUMBER(jo, "startOffset", false, true);
843            this.endOffset     = ReadJSON.getNUMBER(jo, "endOffset", false, true);
844            this.used          = ReadJSON.getBoolean(jo, "used");
845        }
846        
847    }
848    
849    /** Text range within a resource. All numbers are zero-based. */
850    public static class SourceRange extends BaseType
851    {
852        /** For Object Serialization.  java.io.Serializable */
853        protected static final long serialVersionUID = 1;
854        
855        public boolean[] optionals()
856        { return new boolean[] { false, false, false, false, }; }
857        
858        /** Start line of range. */
859        public final int startLine;
860        
861        /** Start column of range (inclusive). */
862        public final int startColumn;
863        
864        /** End line of range */
865        public final int endLine;
866        
867        /** End column of range (exclusive). */
868        public final int endColumn;
869        
870        /**
871         * Constructor
872         *
873         * @param startLine Start line of range.
874         * 
875         * @param startColumn Start column of range (inclusive).
876         * 
877         * @param endLine End line of range
878         * 
879         * @param endColumn End column of range (exclusive).
880         */
881        public SourceRange(int startLine, int startColumn, int endLine, int endColumn)
882        {
883            this.startLine    = startLine;
884            this.startColumn  = startColumn;
885            this.endLine      = endLine;
886            this.endColumn    = endColumn;
887        }
888        
889        /**
890         * JSON Object Constructor
891         * @param jo A Json-Object having data about an instance of {@code 'SourceRange'}.
892         */
893        public SourceRange (JsonObject jo)
894        {
895            this.startLine    = ReadJSON.getInt(jo, "startLine");
896            this.startColumn  = ReadJSON.getInt(jo, "startColumn");
897            this.endLine      = ReadJSON.getInt(jo, "endLine");
898            this.endColumn    = ReadJSON.getInt(jo, "endColumn");
899        }
900        
901    }
902    
903    /** <CODE>[No Description Provided by Google]</CODE> */
904    public static class ShorthandEntry extends BaseType
905    {
906        /** For Object Serialization.  java.io.Serializable */
907        protected static final long serialVersionUID = 1;
908        
909        public boolean[] optionals()
910        { return new boolean[] { false, false, true, }; }
911        
912        /** Shorthand name. */
913        public final String name;
914        
915        /** Shorthand value. */
916        public final String value;
917        
918        /**
919         * Whether the property has "!important" annotation (implies <CODE>false</CODE> if absent).
920         * <BR />
921         * <BR /><B>OPTIONAL</B>
922         */
923        public final Boolean important;
924        
925        /**
926         * Constructor
927         *
928         * @param name Shorthand name.
929         * 
930         * @param value Shorthand value.
931         * 
932         * @param important Whether the property has "!important" annotation (implies <CODE>false</CODE> if absent).
933         * <BR /><B>OPTIONAL</B>
934         */
935        public ShorthandEntry(String name, String value, Boolean important)
936        {
937            // Exception-Check(s) to ensure that if any parameters which are not declared as
938            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
939            
940            if (name == null)  BRDPC.throwNPE("name");
941            if (value == null) BRDPC.throwNPE("value");
942            
943            this.name       = name;
944            this.value      = value;
945            this.important  = important;
946        }
947        
948        /**
949         * JSON Object Constructor
950         * @param jo A Json-Object having data about an instance of {@code 'ShorthandEntry'}.
951         */
952        public ShorthandEntry (JsonObject jo)
953        {
954            this.name       = ReadJSON.getString(jo, "name", false, true);
955            this.value      = ReadJSON.getString(jo, "value", false, true);
956            this.important  = ReadJSON.getBOOLEAN(jo, "important", true);
957        }
958        
959    }
960    
961    /** <CODE>[No Description Provided by Google]</CODE> */
962    public static class CSSComputedStyleProperty extends BaseType
963    {
964        /** For Object Serialization.  java.io.Serializable */
965        protected static final long serialVersionUID = 1;
966        
967        public boolean[] optionals()
968        { return new boolean[] { false, false, }; }
969        
970        /** Computed style property name. */
971        public final String name;
972        
973        /** Computed style property value. */
974        public final String value;
975        
976        /**
977         * Constructor
978         *
979         * @param name Computed style property name.
980         * 
981         * @param value Computed style property value.
982         */
983        public CSSComputedStyleProperty(String name, String value)
984        {
985            // Exception-Check(s) to ensure that if any parameters which are not declared as
986            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
987            
988            if (name == null)  BRDPC.throwNPE("name");
989            if (value == null) BRDPC.throwNPE("value");
990            
991            this.name   = name;
992            this.value  = value;
993        }
994        
995        /**
996         * JSON Object Constructor
997         * @param jo A Json-Object having data about an instance of {@code 'CSSComputedStyleProperty'}.
998         */
999        public CSSComputedStyleProperty (JsonObject jo)
1000        {
1001            this.name   = ReadJSON.getString(jo, "name", false, true);
1002            this.value  = ReadJSON.getString(jo, "value", false, true);
1003        }
1004        
1005    }
1006    
1007    /** CSS style representation. */
1008    public static class CSSStyle extends BaseType
1009    {
1010        /** For Object Serialization.  java.io.Serializable */
1011        protected static final long serialVersionUID = 1;
1012        
1013        public boolean[] optionals()
1014        { return new boolean[] { true, false, false, true, true, }; }
1015        
1016        /**
1017         * The css style sheet identifier (absent for user agent stylesheet and user-specified
1018         * stylesheet rules) this rule came from.
1019         * <BR />
1020         * <BR /><B>OPTIONAL</B>
1021         */
1022        public final String styleSheetId;
1023        
1024        /** CSS properties in the style. */
1025        public final CSS.CSSProperty[] cssProperties;
1026        
1027        /** Computed values for all shorthands found in the style. */
1028        public final CSS.ShorthandEntry[] shorthandEntries;
1029        
1030        /**
1031         * Style declaration text (if available).
1032         * <BR />
1033         * <BR /><B>OPTIONAL</B>
1034         */
1035        public final String cssText;
1036        
1037        /**
1038         * Style declaration range in the enclosing stylesheet (if available).
1039         * <BR />
1040         * <BR /><B>OPTIONAL</B>
1041         */
1042        public final CSS.SourceRange range;
1043        
1044        /**
1045         * Constructor
1046         *
1047         * @param styleSheetId 
1048         * The css style sheet identifier (absent for user agent stylesheet and user-specified
1049         * stylesheet rules) this rule came from.
1050         * <BR /><B>OPTIONAL</B>
1051         * 
1052         * @param cssProperties CSS properties in the style.
1053         * 
1054         * @param shorthandEntries Computed values for all shorthands found in the style.
1055         * 
1056         * @param cssText Style declaration text (if available).
1057         * <BR /><B>OPTIONAL</B>
1058         * 
1059         * @param range Style declaration range in the enclosing stylesheet (if available).
1060         * <BR /><B>OPTIONAL</B>
1061         */
1062        public CSSStyle(
1063                String styleSheetId, CSS.CSSProperty[] cssProperties, 
1064                CSS.ShorthandEntry[] shorthandEntries, String cssText, CSS.SourceRange range
1065            )
1066        {
1067            // Exception-Check(s) to ensure that if any parameters which are not declared as
1068            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1069            
1070            if (cssProperties == null)    BRDPC.throwNPE("cssProperties");
1071            if (shorthandEntries == null) BRDPC.throwNPE("shorthandEntries");
1072            
1073            this.styleSheetId      = styleSheetId;
1074            this.cssProperties     = cssProperties;
1075            this.shorthandEntries  = shorthandEntries;
1076            this.cssText           = cssText;
1077            this.range             = range;
1078        }
1079        
1080        /**
1081         * JSON Object Constructor
1082         * @param jo A Json-Object having data about an instance of {@code 'CSSStyle'}.
1083         */
1084        public CSSStyle (JsonObject jo)
1085        {
1086            this.styleSheetId      = ReadJSON.getString(jo, "styleSheetId", true, false);
1087            this.cssProperties     = (jo.getJsonArray("cssProperties") == null)
1088            ? null
1089            : ReadArrJSON.DimN.objArr(jo.getJsonArray("cssProperties"), null, 0, CSS.CSSProperty[].class);
1090            this.shorthandEntries  = (jo.getJsonArray("shorthandEntries") == null)
1091            ? null
1092            : ReadArrJSON.DimN.objArr(jo.getJsonArray("shorthandEntries"), null, 0, CSS.ShorthandEntry[].class);
1093            this.cssText           = ReadJSON.getString(jo, "cssText", true, false);
1094            this.range             = ReadJSON.XL.getObject(jo, "range", CSS.SourceRange.class, true, false);
1095        }
1096        
1097    }
1098    
1099    /** CSS property declaration data. */
1100    public static class CSSProperty extends BaseType
1101    {
1102        /** For Object Serialization.  java.io.Serializable */
1103        protected static final long serialVersionUID = 1;
1104        
1105        public boolean[] optionals()
1106        { return new boolean[] { false, false, true, true, true, true, true, true, }; }
1107        
1108        /** The property name. */
1109        public final String name;
1110        
1111        /** The property value. */
1112        public final String value;
1113        
1114        /**
1115         * Whether the property has "!important" annotation (implies <CODE>false</CODE> if absent).
1116         * <BR />
1117         * <BR /><B>OPTIONAL</B>
1118         */
1119        public final Boolean important;
1120        
1121        /**
1122         * Whether the property is implicit (implies <CODE>false</CODE> if absent).
1123         * <BR />
1124         * <BR /><B>OPTIONAL</B>
1125         */
1126        public final Boolean implicit;
1127        
1128        /**
1129         * The full property text as specified in the style.
1130         * <BR />
1131         * <BR /><B>OPTIONAL</B>
1132         */
1133        public final String text;
1134        
1135        /**
1136         * Whether the property is understood by the browser (implies <CODE>true</CODE> if absent).
1137         * <BR />
1138         * <BR /><B>OPTIONAL</B>
1139         */
1140        public final Boolean parsedOk;
1141        
1142        /**
1143         * Whether the property is disabled by the user (present for source-based properties only).
1144         * <BR />
1145         * <BR /><B>OPTIONAL</B>
1146         */
1147        public final Boolean disabled;
1148        
1149        /**
1150         * The entire property range in the enclosing style declaration (if available).
1151         * <BR />
1152         * <BR /><B>OPTIONAL</B>
1153         */
1154        public final CSS.SourceRange range;
1155        
1156        /**
1157         * Constructor
1158         *
1159         * @param name The property name.
1160         * 
1161         * @param value The property value.
1162         * 
1163         * @param important Whether the property has "!important" annotation (implies <CODE>false</CODE> if absent).
1164         * <BR /><B>OPTIONAL</B>
1165         * 
1166         * @param implicit Whether the property is implicit (implies <CODE>false</CODE> if absent).
1167         * <BR /><B>OPTIONAL</B>
1168         * 
1169         * @param text The full property text as specified in the style.
1170         * <BR /><B>OPTIONAL</B>
1171         * 
1172         * @param parsedOk Whether the property is understood by the browser (implies <CODE>true</CODE> if absent).
1173         * <BR /><B>OPTIONAL</B>
1174         * 
1175         * @param disabled Whether the property is disabled by the user (present for source-based properties only).
1176         * <BR /><B>OPTIONAL</B>
1177         * 
1178         * @param range The entire property range in the enclosing style declaration (if available).
1179         * <BR /><B>OPTIONAL</B>
1180         */
1181        public CSSProperty(
1182                String name, String value, Boolean important, Boolean implicit, String text, 
1183                Boolean parsedOk, Boolean disabled, CSS.SourceRange range
1184            )
1185        {
1186            // Exception-Check(s) to ensure that if any parameters which are not declared as
1187            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1188            
1189            if (name == null)  BRDPC.throwNPE("name");
1190            if (value == null) BRDPC.throwNPE("value");
1191            
1192            this.name       = name;
1193            this.value      = value;
1194            this.important  = important;
1195            this.implicit   = implicit;
1196            this.text       = text;
1197            this.parsedOk   = parsedOk;
1198            this.disabled   = disabled;
1199            this.range      = range;
1200        }
1201        
1202        /**
1203         * JSON Object Constructor
1204         * @param jo A Json-Object having data about an instance of {@code 'CSSProperty'}.
1205         */
1206        public CSSProperty (JsonObject jo)
1207        {
1208            this.name       = ReadJSON.getString(jo, "name", false, true);
1209            this.value      = ReadJSON.getString(jo, "value", false, true);
1210            this.important  = ReadJSON.getBOOLEAN(jo, "important", true);
1211            this.implicit   = ReadJSON.getBOOLEAN(jo, "implicit", true);
1212            this.text       = ReadJSON.getString(jo, "text", true, false);
1213            this.parsedOk   = ReadJSON.getBOOLEAN(jo, "parsedOk", true);
1214            this.disabled   = ReadJSON.getBOOLEAN(jo, "disabled", true);
1215            this.range      = ReadJSON.XL.getObject(jo, "range", CSS.SourceRange.class, true, false);
1216        }
1217        
1218    }
1219    
1220    /** CSS media rule descriptor. */
1221    public static class CSSMedia extends BaseType
1222    {
1223        /** For Object Serialization.  java.io.Serializable */
1224        protected static final long serialVersionUID = 1;
1225        
1226        public boolean[] optionals()
1227        { return new boolean[] { false, false, true, true, true, true, }; }
1228        
1229        /** Media query text. */
1230        public final String text;
1231        
1232        /**
1233         * Source of the media query: "mediaRule" if specified by a @media rule, "importRule" if
1234         * specified by an @import rule, "linkedSheet" if specified by a "media" attribute in a linked
1235         * stylesheet's LINK tag, "inlineSheet" if specified by a "media" attribute in an inline
1236         * stylesheet's STYLE tag.
1237         */
1238        public final String source;
1239        
1240        /**
1241         * URL of the document containing the media query description.
1242         * <BR />
1243         * <BR /><B>OPTIONAL</B>
1244         */
1245        public final String sourceURL;
1246        
1247        /**
1248         * The associated rule (@media or @import) header range in the enclosing stylesheet (if
1249         * available).
1250         * <BR />
1251         * <BR /><B>OPTIONAL</B>
1252         */
1253        public final CSS.SourceRange range;
1254        
1255        /**
1256         * Identifier of the stylesheet containing this object (if exists).
1257         * <BR />
1258         * <BR /><B>OPTIONAL</B>
1259         */
1260        public final String styleSheetId;
1261        
1262        /**
1263         * Array of media queries.
1264         * <BR />
1265         * <BR /><B>OPTIONAL</B>
1266         */
1267        public final CSS.MediaQuery[] mediaList;
1268        
1269        /**
1270         * Constructor
1271         *
1272         * @param text Media query text.
1273         * 
1274         * @param source 
1275         * Source of the media query: "mediaRule" if specified by a @media rule, "importRule" if
1276         * specified by an @import rule, "linkedSheet" if specified by a "media" attribute in a linked
1277         * stylesheet's LINK tag, "inlineSheet" if specified by a "media" attribute in an inline
1278         * stylesheet's STYLE tag.
1279         * <BR />Acceptable Values: ["mediaRule", "importRule", "linkedSheet", "inlineSheet"]
1280         * 
1281         * @param sourceURL URL of the document containing the media query description.
1282         * <BR /><B>OPTIONAL</B>
1283         * 
1284         * @param range 
1285         * The associated rule (@media or @import) header range in the enclosing stylesheet (if
1286         * available).
1287         * <BR /><B>OPTIONAL</B>
1288         * 
1289         * @param styleSheetId Identifier of the stylesheet containing this object (if exists).
1290         * <BR /><B>OPTIONAL</B>
1291         * 
1292         * @param mediaList Array of media queries.
1293         * <BR /><B>OPTIONAL</B>
1294         */
1295        public CSSMedia(
1296                String text, String source, String sourceURL, CSS.SourceRange range, 
1297                String styleSheetId, CSS.MediaQuery[] mediaList
1298            )
1299        {
1300            // Exception-Check(s) to ensure that if any parameters which are not declared as
1301            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1302            
1303            if (text == null)   BRDPC.throwNPE("text");
1304            if (source == null) BRDPC.throwNPE("source");
1305            
1306            // Exception-Check(s) to ensure that if any parameters which must adhere to a
1307            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
1308            
1309            BRDPC.checkIAE(
1310                "source", source,
1311                "mediaRule", "importRule", "linkedSheet", "inlineSheet"
1312            );
1313            
1314            this.text          = text;
1315            this.source        = source;
1316            this.sourceURL     = sourceURL;
1317            this.range         = range;
1318            this.styleSheetId  = styleSheetId;
1319            this.mediaList     = mediaList;
1320        }
1321        
1322        /**
1323         * JSON Object Constructor
1324         * @param jo A Json-Object having data about an instance of {@code 'CSSMedia'}.
1325         */
1326        public CSSMedia (JsonObject jo)
1327        {
1328            this.text          = ReadJSON.getString(jo, "text", false, true);
1329            this.source        = ReadJSON.getString(jo, "source", false, true);
1330            this.sourceURL     = ReadJSON.getString(jo, "sourceURL", true, false);
1331            this.range         = ReadJSON.XL.getObject(jo, "range", CSS.SourceRange.class, true, false);
1332            this.styleSheetId  = ReadJSON.getString(jo, "styleSheetId", true, false);
1333            this.mediaList     = (jo.getJsonArray("mediaList") == null)
1334            ? null
1335            : ReadArrJSON.DimN.objArr(jo.getJsonArray("mediaList"), null, 0, CSS.MediaQuery[].class);
1336        }
1337        
1338    }
1339    
1340    /** Media query descriptor. */
1341    public static class MediaQuery extends BaseType
1342    {
1343        /** For Object Serialization.  java.io.Serializable */
1344        protected static final long serialVersionUID = 1;
1345        
1346        public boolean[] optionals()
1347        { return new boolean[] { false, false, }; }
1348        
1349        /** Array of media query expressions. */
1350        public final CSS.MediaQueryExpression[] expressions;
1351        
1352        /** Whether the media query condition is satisfied. */
1353        public final boolean active;
1354        
1355        /**
1356         * Constructor
1357         *
1358         * @param expressions Array of media query expressions.
1359         * 
1360         * @param active Whether the media query condition is satisfied.
1361         */
1362        public MediaQuery(CSS.MediaQueryExpression[] expressions, boolean active)
1363        {
1364            // Exception-Check(s) to ensure that if any parameters which are not declared as
1365            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1366            
1367            if (expressions == null) BRDPC.throwNPE("expressions");
1368            
1369            this.expressions  = expressions;
1370            this.active       = active;
1371        }
1372        
1373        /**
1374         * JSON Object Constructor
1375         * @param jo A Json-Object having data about an instance of {@code 'MediaQuery'}.
1376         */
1377        public MediaQuery (JsonObject jo)
1378        {
1379            this.expressions  = (jo.getJsonArray("expressions") == null)
1380            ? null
1381            : ReadArrJSON.DimN.objArr(jo.getJsonArray("expressions"), null, 0, CSS.MediaQueryExpression[].class);
1382            this.active       = ReadJSON.getBoolean(jo, "active");
1383        }
1384        
1385    }
1386    
1387    /** Media query expression descriptor. */
1388    public static class MediaQueryExpression extends BaseType
1389    {
1390        /** For Object Serialization.  java.io.Serializable */
1391        protected static final long serialVersionUID = 1;
1392        
1393        public boolean[] optionals()
1394        { return new boolean[] { false, false, false, true, true, }; }
1395        
1396        /** Media query expression value. */
1397        public final Number value;
1398        
1399        /** Media query expression units. */
1400        public final String unit;
1401        
1402        /** Media query expression feature. */
1403        public final String feature;
1404        
1405        /**
1406         * The associated range of the value text in the enclosing stylesheet (if available).
1407         * <BR />
1408         * <BR /><B>OPTIONAL</B>
1409         */
1410        public final CSS.SourceRange valueRange;
1411        
1412        /**
1413         * Computed length of media query expression (if applicable).
1414         * <BR />
1415         * <BR /><B>OPTIONAL</B>
1416         */
1417        public final Number computedLength;
1418        
1419        /**
1420         * Constructor
1421         *
1422         * @param value Media query expression value.
1423         * 
1424         * @param unit Media query expression units.
1425         * 
1426         * @param feature Media query expression feature.
1427         * 
1428         * @param valueRange The associated range of the value text in the enclosing stylesheet (if available).
1429         * <BR /><B>OPTIONAL</B>
1430         * 
1431         * @param computedLength Computed length of media query expression (if applicable).
1432         * <BR /><B>OPTIONAL</B>
1433         */
1434        public MediaQueryExpression(
1435                Number value, String unit, String feature, CSS.SourceRange valueRange, 
1436                Number computedLength
1437            )
1438        {
1439            // Exception-Check(s) to ensure that if any parameters which are not declared as
1440            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1441            
1442            if (value == null)   BRDPC.throwNPE("value");
1443            if (unit == null)    BRDPC.throwNPE("unit");
1444            if (feature == null) BRDPC.throwNPE("feature");
1445            
1446            this.value           = value;
1447            this.unit            = unit;
1448            this.feature         = feature;
1449            this.valueRange      = valueRange;
1450            this.computedLength  = computedLength;
1451        }
1452        
1453        /**
1454         * JSON Object Constructor
1455         * @param jo A Json-Object having data about an instance of {@code 'MediaQueryExpression'}.
1456         */
1457        public MediaQueryExpression (JsonObject jo)
1458        {
1459            this.value           = ReadJSON.getNUMBER(jo, "value", false, true);
1460            this.unit            = ReadJSON.getString(jo, "unit", false, true);
1461            this.feature         = ReadJSON.getString(jo, "feature", false, true);
1462            this.valueRange      = ReadJSON.XL.getObject(jo, "valueRange", CSS.SourceRange.class, true, false);
1463            this.computedLength  = ReadJSON.getNUMBER(jo, "computedLength", true, false);
1464        }
1465        
1466    }
1467    
1468    /**
1469     * CSS container query rule descriptor.
1470     * <BR />
1471     * <BR /><B>EXPERIMENTAL</B>
1472     */
1473    public static class CSSContainerQuery extends BaseType
1474    {
1475        /** For Object Serialization.  java.io.Serializable */
1476        protected static final long serialVersionUID = 1;
1477        
1478        public boolean[] optionals()
1479        { return new boolean[] { false, true, true, true, }; }
1480        
1481        /** Container query text. */
1482        public final String text;
1483        
1484        /**
1485         * The associated rule header range in the enclosing stylesheet (if
1486         * available).
1487         * <BR />
1488         * <BR /><B>OPTIONAL</B>
1489         */
1490        public final CSS.SourceRange range;
1491        
1492        /**
1493         * Identifier of the stylesheet containing this object (if exists).
1494         * <BR />
1495         * <BR /><B>OPTIONAL</B>
1496         */
1497        public final String styleSheetId;
1498        
1499        /**
1500         * Optional name for the container.
1501         * <BR />
1502         * <BR /><B>OPTIONAL</B>
1503         */
1504        public final String name;
1505        
1506        /**
1507         * Constructor
1508         *
1509         * @param text Container query text.
1510         * 
1511         * @param range 
1512         * The associated rule header range in the enclosing stylesheet (if
1513         * available).
1514         * <BR /><B>OPTIONAL</B>
1515         * 
1516         * @param styleSheetId Identifier of the stylesheet containing this object (if exists).
1517         * <BR /><B>OPTIONAL</B>
1518         * 
1519         * @param name Optional name for the container.
1520         * <BR /><B>OPTIONAL</B>
1521         */
1522        public CSSContainerQuery
1523            (String text, CSS.SourceRange range, String styleSheetId, String name)
1524        {
1525            // Exception-Check(s) to ensure that if any parameters which are not declared as
1526            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1527            
1528            if (text == null) BRDPC.throwNPE("text");
1529            
1530            this.text          = text;
1531            this.range         = range;
1532            this.styleSheetId  = styleSheetId;
1533            this.name          = name;
1534        }
1535        
1536        /**
1537         * JSON Object Constructor
1538         * @param jo A Json-Object having data about an instance of {@code 'CSSContainerQuery'}.
1539         */
1540        public CSSContainerQuery (JsonObject jo)
1541        {
1542            this.text          = ReadJSON.getString(jo, "text", false, true);
1543            this.range         = ReadJSON.XL.getObject(jo, "range", CSS.SourceRange.class, true, false);
1544            this.styleSheetId  = ReadJSON.getString(jo, "styleSheetId", true, false);
1545            this.name          = ReadJSON.getString(jo, "name", true, false);
1546        }
1547        
1548    }
1549    
1550    /** Information about amount of glyphs that were rendered with given font. */
1551    public static class PlatformFontUsage extends BaseType
1552    {
1553        /** For Object Serialization.  java.io.Serializable */
1554        protected static final long serialVersionUID = 1;
1555        
1556        public boolean[] optionals()
1557        { return new boolean[] { false, false, false, }; }
1558        
1559        /** Font's family name reported by platform. */
1560        public final String familyName;
1561        
1562        /** Indicates if the font was downloaded or resolved locally. */
1563        public final boolean isCustomFont;
1564        
1565        /** Amount of glyphs that were rendered with this font. */
1566        public final Number glyphCount;
1567        
1568        /**
1569         * Constructor
1570         *
1571         * @param familyName Font's family name reported by platform.
1572         * 
1573         * @param isCustomFont Indicates if the font was downloaded or resolved locally.
1574         * 
1575         * @param glyphCount Amount of glyphs that were rendered with this font.
1576         */
1577        public PlatformFontUsage(String familyName, boolean isCustomFont, Number glyphCount)
1578        {
1579            // Exception-Check(s) to ensure that if any parameters which are not declared as
1580            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1581            
1582            if (familyName == null) BRDPC.throwNPE("familyName");
1583            if (glyphCount == null) BRDPC.throwNPE("glyphCount");
1584            
1585            this.familyName    = familyName;
1586            this.isCustomFont  = isCustomFont;
1587            this.glyphCount    = glyphCount;
1588        }
1589        
1590        /**
1591         * JSON Object Constructor
1592         * @param jo A Json-Object having data about an instance of {@code 'PlatformFontUsage'}.
1593         */
1594        public PlatformFontUsage (JsonObject jo)
1595        {
1596            this.familyName    = ReadJSON.getString(jo, "familyName", false, true);
1597            this.isCustomFont  = ReadJSON.getBoolean(jo, "isCustomFont");
1598            this.glyphCount    = ReadJSON.getNUMBER(jo, "glyphCount", false, true);
1599        }
1600        
1601    }
1602    
1603    /** Information about font variation axes for variable fonts */
1604    public static class FontVariationAxis extends BaseType
1605    {
1606        /** For Object Serialization.  java.io.Serializable */
1607        protected static final long serialVersionUID = 1;
1608        
1609        public boolean[] optionals()
1610        { return new boolean[] { false, false, false, false, false, }; }
1611        
1612        /** The font-variation-setting tag (a.k.a. "axis tag"). */
1613        public final String tag;
1614        
1615        /** Human-readable variation name in the default language (normally, "en"). */
1616        public final String name;
1617        
1618        /** The minimum value (inclusive) the font supports for this tag. */
1619        public final Number minValue;
1620        
1621        /** The maximum value (inclusive) the font supports for this tag. */
1622        public final Number maxValue;
1623        
1624        /** The default value. */
1625        public final Number defaultValue;
1626        
1627        /**
1628         * Constructor
1629         *
1630         * @param tag The font-variation-setting tag (a.k.a. "axis tag").
1631         * 
1632         * @param name Human-readable variation name in the default language (normally, "en").
1633         * 
1634         * @param minValue The minimum value (inclusive) the font supports for this tag.
1635         * 
1636         * @param maxValue The maximum value (inclusive) the font supports for this tag.
1637         * 
1638         * @param defaultValue The default value.
1639         */
1640        public FontVariationAxis
1641            (String tag, String name, Number minValue, Number maxValue, Number defaultValue)
1642        {
1643            // Exception-Check(s) to ensure that if any parameters which are not declared as
1644            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1645            
1646            if (tag == null)          BRDPC.throwNPE("tag");
1647            if (name == null)         BRDPC.throwNPE("name");
1648            if (minValue == null)     BRDPC.throwNPE("minValue");
1649            if (maxValue == null)     BRDPC.throwNPE("maxValue");
1650            if (defaultValue == null) BRDPC.throwNPE("defaultValue");
1651            
1652            this.tag           = tag;
1653            this.name          = name;
1654            this.minValue      = minValue;
1655            this.maxValue      = maxValue;
1656            this.defaultValue  = defaultValue;
1657        }
1658        
1659        /**
1660         * JSON Object Constructor
1661         * @param jo A Json-Object having data about an instance of {@code 'FontVariationAxis'}.
1662         */
1663        public FontVariationAxis (JsonObject jo)
1664        {
1665            this.tag           = ReadJSON.getString(jo, "tag", false, true);
1666            this.name          = ReadJSON.getString(jo, "name", false, true);
1667            this.minValue      = ReadJSON.getNUMBER(jo, "minValue", false, true);
1668            this.maxValue      = ReadJSON.getNUMBER(jo, "maxValue", false, true);
1669            this.defaultValue  = ReadJSON.getNUMBER(jo, "defaultValue", false, true);
1670        }
1671        
1672    }
1673    
1674    /**
1675     * Properties of a web font: https://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#font-descriptions
1676     * and additional information such as platformFontFamily and fontVariationAxes.
1677     */
1678    public static class FontFace extends BaseType
1679    {
1680        /** For Object Serialization.  java.io.Serializable */
1681        protected static final long serialVersionUID = 1;
1682        
1683        public boolean[] optionals()
1684        { return new boolean[] { false, false, false, false, false, false, false, false, true, }; }
1685        
1686        /** The font-family. */
1687        public final String fontFamily;
1688        
1689        /** The font-style. */
1690        public final String fontStyle;
1691        
1692        /** The font-variant. */
1693        public final String fontVariant;
1694        
1695        /** The font-weight. */
1696        public final String fontWeight;
1697        
1698        /** The font-stretch. */
1699        public final String fontStretch;
1700        
1701        /** The unicode-range. */
1702        public final String unicodeRange;
1703        
1704        /** The src. */
1705        public final String src;
1706        
1707        /** The resolved platform font family */
1708        public final String platformFontFamily;
1709        
1710        /**
1711         * Available variation settings (a.k.a. "axes").
1712         * <BR />
1713         * <BR /><B>OPTIONAL</B>
1714         */
1715        public final CSS.FontVariationAxis[] fontVariationAxes;
1716        
1717        /**
1718         * Constructor
1719         *
1720         * @param fontFamily The font-family.
1721         * 
1722         * @param fontStyle The font-style.
1723         * 
1724         * @param fontVariant The font-variant.
1725         * 
1726         * @param fontWeight The font-weight.
1727         * 
1728         * @param fontStretch The font-stretch.
1729         * 
1730         * @param unicodeRange The unicode-range.
1731         * 
1732         * @param src The src.
1733         * 
1734         * @param platformFontFamily The resolved platform font family
1735         * 
1736         * @param fontVariationAxes Available variation settings (a.k.a. "axes").
1737         * <BR /><B>OPTIONAL</B>
1738         */
1739        public FontFace(
1740                String fontFamily, String fontStyle, String fontVariant, String fontWeight, 
1741                String fontStretch, String unicodeRange, String src, String platformFontFamily, 
1742                CSS.FontVariationAxis[] fontVariationAxes
1743            )
1744        {
1745            // Exception-Check(s) to ensure that if any parameters which are not declared as
1746            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1747            
1748            if (fontFamily == null)         BRDPC.throwNPE("fontFamily");
1749            if (fontStyle == null)          BRDPC.throwNPE("fontStyle");
1750            if (fontVariant == null)        BRDPC.throwNPE("fontVariant");
1751            if (fontWeight == null)         BRDPC.throwNPE("fontWeight");
1752            if (fontStretch == null)        BRDPC.throwNPE("fontStretch");
1753            if (unicodeRange == null)       BRDPC.throwNPE("unicodeRange");
1754            if (src == null)                BRDPC.throwNPE("src");
1755            if (platformFontFamily == null) BRDPC.throwNPE("platformFontFamily");
1756            
1757            this.fontFamily          = fontFamily;
1758            this.fontStyle           = fontStyle;
1759            this.fontVariant         = fontVariant;
1760            this.fontWeight          = fontWeight;
1761            this.fontStretch         = fontStretch;
1762            this.unicodeRange        = unicodeRange;
1763            this.src                 = src;
1764            this.platformFontFamily  = platformFontFamily;
1765            this.fontVariationAxes   = fontVariationAxes;
1766        }
1767        
1768        /**
1769         * JSON Object Constructor
1770         * @param jo A Json-Object having data about an instance of {@code 'FontFace'}.
1771         */
1772        public FontFace (JsonObject jo)
1773        {
1774            this.fontFamily          = ReadJSON.getString(jo, "fontFamily", false, true);
1775            this.fontStyle           = ReadJSON.getString(jo, "fontStyle", false, true);
1776            this.fontVariant         = ReadJSON.getString(jo, "fontVariant", false, true);
1777            this.fontWeight          = ReadJSON.getString(jo, "fontWeight", false, true);
1778            this.fontStretch         = ReadJSON.getString(jo, "fontStretch", false, true);
1779            this.unicodeRange        = ReadJSON.getString(jo, "unicodeRange", false, true);
1780            this.src                 = ReadJSON.getString(jo, "src", false, true);
1781            this.platformFontFamily  = ReadJSON.getString(jo, "platformFontFamily", false, true);
1782            this.fontVariationAxes   = (jo.getJsonArray("fontVariationAxes") == null)
1783            ? null
1784            : ReadArrJSON.DimN.objArr(jo.getJsonArray("fontVariationAxes"), null, 0, CSS.FontVariationAxis[].class);
1785        }
1786        
1787    }
1788    
1789    /** CSS keyframes rule representation. */
1790    public static class CSSKeyframesRule extends BaseType
1791    {
1792        /** For Object Serialization.  java.io.Serializable */
1793        protected static final long serialVersionUID = 1;
1794        
1795        public boolean[] optionals()
1796        { return new boolean[] { false, false, }; }
1797        
1798        /** Animation name. */
1799        public final CSS.Value animationName;
1800        
1801        /** List of keyframes. */
1802        public final CSS.CSSKeyframeRule[] keyframes;
1803        
1804        /**
1805         * Constructor
1806         *
1807         * @param animationName Animation name.
1808         * 
1809         * @param keyframes List of keyframes.
1810         */
1811        public CSSKeyframesRule(CSS.Value animationName, CSS.CSSKeyframeRule[] keyframes)
1812        {
1813            // Exception-Check(s) to ensure that if any parameters which are not declared as
1814            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1815            
1816            if (animationName == null) BRDPC.throwNPE("animationName");
1817            if (keyframes == null)     BRDPC.throwNPE("keyframes");
1818            
1819            this.animationName  = animationName;
1820            this.keyframes      = keyframes;
1821        }
1822        
1823        /**
1824         * JSON Object Constructor
1825         * @param jo A Json-Object having data about an instance of {@code 'CSSKeyframesRule'}.
1826         */
1827        public CSSKeyframesRule (JsonObject jo)
1828        {
1829            this.animationName  = ReadJSON.XL.getObject(jo, "animationName", CSS.Value.class, false, true);
1830            this.keyframes      = (jo.getJsonArray("keyframes") == null)
1831            ? null
1832            : ReadArrJSON.DimN.objArr(jo.getJsonArray("keyframes"), null, 0, CSS.CSSKeyframeRule[].class);
1833        }
1834        
1835    }
1836    
1837    /** CSS keyframe rule representation. */
1838    public static class CSSKeyframeRule extends BaseType
1839    {
1840        /** For Object Serialization.  java.io.Serializable */
1841        protected static final long serialVersionUID = 1;
1842        
1843        public boolean[] optionals()
1844        { return new boolean[] { true, false, false, false, }; }
1845        
1846        /**
1847         * The css style sheet identifier (absent for user agent stylesheet and user-specified
1848         * stylesheet rules) this rule came from.
1849         * <BR />
1850         * <BR /><B>OPTIONAL</B>
1851         */
1852        public final String styleSheetId;
1853        
1854        /** Parent stylesheet's origin. */
1855        public final String origin;
1856        
1857        /** Associated key text. */
1858        public final CSS.Value keyText;
1859        
1860        /** Associated style declaration. */
1861        public final CSS.CSSStyle style;
1862        
1863        /**
1864         * Constructor
1865         *
1866         * @param styleSheetId 
1867         * The css style sheet identifier (absent for user agent stylesheet and user-specified
1868         * stylesheet rules) this rule came from.
1869         * <BR /><B>OPTIONAL</B>
1870         * 
1871         * @param origin Parent stylesheet's origin.
1872         * 
1873         * @param keyText Associated key text.
1874         * 
1875         * @param style Associated style declaration.
1876         */
1877        public CSSKeyframeRule
1878            (String styleSheetId, String origin, CSS.Value keyText, CSS.CSSStyle style)
1879        {
1880            // Exception-Check(s) to ensure that if any parameters which are not declared as
1881            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1882            
1883            if (origin == null)  BRDPC.throwNPE("origin");
1884            if (keyText == null) BRDPC.throwNPE("keyText");
1885            if (style == null)   BRDPC.throwNPE("style");
1886            
1887            // Exception-Check(s) to ensure that if any parameters which must adhere to a
1888            // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw.
1889            
1890            BRDPC.checkIAE("origin", origin, "CSS.StyleSheetOrigin", CSS.StyleSheetOrigin);
1891            
1892            this.styleSheetId  = styleSheetId;
1893            this.origin        = origin;
1894            this.keyText       = keyText;
1895            this.style         = style;
1896        }
1897        
1898        /**
1899         * JSON Object Constructor
1900         * @param jo A Json-Object having data about an instance of {@code 'CSSKeyframeRule'}.
1901         */
1902        public CSSKeyframeRule (JsonObject jo)
1903        {
1904            this.styleSheetId  = ReadJSON.getString(jo, "styleSheetId", true, false);
1905            this.origin        = ReadJSON.getString(jo, "origin", false, true);
1906            this.keyText       = ReadJSON.XL.getObject(jo, "keyText", CSS.Value.class, false, true);
1907            this.style         = ReadJSON.XL.getObject(jo, "style", CSS.CSSStyle.class, false, true);
1908        }
1909        
1910    }
1911    
1912    /** A descriptor of operation to mutate style declaration text. */
1913    public static class StyleDeclarationEdit extends BaseType
1914    {
1915        /** For Object Serialization.  java.io.Serializable */
1916        protected static final long serialVersionUID = 1;
1917        
1918        public boolean[] optionals()
1919        { return new boolean[] { false, false, false, }; }
1920        
1921        /** The css style sheet identifier. */
1922        public final String styleSheetId;
1923        
1924        /** The range of the style text in the enclosing stylesheet. */
1925        public final CSS.SourceRange range;
1926        
1927        /** New style text. */
1928        public final String text;
1929        
1930        /**
1931         * Constructor
1932         *
1933         * @param styleSheetId The css style sheet identifier.
1934         * 
1935         * @param range The range of the style text in the enclosing stylesheet.
1936         * 
1937         * @param text New style text.
1938         */
1939        public StyleDeclarationEdit(String styleSheetId, CSS.SourceRange range, String text)
1940        {
1941            // Exception-Check(s) to ensure that if any parameters which are not declared as
1942            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
1943            
1944            if (styleSheetId == null) BRDPC.throwNPE("styleSheetId");
1945            if (range == null)        BRDPC.throwNPE("range");
1946            if (text == null)         BRDPC.throwNPE("text");
1947            
1948            this.styleSheetId  = styleSheetId;
1949            this.range         = range;
1950            this.text          = text;
1951        }
1952        
1953        /**
1954         * JSON Object Constructor
1955         * @param jo A Json-Object having data about an instance of {@code 'StyleDeclarationEdit'}.
1956         */
1957        public StyleDeclarationEdit (JsonObject jo)
1958        {
1959            this.styleSheetId  = ReadJSON.getString(jo, "styleSheetId", false, true);
1960            this.range         = ReadJSON.XL.getObject(jo, "range", CSS.SourceRange.class, false, true);
1961            this.text          = ReadJSON.getString(jo, "text", false, true);
1962        }
1963        
1964    }
1965    
1966    /**
1967     * Fires whenever a MediaQuery result changes (for example, after a browser window has been
1968     * resized.) The current implementation considers only viewport-dependent media features.
1969     *
1970     * <BR /><BR />This is Marker-Event.  Marker-Event's are Events that do not posses
1971     * any data, fields or state.  When they are fired, only the event name is supplied.
1972     */
1973    public static class mediaQueryResultChanged extends BrowserEvent
1974    {
1975        /** For Object Serialization.  java.io.Serializable */
1976        protected static final long serialVersionUID = 1;
1977    
1978        public boolean[] optionals() { return new boolean[0]; }
1979    
1980        /** JSON Object Constructor */
1981        public mediaQueryResultChanged(JsonObject jo)
1982        { super("CSS", "mediaQueryResultChanged", 0); }
1983    
1984        @Override
1985        public String toString() { return "CSS.mediaQueryResultChanged Marker Event\n"; }
1986    }
1987    
1988    /**
1989     * Fires whenever a web font is updated.  A non-empty font parameter indicates a successfully loaded
1990     * web font
1991     */
1992    public static class fontsUpdated extends BrowserEvent
1993    {
1994        /** For Object Serialization.  java.io.Serializable */
1995        protected static final long serialVersionUID = 1;
1996        
1997        public boolean[] optionals()
1998        { return new boolean[] { true, }; }
1999        
2000        /**
2001         * The web font that has loaded.
2002         * <BR />
2003         * <BR /><B>OPTIONAL</B>
2004         */
2005        public final CSS.FontFace font;
2006        
2007        /**
2008         * Constructor
2009         *
2010         * @param font The web font that has loaded.
2011         * <BR /><B>OPTIONAL</B>
2012         */
2013        public fontsUpdated(CSS.FontFace font)
2014        {
2015            super("CSS", "fontsUpdated", 1);
2016            
2017            this.font  = font;
2018        }
2019        
2020        /**
2021         * JSON Object Constructor
2022         * @param jo A Json-Object having data about an instance of {@code 'fontsUpdated'}.
2023         */
2024        public fontsUpdated (JsonObject jo)
2025        {
2026            super("CSS", "fontsUpdated", 1);
2027        
2028            this.font  = ReadJSON.XL.getObject(jo, "font", CSS.FontFace.class, true, false);
2029        }
2030        
2031    }
2032    
2033    /** Fired whenever an active document stylesheet is added. */
2034    public static class styleSheetAdded extends BrowserEvent
2035    {
2036        /** For Object Serialization.  java.io.Serializable */
2037        protected static final long serialVersionUID = 1;
2038        
2039        public boolean[] optionals()
2040        { return new boolean[] { false, }; }
2041        
2042        /** Added stylesheet metainfo. */
2043        public final CSS.CSSStyleSheetHeader header;
2044        
2045        /**
2046         * Constructor
2047         *
2048         * @param header Added stylesheet metainfo.
2049         */
2050        public styleSheetAdded(CSS.CSSStyleSheetHeader header)
2051        {
2052            super("CSS", "styleSheetAdded", 1);
2053            
2054            // Exception-Check(s) to ensure that if any parameters which are not declared as
2055            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2056            
2057            if (header == null) BRDPC.throwNPE("header");
2058            
2059            this.header  = header;
2060        }
2061        
2062        /**
2063         * JSON Object Constructor
2064         * @param jo A Json-Object having data about an instance of {@code 'styleSheetAdded'}.
2065         */
2066        public styleSheetAdded (JsonObject jo)
2067        {
2068            super("CSS", "styleSheetAdded", 1);
2069        
2070            this.header  = ReadJSON.XL.getObject(jo, "header", CSS.CSSStyleSheetHeader.class, false, true);
2071        }
2072        
2073    }
2074    
2075    /** Fired whenever a stylesheet is changed as a result of the client operation. */
2076    public static class styleSheetChanged extends BrowserEvent
2077    {
2078        /** For Object Serialization.  java.io.Serializable */
2079        protected static final long serialVersionUID = 1;
2080        
2081        public boolean[] optionals()
2082        { return new boolean[] { false, }; }
2083        
2084        /** <CODE>[No Description Provided by Google]</CODE> */
2085        public final String styleSheetId;
2086        
2087        /**
2088         * Constructor
2089         *
2090         * @param styleSheetId -
2091         */
2092        public styleSheetChanged(String styleSheetId)
2093        {
2094            super("CSS", "styleSheetChanged", 1);
2095            
2096            // Exception-Check(s) to ensure that if any parameters which are not declared as
2097            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2098            
2099            if (styleSheetId == null) BRDPC.throwNPE("styleSheetId");
2100            
2101            this.styleSheetId  = styleSheetId;
2102        }
2103        
2104        /**
2105         * JSON Object Constructor
2106         * @param jo A Json-Object having data about an instance of {@code 'styleSheetChanged'}.
2107         */
2108        public styleSheetChanged (JsonObject jo)
2109        {
2110            super("CSS", "styleSheetChanged", 1);
2111        
2112            this.styleSheetId  = ReadJSON.getString(jo, "styleSheetId", false, true);
2113        }
2114        
2115    }
2116    
2117    /** Fired whenever an active document stylesheet is removed. */
2118    public static class styleSheetRemoved extends BrowserEvent
2119    {
2120        /** For Object Serialization.  java.io.Serializable */
2121        protected static final long serialVersionUID = 1;
2122        
2123        public boolean[] optionals()
2124        { return new boolean[] { false, }; }
2125        
2126        /** Identifier of the removed stylesheet. */
2127        public final String styleSheetId;
2128        
2129        /**
2130         * Constructor
2131         *
2132         * @param styleSheetId Identifier of the removed stylesheet.
2133         */
2134        public styleSheetRemoved(String styleSheetId)
2135        {
2136            super("CSS", "styleSheetRemoved", 1);
2137            
2138            // Exception-Check(s) to ensure that if any parameters which are not declared as
2139            // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2140            
2141            if (styleSheetId == null) BRDPC.throwNPE("styleSheetId");
2142            
2143            this.styleSheetId  = styleSheetId;
2144        }
2145        
2146        /**
2147         * JSON Object Constructor
2148         * @param jo A Json-Object having data about an instance of {@code 'styleSheetRemoved'}.
2149         */
2150        public styleSheetRemoved (JsonObject jo)
2151        {
2152            super("CSS", "styleSheetRemoved", 1);
2153        
2154            this.styleSheetId  = ReadJSON.getString(jo, "styleSheetId", false, true);
2155        }
2156        
2157    }
2158    
2159    
2160    // Counter for keeping the WebSocket Request ID's distinct.
2161    private static int counter = 1;
2162    
2163    /**
2164     * Inserts a new rule with the given <CODE>ruleText</CODE> in a stylesheet with given <CODE>styleSheetId</CODE>, at the
2165     * position specified by <CODE>location</CODE>.
2166     * 
2167     * @param styleSheetId The css style sheet identifier where a new rule should be inserted.
2168     * 
2169     * @param ruleText The text of a new rule.
2170     * 
2171     * @param location Text position of a new rule in the target style sheet.
2172     * 
2173     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2174     * {@link CSS.CSSRule}&gt;</CODE>
2175     * 
2176     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2177     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2178     * {@link CSS.CSSRule}&gt;</CODE> will be returned.
2179     *
2180     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2181     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2182      * may be retrieved.</I>
2183     *
2184     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2185     * <BR /><BR /><UL CLASS=JDUL>
2186     * <LI><CODE>{@link CSS.CSSRule} (<B>rule</B></CODE>)
2187     *     <BR />The newly created rule.
2188     * </LI>
2189     * </UL> */
2190    public static Script<String, JsonObject, CSS.CSSRule> addRule
2191        (String styleSheetId, String ruleText, CSS.SourceRange location)
2192    {
2193        // Exception-Check(s) to ensure that if any parameters which are not declared as
2194        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2195        
2196        if (styleSheetId == null) BRDPC.throwNPE("styleSheetId");
2197        if (ruleText == null)     BRDPC.throwNPE("ruleText");
2198        if (location == null)     BRDPC.throwNPE("location");
2199        
2200        final int       webSocketID = 12000000 + counter++;
2201        final boolean[] optionals   = { false, false, false, };
2202        
2203        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2204        String requestJSON = WriteJSON.get(
2205            parameterTypes.get("addRule"),
2206            parameterNames.get("addRule"),
2207            optionals, webSocketID,
2208            "CSS.addRule",
2209            styleSheetId, ruleText, location
2210        );
2211        
2212        // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSRule'
2213        Function<JsonObject, CSS.CSSRule> responseProcessor = (JsonObject jo) ->
2214            ReadJSON.XL.getObject(jo, "rule", CSS.CSSRule.class, false, true);
2215        
2216        // Pass the 'defaultSender' to Script-Constructor
2217        // The sender that is used can be changed before executing script.
2218        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2219    }
2220    
2221    /**
2222     * Returns all class names from specified stylesheet.
2223     * 
2224     * @param styleSheetId -
2225     * 
2226     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2227     * String[]&gt;</CODE>
2228     * 
2229     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2230     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2231     * String[]&gt;</CODE> will be returned.
2232     *
2233     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2234     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2235      * may be retrieved.</I>
2236     *
2237     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2238     * <BR /><BR /><UL CLASS=JDUL>
2239     * <LI><CODE>String[] (<B>classNames</B></CODE>)
2240     *     <BR />Class name list.
2241     * </LI>
2242     * </UL> */
2243    public static Script<String, JsonObject, String[]> collectClassNames(String styleSheetId)
2244    {
2245        // Exception-Check(s) to ensure that if any parameters which are not declared as
2246        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2247        
2248        if (styleSheetId == null) BRDPC.throwNPE("styleSheetId");
2249        
2250        final int       webSocketID = 12001000 + counter++;
2251        final boolean[] optionals   = { false, };
2252        
2253        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2254        String requestJSON = WriteJSON.get(
2255            parameterTypes.get("collectClassNames"),
2256            parameterNames.get("collectClassNames"),
2257            optionals, webSocketID,
2258            "CSS.collectClassNames",
2259            styleSheetId
2260        );
2261        
2262        // 'JSON Binding' ... Converts Browser Response-JSON to 'String[]'
2263        Function<JsonObject, String[]> responseProcessor = (JsonObject jo) ->
2264            (jo.getJsonArray("classNames") == null)
2265                ? null
2266                : ReadArrJSON.DimN.strArr(jo.getJsonArray("classNames"), null, 0, String[].class);
2267        
2268        // Pass the 'defaultSender' to Script-Constructor
2269        // The sender that is used can be changed before executing script.
2270        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2271    }
2272    
2273    /**
2274     * Creates a new special "via-inspector" stylesheet in the frame with given <CODE>frameId</CODE>.
2275     * 
2276     * @param frameId Identifier of the frame where "via-inspector" stylesheet should be created.
2277     * 
2278     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2279     * String&gt;</CODE>
2280     * 
2281     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2282     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2283     * String&gt;</CODE> will be returned.
2284     *
2285     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2286     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2287      * may be retrieved.</I>
2288     *
2289     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2290     * <BR /><BR /><UL CLASS=JDUL>
2291     * <LI><CODE>String (<B>styleSheetId</B></CODE>)
2292     *     <BR />Identifier of the created "via-inspector" stylesheet.
2293     * </LI>
2294     * </UL> */
2295    public static Script<String, JsonObject, String> createStyleSheet(String frameId)
2296    {
2297        // Exception-Check(s) to ensure that if any parameters which are not declared as
2298        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2299        
2300        if (frameId == null) BRDPC.throwNPE("frameId");
2301        
2302        final int       webSocketID = 12002000 + counter++;
2303        final boolean[] optionals   = { false, };
2304        
2305        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2306        String requestJSON = WriteJSON.get(
2307            parameterTypes.get("createStyleSheet"),
2308            parameterNames.get("createStyleSheet"),
2309            optionals, webSocketID,
2310            "CSS.createStyleSheet",
2311            frameId
2312        );
2313        
2314        // 'JSON Binding' ... Converts Browser Response-JSON to 'String'
2315        Function<JsonObject, String> responseProcessor = (JsonObject jo) ->
2316            ReadJSON.getString(jo, "styleSheetId", false, true);
2317        
2318        // Pass the 'defaultSender' to Script-Constructor
2319        // The sender that is used can be changed before executing script.
2320        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2321    }
2322    
2323    /**
2324     * Disables the CSS agent for the given page.
2325     * 
2326     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2327     * {@link Ret0}&gt;</CODE>
2328     *
2329     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2330     * browser receives the invocation-request.
2331     *
2332     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2333     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2334     * {@code >} to ensure the Browser Function has run to completion.
2335     */
2336    public static Script<String, JsonObject, Ret0> disable()
2337    {
2338        final int          webSocketID = 12003000 + counter++;
2339        final boolean[]    optionals   = new boolean[0];
2340        
2341        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2342        String requestJSON = WriteJSON.get(
2343            parameterTypes.get("disable"),
2344            parameterNames.get("disable"),
2345            optionals, webSocketID,
2346            "CSS.disable"
2347        );
2348        
2349        // This Remote Command does not have a Return-Value.
2350        return new Script<>
2351            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2352    }
2353    
2354    /**
2355     * Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been
2356     * enabled until the result of this command is received.
2357     * 
2358     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2359     * {@link Ret0}&gt;</CODE>
2360     *
2361     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2362     * browser receives the invocation-request.
2363     *
2364     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2365     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2366     * {@code >} to ensure the Browser Function has run to completion.
2367     */
2368    public static Script<String, JsonObject, Ret0> enable()
2369    {
2370        final int          webSocketID = 12004000 + counter++;
2371        final boolean[]    optionals   = new boolean[0];
2372        
2373        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2374        String requestJSON = WriteJSON.get(
2375            parameterTypes.get("enable"),
2376            parameterNames.get("enable"),
2377            optionals, webSocketID,
2378            "CSS.enable"
2379        );
2380        
2381        // This Remote Command does not have a Return-Value.
2382        return new Script<>
2383            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2384    }
2385    
2386    /**
2387     * Ensures that the given node will have specified pseudo-classes whenever its style is computed by
2388     * the browser.
2389     * 
2390     * @param nodeId The element id for which to force the pseudo state.
2391     * 
2392     * @param forcedPseudoClasses Element pseudo classes to force when computing the element's style.
2393     * 
2394     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2395     * {@link Ret0}&gt;</CODE>
2396     *
2397     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2398     * browser receives the invocation-request.
2399     *
2400     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2401     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2402     * {@code >} to ensure the Browser Function has run to completion.
2403     */
2404    public static Script<String, JsonObject, Ret0> forcePseudoState
2405        (int nodeId, String[] forcedPseudoClasses)
2406    {
2407        // Exception-Check(s) to ensure that if any parameters which are not declared as
2408        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2409        
2410        if (forcedPseudoClasses == null) BRDPC.throwNPE("forcedPseudoClasses");
2411        
2412        final int       webSocketID = 12005000 + counter++;
2413        final boolean[] optionals   = { false, false, };
2414        
2415        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2416        String requestJSON = WriteJSON.get(
2417            parameterTypes.get("forcePseudoState"),
2418            parameterNames.get("forcePseudoState"),
2419            optionals, webSocketID,
2420            "CSS.forcePseudoState",
2421            nodeId, forcedPseudoClasses
2422        );
2423        
2424        // This Remote Command does not have a Return-Value.
2425        return new Script<>
2426            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2427    }
2428    
2429    /**
2430     * <CODE>[No Description Provided by Google]</CODE>
2431     * 
2432     * @param nodeId Id of the node to get background colors for.
2433     * 
2434     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2435     * {@link Ret3}&gt;</CODE>
2436     *
2437     * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 
2438     * {@link Script#exec()}), and a {@link Promise} returned.
2439     *
2440     * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B>
2441     * (using {@link Promise#await()}), the {@code Ret3} will subsequently
2442     * be returned from that call.
2443     * 
2444     * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated
2445     * in an instance of <B>{@link Ret3}</B>
2446     *
2447     * <BR /><BR /><UL CLASS=JDUL>
2448     * <LI><CODE><B>Ret3.a:</B> String[] (<B>backgroundColors</B>)</CODE>
2449     *     <BR />The range of background colors behind this element, if it contains any visible text. If no
2450     *     visible text is present, this will be undefined. In the case of a flat background color,
2451     *     this will consist of simply that color. In the case of a gradient, this will consist of each
2452     *     of the color stops. For anything more complicated, this will be an empty array. Images will
2453     *     be ignored (as if the image had failed to load).
2454     *     <BR /><BR /></LI>
2455     * <LI><CODE><B>Ret3.b:</B> String (<B>computedFontSize</B>)</CODE>
2456     *     <BR />The computed font size for this node, as a CSS computed value string (e.g. '12px').
2457     *     <BR /><BR /></LI>
2458     * <LI><CODE><B>Ret3.c:</B> String (<B>computedFontWeight</B>)</CODE>
2459     *     <BR />The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or
2460     *     '100').
2461     *     </LI>
2462     * </UL>
2463     */
2464    public static Script<String, JsonObject, Ret3<String[], String, String>> getBackgroundColors
2465        (int nodeId)
2466    {
2467        final int       webSocketID = 12006000 + counter++;
2468        final boolean[] optionals   = { false, };
2469        
2470        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2471        String requestJSON = WriteJSON.get(
2472            parameterTypes.get("getBackgroundColors"),
2473            parameterNames.get("getBackgroundColors"),
2474            optionals, webSocketID,
2475            "CSS.getBackgroundColors",
2476            nodeId
2477        );
2478        
2479        // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret3'
2480        Function<JsonObject, Ret3<String[], String, String>> 
2481            responseProcessor = (JsonObject jo) -> new Ret3<>(
2482                (jo.getJsonArray("backgroundColors") == null)
2483                    ? null
2484                    : ReadArrJSON.DimN.strArr(jo.getJsonArray("backgroundColors"), null, 0, String[].class),
2485                ReadJSON.getString(jo, "computedFontSize", true, false),
2486                ReadJSON.getString(jo, "computedFontWeight", true, false)
2487            );
2488        
2489        // Pass the 'defaultSender' to Script-Constructor
2490        // The sender that is used can be changed before executing script.
2491        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2492    }
2493    
2494    /**
2495     * Returns the computed style for a DOM node identified by <CODE>nodeId</CODE>.
2496     * 
2497     * @param nodeId -
2498     * 
2499     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2500     * {@link CSS.CSSComputedStyleProperty}[]&gt;</CODE>
2501     * 
2502     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2503     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2504     * {@link CSS.CSSComputedStyleProperty}[]&gt;</CODE> will be returned.
2505     *
2506     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2507     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2508      * may be retrieved.</I>
2509     *
2510     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2511     * <BR /><BR /><UL CLASS=JDUL>
2512     * <LI><CODE>{@link CSS.CSSComputedStyleProperty}[] (<B>computedStyle</B></CODE>)
2513     *     <BR />Computed style for the specified DOM node.
2514     * </LI>
2515     * </UL> */
2516    public static Script<String, JsonObject, CSS.CSSComputedStyleProperty[]> getComputedStyleForNode
2517        (int nodeId)
2518    {
2519        final int       webSocketID = 12007000 + counter++;
2520        final boolean[] optionals   = { false, };
2521        
2522        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2523        String requestJSON = WriteJSON.get(
2524            parameterTypes.get("getComputedStyleForNode"),
2525            parameterNames.get("getComputedStyleForNode"),
2526            optionals, webSocketID,
2527            "CSS.getComputedStyleForNode",
2528            nodeId
2529        );
2530        
2531        // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSComputedStyleProperty[]'
2532        Function<JsonObject, CSS.CSSComputedStyleProperty[]> responseProcessor = (JsonObject jo) ->
2533            (jo.getJsonArray("computedStyle") == null)
2534                ? null
2535                : ReadArrJSON.DimN.objArr(jo.getJsonArray("computedStyle"), null, 0, CSS.CSSComputedStyleProperty[].class);
2536        
2537        // Pass the 'defaultSender' to Script-Constructor
2538        // The sender that is used can be changed before executing script.
2539        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2540    }
2541    
2542    /**
2543     * Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM
2544     * attributes) for a DOM node identified by <CODE>nodeId</CODE>.
2545     * 
2546     * @param nodeId -
2547     * 
2548     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2549     * {@link Ret2}&gt;</CODE>
2550     *
2551     * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 
2552     * {@link Script#exec()}), and a {@link Promise} returned.
2553     *
2554     * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B>
2555     * (using {@link Promise#await()}), the {@code Ret2} will subsequently
2556     * be returned from that call.
2557     * 
2558     * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated
2559     * in an instance of <B>{@link Ret2}</B>
2560     *
2561     * <BR /><BR /><UL CLASS=JDUL>
2562     * <LI><CODE><B>Ret2.a:</B> {@link CSS.CSSStyle} (<B>inlineStyle</B>)</CODE>
2563     *     <BR />Inline style for the specified DOM node.
2564     *     <BR /><BR /></LI>
2565     * <LI><CODE><B>Ret2.b:</B> {@link CSS.CSSStyle} (<B>attributesStyle</B>)</CODE>
2566     *     <BR />Attribute-defined element style (e.g. resulting from "width=20 height=100%").
2567     *     </LI>
2568     * </UL>
2569     */
2570    public static Script<String, JsonObject, Ret2<CSS.CSSStyle, CSS.CSSStyle>> getInlineStylesForNode
2571        (int nodeId)
2572    {
2573        final int       webSocketID = 12008000 + counter++;
2574        final boolean[] optionals   = { false, };
2575        
2576        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2577        String requestJSON = WriteJSON.get(
2578            parameterTypes.get("getInlineStylesForNode"),
2579            parameterNames.get("getInlineStylesForNode"),
2580            optionals, webSocketID,
2581            "CSS.getInlineStylesForNode",
2582            nodeId
2583        );
2584        
2585        // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2'
2586        Function<JsonObject, Ret2<CSS.CSSStyle, CSS.CSSStyle>> 
2587            responseProcessor = (JsonObject jo) -> new Ret2<>(
2588                ReadJSON.XL.getObject(jo, "inlineStyle", CSS.CSSStyle.class, true, false),
2589                ReadJSON.XL.getObject(jo, "attributesStyle", CSS.CSSStyle.class, true, false)
2590            );
2591        
2592        // Pass the 'defaultSender' to Script-Constructor
2593        // The sender that is used can be changed before executing script.
2594        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2595    }
2596    
2597    /**
2598     * Returns requested styles for a DOM node identified by <CODE>nodeId</CODE>.
2599     * 
2600     * @param nodeId -
2601     * 
2602     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2603     * {@link Ret6}&gt;</CODE>
2604     *
2605     * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 
2606     * {@link Script#exec()}), and a {@link Promise} returned.
2607     *
2608     * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B>
2609     * (using {@link Promise#await()}), the {@code Ret6} will subsequently
2610     * be returned from that call.
2611     * 
2612     * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated
2613     * in an instance of <B>{@link Ret6}</B>
2614     *
2615     * <BR /><BR /><UL CLASS=JDUL>
2616     * <LI><CODE><B>Ret6.a1:</B> {@link CSS.CSSStyle} (<B>inlineStyle</B>)</CODE>
2617     *     <BR />Inline style for the specified DOM node.
2618     *     <BR /><BR /></LI>
2619     * <LI><CODE><B>Ret6.b2:</B> {@link CSS.CSSStyle} (<B>attributesStyle</B>)</CODE>
2620     *     <BR />Attribute-defined element style (e.g. resulting from "width=20 height=100%").
2621     *     <BR /><BR /></LI>
2622     * <LI><CODE><B>Ret6.c3:</B> {@link CSS.RuleMatch}[] (<B>matchedCSSRules</B>)</CODE>
2623     *     <BR />CSS rules matching this node, from all applicable stylesheets.
2624     *     <BR /><BR /></LI>
2625     * <LI><CODE><B>Ret6.d4:</B> {@link CSS.PseudoElementMatches}[] (<B>pseudoElements</B>)</CODE>
2626     *     <BR />Pseudo style matches for this node.
2627     *     <BR /><BR /></LI>
2628     * <LI><CODE><B>Ret6.e5:</B> {@link CSS.InheritedStyleEntry}[] (<B>inherited</B>)</CODE>
2629     *     <BR />A chain of inherited styles (from the immediate node parent up to the DOM tree root).
2630     *     <BR /><BR /></LI>
2631     * <LI><CODE><B>Ret6.f6:</B> {@link CSS.CSSKeyframesRule}[] (<B>cssKeyframesRules</B>)</CODE>
2632     *     <BR />A list of CSS keyframed animations matching this node.
2633     *     </LI>
2634     * </UL>
2635     */
2636    public static Script<String, JsonObject, Ret6<CSS.CSSStyle, CSS.CSSStyle, CSS.RuleMatch[], CSS.PseudoElementMatches[], CSS.InheritedStyleEntry[], CSS.CSSKeyframesRule[]>> 
2637        getMatchedStylesForNode(int nodeId)
2638    {
2639        final int       webSocketID = 12009000 + counter++;
2640        final boolean[] optionals   = { false, };
2641        
2642        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2643        String requestJSON = WriteJSON.get(
2644            parameterTypes.get("getMatchedStylesForNode"),
2645            parameterNames.get("getMatchedStylesForNode"),
2646            optionals, webSocketID,
2647            "CSS.getMatchedStylesForNode",
2648            nodeId
2649        );
2650        
2651        // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret6'
2652        Function<JsonObject, Ret6<CSS.CSSStyle, CSS.CSSStyle, CSS.RuleMatch[], CSS.PseudoElementMatches[], CSS.InheritedStyleEntry[], CSS.CSSKeyframesRule[]>> 
2653            responseProcessor = (JsonObject jo) -> new Ret6<>(
2654                ReadJSON.XL.getObject(jo, "inlineStyle", CSS.CSSStyle.class, true, false),
2655                ReadJSON.XL.getObject(jo, "attributesStyle", CSS.CSSStyle.class, true, false),
2656                (jo.getJsonArray("matchedCSSRules") == null)
2657                    ? null
2658                    : ReadArrJSON.DimN.objArr(jo.getJsonArray("matchedCSSRules"), null, 0, CSS.RuleMatch[].class),
2659                (jo.getJsonArray("pseudoElements") == null)
2660                    ? null
2661                    : ReadArrJSON.DimN.objArr(jo.getJsonArray("pseudoElements"), null, 0, CSS.PseudoElementMatches[].class),
2662                (jo.getJsonArray("inherited") == null)
2663                    ? null
2664                    : ReadArrJSON.DimN.objArr(jo.getJsonArray("inherited"), null, 0, CSS.InheritedStyleEntry[].class),
2665                (jo.getJsonArray("cssKeyframesRules") == null)
2666                    ? null
2667                    : ReadArrJSON.DimN.objArr(jo.getJsonArray("cssKeyframesRules"), null, 0, CSS.CSSKeyframesRule[].class)
2668            );
2669        
2670        // Pass the 'defaultSender' to Script-Constructor
2671        // The sender that is used can be changed before executing script.
2672        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2673    }
2674    
2675    /**
2676     * Returns all media queries parsed by the rendering engine.
2677     * 
2678     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2679     * {@link CSS.CSSMedia}[]&gt;</CODE>
2680     * 
2681     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2682     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2683     * {@link CSS.CSSMedia}[]&gt;</CODE> will be returned.
2684     *
2685     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2686     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2687      * may be retrieved.</I>
2688     *
2689     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2690     * <BR /><BR /><UL CLASS=JDUL>
2691     * <LI><CODE>{@link CSS.CSSMedia}[] (<B>medias</B></CODE>)
2692     *     <BR />-
2693     * </LI>
2694     * </UL> */
2695    public static Script<String, JsonObject, CSS.CSSMedia[]> getMediaQueries()
2696    {
2697        final int          webSocketID = 12010000 + counter++;
2698        final boolean[]    optionals   = new boolean[0];
2699        
2700        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2701        String requestJSON = WriteJSON.get(
2702            parameterTypes.get("getMediaQueries"),
2703            parameterNames.get("getMediaQueries"),
2704            optionals, webSocketID,
2705            "CSS.getMediaQueries"
2706        );
2707        
2708        // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSMedia[]'
2709        Function<JsonObject, CSS.CSSMedia[]> responseProcessor = (JsonObject jo) ->
2710            (jo.getJsonArray("medias") == null)
2711                ? null
2712                : ReadArrJSON.DimN.objArr(jo.getJsonArray("medias"), null, 0, CSS.CSSMedia[].class);
2713        
2714        // Pass the 'defaultSender' to Script-Constructor
2715        // The sender that is used can be changed before executing script.
2716        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2717    }
2718    
2719    /**
2720     * Requests information about platform fonts which we used to render child TextNodes in the given
2721     * node.
2722     * 
2723     * @param nodeId -
2724     * 
2725     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2726     * {@link CSS.PlatformFontUsage}[]&gt;</CODE>
2727     * 
2728     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2729     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2730     * {@link CSS.PlatformFontUsage}[]&gt;</CODE> will be returned.
2731     *
2732     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2733     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2734      * may be retrieved.</I>
2735     *
2736     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2737     * <BR /><BR /><UL CLASS=JDUL>
2738     * <LI><CODE>{@link CSS.PlatformFontUsage}[] (<B>fonts</B></CODE>)
2739     *     <BR />Usage statistics for every employed platform font.
2740     * </LI>
2741     * </UL> */
2742    public static Script<String, JsonObject, CSS.PlatformFontUsage[]> getPlatformFontsForNode
2743        (int nodeId)
2744    {
2745        final int       webSocketID = 12011000 + counter++;
2746        final boolean[] optionals   = { false, };
2747        
2748        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2749        String requestJSON = WriteJSON.get(
2750            parameterTypes.get("getPlatformFontsForNode"),
2751            parameterNames.get("getPlatformFontsForNode"),
2752            optionals, webSocketID,
2753            "CSS.getPlatformFontsForNode",
2754            nodeId
2755        );
2756        
2757        // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.PlatformFontUsage[]'
2758        Function<JsonObject, CSS.PlatformFontUsage[]> responseProcessor = (JsonObject jo) ->
2759            (jo.getJsonArray("fonts") == null)
2760                ? null
2761                : ReadArrJSON.DimN.objArr(jo.getJsonArray("fonts"), null, 0, CSS.PlatformFontUsage[].class);
2762        
2763        // Pass the 'defaultSender' to Script-Constructor
2764        // The sender that is used can be changed before executing script.
2765        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2766    }
2767    
2768    /**
2769     * Returns the current textual content for a stylesheet.
2770     * 
2771     * @param styleSheetId -
2772     * 
2773     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2774     * String&gt;</CODE>
2775     * 
2776     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2777     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2778     * String&gt;</CODE> will be returned.
2779     *
2780     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2781     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2782      * may be retrieved.</I>
2783     *
2784     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2785     * <BR /><BR /><UL CLASS=JDUL>
2786     * <LI><CODE>String (<B>text</B></CODE>)
2787     *     <BR />The stylesheet text.
2788     * </LI>
2789     * </UL> */
2790    public static Script<String, JsonObject, String> getStyleSheetText(String styleSheetId)
2791    {
2792        // Exception-Check(s) to ensure that if any parameters which are not declared as
2793        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2794        
2795        if (styleSheetId == null) BRDPC.throwNPE("styleSheetId");
2796        
2797        final int       webSocketID = 12012000 + counter++;
2798        final boolean[] optionals   = { false, };
2799        
2800        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2801        String requestJSON = WriteJSON.get(
2802            parameterTypes.get("getStyleSheetText"),
2803            parameterNames.get("getStyleSheetText"),
2804            optionals, webSocketID,
2805            "CSS.getStyleSheetText",
2806            styleSheetId
2807        );
2808        
2809        // 'JSON Binding' ... Converts Browser Response-JSON to 'String'
2810        Function<JsonObject, String> responseProcessor = (JsonObject jo) ->
2811            ReadJSON.getString(jo, "text", false, true);
2812        
2813        // Pass the 'defaultSender' to Script-Constructor
2814        // The sender that is used can be changed before executing script.
2815        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2816    }
2817    
2818    /**
2819     * Starts tracking the given computed styles for updates. The specified array of properties
2820     * replaces the one previously specified. Pass empty array to disable tracking.
2821     * Use takeComputedStyleUpdates to retrieve the list of nodes that had properties modified.
2822     * The changes to computed style properties are only tracked for nodes pushed to the front-end
2823     * by the DOM agent. If no changes to the tracked properties occur after the node has been pushed
2824     * to the front-end, no updates will be issued for the node.
2825     * <BR /><B>EXPERIMENTAL</B>
2826     * 
2827     * @param propertiesToTrack -
2828     * 
2829     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2830     * {@link Ret0}&gt;</CODE>
2831     *
2832     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2833     * browser receives the invocation-request.
2834     *
2835     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2836     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2837     * {@code >} to ensure the Browser Function has run to completion.
2838     */
2839    public static Script<String, JsonObject, Ret0> trackComputedStyleUpdates
2840        (CSS.CSSComputedStyleProperty[] propertiesToTrack)
2841    {
2842        // Exception-Check(s) to ensure that if any parameters which are not declared as
2843        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2844        
2845        if (propertiesToTrack == null) BRDPC.throwNPE("propertiesToTrack");
2846        
2847        final int       webSocketID = 12013000 + counter++;
2848        final boolean[] optionals   = { false, };
2849        
2850        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2851        String requestJSON = WriteJSON.get(
2852            parameterTypes.get("trackComputedStyleUpdates"),
2853            parameterNames.get("trackComputedStyleUpdates"),
2854            optionals, webSocketID,
2855            "CSS.trackComputedStyleUpdates",
2856            (Object) propertiesToTrack
2857        );
2858        
2859        // This Remote Command does not have a Return-Value.
2860        return new Script<>
2861            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2862    }
2863    
2864    /**
2865     * Polls the next batch of computed style updates.
2866     * <BR /><B>EXPERIMENTAL</B>
2867     * 
2868     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2869     * int[]&gt;</CODE>
2870     * 
2871     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2872     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2873     * int[]&gt;</CODE> will be returned.
2874     *
2875     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2876     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2877      * may be retrieved.</I>
2878     *
2879     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2880     * <BR /><BR /><UL CLASS=JDUL>
2881     * <LI><CODE>int[] (<B>nodeIds</B></CODE>)
2882     *     <BR />The list of node Ids that have their tracked computed styles updated
2883     * </LI>
2884     * </UL> */
2885    public static Script<String, JsonObject, int[]> takeComputedStyleUpdates()
2886    {
2887        final int          webSocketID = 12014000 + counter++;
2888        final boolean[]    optionals   = new boolean[0];
2889        
2890        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2891        String requestJSON = WriteJSON.get(
2892            parameterTypes.get("takeComputedStyleUpdates"),
2893            parameterNames.get("takeComputedStyleUpdates"),
2894            optionals, webSocketID,
2895            "CSS.takeComputedStyleUpdates"
2896        );
2897        
2898        // 'JSON Binding' ... Converts Browser Response-JSON to 'int[]'
2899        Function<JsonObject, int[]> responseProcessor = (JsonObject jo) ->
2900            (jo.getJsonArray("nodeIds") == null)
2901                ? null
2902                : ReadArrJSON.DimN.intArr(jo.getJsonArray("nodeIds"), -1, 0, null, int[].class);;
2903        
2904        // Pass the 'defaultSender' to Script-Constructor
2905        // The sender that is used can be changed before executing script.
2906        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
2907    }
2908    
2909    /**
2910     * Find a rule with the given active property for the given node and set the new value for this
2911     * property
2912     * 
2913     * @param nodeId The element id for which to set property.
2914     * 
2915     * @param propertyName -
2916     * 
2917     * @param value -
2918     * 
2919     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2920     * {@link Ret0}&gt;</CODE>
2921     *
2922     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
2923     * browser receives the invocation-request.
2924     *
2925     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
2926     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
2927     * {@code >} to ensure the Browser Function has run to completion.
2928     */
2929    public static Script<String, JsonObject, Ret0> setEffectivePropertyValueForNode
2930        (int nodeId, String propertyName, String value)
2931    {
2932        // Exception-Check(s) to ensure that if any parameters which are not declared as
2933        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2934        
2935        if (propertyName == null) BRDPC.throwNPE("propertyName");
2936        if (value == null)        BRDPC.throwNPE("value");
2937        
2938        final int       webSocketID = 12015000 + counter++;
2939        final boolean[] optionals   = { false, false, false, };
2940        
2941        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2942        String requestJSON = WriteJSON.get(
2943            parameterTypes.get("setEffectivePropertyValueForNode"),
2944            parameterNames.get("setEffectivePropertyValueForNode"),
2945            optionals, webSocketID,
2946            "CSS.setEffectivePropertyValueForNode",
2947            nodeId, propertyName, value
2948        );
2949        
2950        // This Remote Command does not have a Return-Value.
2951        return new Script<>
2952            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
2953    }
2954    
2955    /**
2956     * Modifies the keyframe rule key text.
2957     * 
2958     * @param styleSheetId -
2959     * 
2960     * @param range -
2961     * 
2962     * @param keyText -
2963     * 
2964     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
2965     * {@link CSS.Value}&gt;</CODE>
2966     * 
2967     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
2968     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
2969     * {@link CSS.Value}&gt;</CODE> will be returned.
2970     *
2971     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
2972     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
2973      * may be retrieved.</I>
2974     *
2975     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
2976     * <BR /><BR /><UL CLASS=JDUL>
2977     * <LI><CODE>{@link CSS.Value} (<B>keyText</B></CODE>)
2978     *     <BR />The resulting key text after modification.
2979     * </LI>
2980     * </UL> */
2981    public static Script<String, JsonObject, CSS.Value> setKeyframeKey
2982        (String styleSheetId, CSS.SourceRange range, String keyText)
2983    {
2984        // Exception-Check(s) to ensure that if any parameters which are not declared as
2985        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
2986        
2987        if (styleSheetId == null) BRDPC.throwNPE("styleSheetId");
2988        if (range == null)        BRDPC.throwNPE("range");
2989        if (keyText == null)      BRDPC.throwNPE("keyText");
2990        
2991        final int       webSocketID = 12016000 + counter++;
2992        final boolean[] optionals   = { false, false, false, };
2993        
2994        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
2995        String requestJSON = WriteJSON.get(
2996            parameterTypes.get("setKeyframeKey"),
2997            parameterNames.get("setKeyframeKey"),
2998            optionals, webSocketID,
2999            "CSS.setKeyframeKey",
3000            styleSheetId, range, keyText
3001        );
3002        
3003        // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.Value'
3004        Function<JsonObject, CSS.Value> responseProcessor = (JsonObject jo) ->
3005            ReadJSON.XL.getObject(jo, "keyText", CSS.Value.class, false, true);
3006        
3007        // Pass the 'defaultSender' to Script-Constructor
3008        // The sender that is used can be changed before executing script.
3009        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3010    }
3011    
3012    /**
3013     * Modifies the rule selector.
3014     * 
3015     * @param styleSheetId -
3016     * 
3017     * @param range -
3018     * 
3019     * @param text -
3020     * 
3021     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3022     * {@link CSS.CSSMedia}&gt;</CODE>
3023     * 
3024     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3025     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3026     * {@link CSS.CSSMedia}&gt;</CODE> will be returned.
3027     *
3028     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3029     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3030      * may be retrieved.</I>
3031     *
3032     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3033     * <BR /><BR /><UL CLASS=JDUL>
3034     * <LI><CODE>{@link CSS.CSSMedia} (<B>media</B></CODE>)
3035     *     <BR />The resulting CSS media rule after modification.
3036     * </LI>
3037     * </UL> */
3038    public static Script<String, JsonObject, CSS.CSSMedia> setMediaText
3039        (String styleSheetId, CSS.SourceRange range, String text)
3040    {
3041        // Exception-Check(s) to ensure that if any parameters which are not declared as
3042        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3043        
3044        if (styleSheetId == null) BRDPC.throwNPE("styleSheetId");
3045        if (range == null)        BRDPC.throwNPE("range");
3046        if (text == null)         BRDPC.throwNPE("text");
3047        
3048        final int       webSocketID = 12017000 + counter++;
3049        final boolean[] optionals   = { false, false, false, };
3050        
3051        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3052        String requestJSON = WriteJSON.get(
3053            parameterTypes.get("setMediaText"),
3054            parameterNames.get("setMediaText"),
3055            optionals, webSocketID,
3056            "CSS.setMediaText",
3057            styleSheetId, range, text
3058        );
3059        
3060        // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSMedia'
3061        Function<JsonObject, CSS.CSSMedia> responseProcessor = (JsonObject jo) ->
3062            ReadJSON.XL.getObject(jo, "media", CSS.CSSMedia.class, false, true);
3063        
3064        // Pass the 'defaultSender' to Script-Constructor
3065        // The sender that is used can be changed before executing script.
3066        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3067    }
3068    
3069    /**
3070     * Modifies the expression of a container query.
3071     * <BR /><B>EXPERIMENTAL</B>
3072     * 
3073     * @param styleSheetId -
3074     * 
3075     * @param range -
3076     * 
3077     * @param text -
3078     * 
3079     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3080     * {@link CSS.CSSContainerQuery}&gt;</CODE>
3081     * 
3082     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3083     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3084     * {@link CSS.CSSContainerQuery}&gt;</CODE> will be returned.
3085     *
3086     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3087     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3088      * may be retrieved.</I>
3089     *
3090     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3091     * <BR /><BR /><UL CLASS=JDUL>
3092     * <LI><CODE>{@link CSS.CSSContainerQuery} (<B>containerQuery</B></CODE>)
3093     *     <BR />The resulting CSS container query rule after modification.
3094     * </LI>
3095     * </UL> */
3096    public static Script<String, JsonObject, CSS.CSSContainerQuery> setContainerQueryText
3097        (String styleSheetId, CSS.SourceRange range, String text)
3098    {
3099        // Exception-Check(s) to ensure that if any parameters which are not declared as
3100        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3101        
3102        if (styleSheetId == null) BRDPC.throwNPE("styleSheetId");
3103        if (range == null)        BRDPC.throwNPE("range");
3104        if (text == null)         BRDPC.throwNPE("text");
3105        
3106        final int       webSocketID = 12018000 + counter++;
3107        final boolean[] optionals   = { false, false, false, };
3108        
3109        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3110        String requestJSON = WriteJSON.get(
3111            parameterTypes.get("setContainerQueryText"),
3112            parameterNames.get("setContainerQueryText"),
3113            optionals, webSocketID,
3114            "CSS.setContainerQueryText",
3115            styleSheetId, range, text
3116        );
3117        
3118        // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSContainerQuery'
3119        Function<JsonObject, CSS.CSSContainerQuery> responseProcessor = (JsonObject jo) ->
3120            ReadJSON.XL.getObject(jo, "containerQuery", CSS.CSSContainerQuery.class, false, true);
3121        
3122        // Pass the 'defaultSender' to Script-Constructor
3123        // The sender that is used can be changed before executing script.
3124        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3125    }
3126    
3127    /**
3128     * Modifies the rule selector.
3129     * 
3130     * @param styleSheetId -
3131     * 
3132     * @param range -
3133     * 
3134     * @param selector -
3135     * 
3136     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3137     * {@link CSS.SelectorList}&gt;</CODE>
3138     * 
3139     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3140     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3141     * {@link CSS.SelectorList}&gt;</CODE> will be returned.
3142     *
3143     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3144     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3145      * may be retrieved.</I>
3146     *
3147     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3148     * <BR /><BR /><UL CLASS=JDUL>
3149     * <LI><CODE>{@link CSS.SelectorList} (<B>selectorList</B></CODE>)
3150     *     <BR />The resulting selector list after modification.
3151     * </LI>
3152     * </UL> */
3153    public static Script<String, JsonObject, CSS.SelectorList> setRuleSelector
3154        (String styleSheetId, CSS.SourceRange range, String selector)
3155    {
3156        // Exception-Check(s) to ensure that if any parameters which are not declared as
3157        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3158        
3159        if (styleSheetId == null) BRDPC.throwNPE("styleSheetId");
3160        if (range == null)        BRDPC.throwNPE("range");
3161        if (selector == null)     BRDPC.throwNPE("selector");
3162        
3163        final int       webSocketID = 12019000 + counter++;
3164        final boolean[] optionals   = { false, false, false, };
3165        
3166        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3167        String requestJSON = WriteJSON.get(
3168            parameterTypes.get("setRuleSelector"),
3169            parameterNames.get("setRuleSelector"),
3170            optionals, webSocketID,
3171            "CSS.setRuleSelector",
3172            styleSheetId, range, selector
3173        );
3174        
3175        // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.SelectorList'
3176        Function<JsonObject, CSS.SelectorList> responseProcessor = (JsonObject jo) ->
3177            ReadJSON.XL.getObject(jo, "selectorList", CSS.SelectorList.class, false, true);
3178        
3179        // Pass the 'defaultSender' to Script-Constructor
3180        // The sender that is used can be changed before executing script.
3181        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3182    }
3183    
3184    /**
3185     * Sets the new stylesheet text.
3186     * 
3187     * @param styleSheetId -
3188     * 
3189     * @param text -
3190     * 
3191     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3192     * String&gt;</CODE>
3193     * 
3194     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3195     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3196     * String&gt;</CODE> will be returned.
3197     *
3198     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3199     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3200      * may be retrieved.</I>
3201     *
3202     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3203     * <BR /><BR /><UL CLASS=JDUL>
3204     * <LI><CODE>String (<B>sourceMapURL</B></CODE>)
3205     *     <BR />URL of source map associated with script (if any).
3206     * </LI>
3207     * </UL> */
3208    public static Script<String, JsonObject, String> setStyleSheetText
3209        (String styleSheetId, String text)
3210    {
3211        // Exception-Check(s) to ensure that if any parameters which are not declared as
3212        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3213        
3214        if (styleSheetId == null) BRDPC.throwNPE("styleSheetId");
3215        if (text == null)         BRDPC.throwNPE("text");
3216        
3217        final int       webSocketID = 12020000 + counter++;
3218        final boolean[] optionals   = { false, false, };
3219        
3220        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3221        String requestJSON = WriteJSON.get(
3222            parameterTypes.get("setStyleSheetText"),
3223            parameterNames.get("setStyleSheetText"),
3224            optionals, webSocketID,
3225            "CSS.setStyleSheetText",
3226            styleSheetId, text
3227        );
3228        
3229        // 'JSON Binding' ... Converts Browser Response-JSON to 'String'
3230        Function<JsonObject, String> responseProcessor = (JsonObject jo) ->
3231            ReadJSON.getString(jo, "sourceMapURL", true, false);
3232        
3233        // Pass the 'defaultSender' to Script-Constructor
3234        // The sender that is used can be changed before executing script.
3235        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3236    }
3237    
3238    /**
3239     * Applies specified style edits one after another in the given order.
3240     * 
3241     * @param edits -
3242     * 
3243     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3244     * {@link CSS.CSSStyle}[]&gt;</CODE>
3245     * 
3246     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3247     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3248     * {@link CSS.CSSStyle}[]&gt;</CODE> will be returned.
3249     *
3250     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3251     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3252      * may be retrieved.</I>
3253     *
3254     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3255     * <BR /><BR /><UL CLASS=JDUL>
3256     * <LI><CODE>{@link CSS.CSSStyle}[] (<B>styles</B></CODE>)
3257     *     <BR />The resulting styles after modification.
3258     * </LI>
3259     * </UL> */
3260    public static Script<String, JsonObject, CSS.CSSStyle[]> setStyleTexts
3261        (CSS.StyleDeclarationEdit[] edits)
3262    {
3263        // Exception-Check(s) to ensure that if any parameters which are not declared as
3264        // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw.
3265        
3266        if (edits == null) BRDPC.throwNPE("edits");
3267        
3268        final int       webSocketID = 12021000 + counter++;
3269        final boolean[] optionals   = { false, };
3270        
3271        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3272        String requestJSON = WriteJSON.get(
3273            parameterTypes.get("setStyleTexts"),
3274            parameterNames.get("setStyleTexts"),
3275            optionals, webSocketID,
3276            "CSS.setStyleTexts",
3277            (Object) edits
3278        );
3279        
3280        // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSStyle[]'
3281        Function<JsonObject, CSS.CSSStyle[]> responseProcessor = (JsonObject jo) ->
3282            (jo.getJsonArray("styles") == null)
3283                ? null
3284                : ReadArrJSON.DimN.objArr(jo.getJsonArray("styles"), null, 0, CSS.CSSStyle[].class);
3285        
3286        // Pass the 'defaultSender' to Script-Constructor
3287        // The sender that is used can be changed before executing script.
3288        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3289    }
3290    
3291    /**
3292     * Enables the selector recording.
3293     * 
3294     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3295     * {@link Ret0}&gt;</CODE>
3296     *
3297     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3298     * browser receives the invocation-request.
3299     *
3300     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3301     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3302     * {@code >} to ensure the Browser Function has run to completion.
3303     */
3304    public static Script<String, JsonObject, Ret0> startRuleUsageTracking()
3305    {
3306        final int          webSocketID = 12022000 + counter++;
3307        final boolean[]    optionals   = new boolean[0];
3308        
3309        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3310        String requestJSON = WriteJSON.get(
3311            parameterTypes.get("startRuleUsageTracking"),
3312            parameterNames.get("startRuleUsageTracking"),
3313            optionals, webSocketID,
3314            "CSS.startRuleUsageTracking"
3315        );
3316        
3317        // This Remote Command does not have a Return-Value.
3318        return new Script<>
3319            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3320    }
3321    
3322    /**
3323     * Stop tracking rule usage and return the list of rules that were used since last call to
3324     * <CODE>takeCoverageDelta</CODE> (or since start of coverage instrumentation)
3325     * 
3326     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3327     * {@link CSS.RuleUsage}[]&gt;</CODE>
3328     * 
3329     * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using
3330     * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE>&lt;JsonObject,
3331     * {@link CSS.RuleUsage}[]&gt;</CODE> will be returned.
3332     *
3333     * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>,
3334     * using {@link Promise#await()}, <I>and the returned result of this Browser Function may
3335      * may be retrieved.</I>
3336     *
3337     * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B>
3338     * <BR /><BR /><UL CLASS=JDUL>
3339     * <LI><CODE>{@link CSS.RuleUsage}[] (<B>ruleUsage</B></CODE>)
3340     *     <BR />-
3341     * </LI>
3342     * </UL> */
3343    public static Script<String, JsonObject, CSS.RuleUsage[]> stopRuleUsageTracking()
3344    {
3345        final int          webSocketID = 12023000 + counter++;
3346        final boolean[]    optionals   = new boolean[0];
3347        
3348        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3349        String requestJSON = WriteJSON.get(
3350            parameterTypes.get("stopRuleUsageTracking"),
3351            parameterNames.get("stopRuleUsageTracking"),
3352            optionals, webSocketID,
3353            "CSS.stopRuleUsageTracking"
3354        );
3355        
3356        // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.RuleUsage[]'
3357        Function<JsonObject, CSS.RuleUsage[]> responseProcessor = (JsonObject jo) ->
3358            (jo.getJsonArray("ruleUsage") == null)
3359                ? null
3360                : ReadArrJSON.DimN.objArr(jo.getJsonArray("ruleUsage"), null, 0, CSS.RuleUsage[].class);
3361        
3362        // Pass the 'defaultSender' to Script-Constructor
3363        // The sender that is used can be changed before executing script.
3364        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3365    }
3366    
3367    /**
3368     * Obtain list of rules that became used since last call to this method (or since start of coverage
3369     * instrumentation)
3370     * 
3371     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3372     * {@link Ret2}&gt;</CODE>
3373     *
3374     * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 
3375     * {@link Script#exec()}), and a {@link Promise} returned.
3376     *
3377     * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B>
3378     * (using {@link Promise#await()}), the {@code Ret2} will subsequently
3379     * be returned from that call.
3380     * 
3381     * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated
3382     * in an instance of <B>{@link Ret2}</B>
3383     *
3384     * <BR /><BR /><UL CLASS=JDUL>
3385     * <LI><CODE><B>Ret2.a:</B> {@link CSS.RuleUsage}[] (<B>coverage</B>)</CODE>
3386     *     <BR />-
3387     *     <BR /><BR /></LI>
3388     * <LI><CODE><B>Ret2.b:</B> Number (<B>timestamp</B>)</CODE>
3389     *     <BR />Monotonically increasing time, in seconds.
3390     *     </LI>
3391     * </UL>
3392     */
3393    public static Script<String, JsonObject, Ret2<CSS.RuleUsage[], Number>> takeCoverageDelta()
3394    {
3395        final int          webSocketID = 12024000 + counter++;
3396        final boolean[]    optionals   = new boolean[0];
3397        
3398        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3399        String requestJSON = WriteJSON.get(
3400            parameterTypes.get("takeCoverageDelta"),
3401            parameterNames.get("takeCoverageDelta"),
3402            optionals, webSocketID,
3403            "CSS.takeCoverageDelta"
3404        );
3405        
3406        // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2'
3407        Function<JsonObject, Ret2<CSS.RuleUsage[], Number>> 
3408            responseProcessor = (JsonObject jo) -> new Ret2<>(
3409                (jo.getJsonArray("coverage") == null)
3410                    ? null
3411                    : ReadArrJSON.DimN.objArr(jo.getJsonArray("coverage"), null, 0, CSS.RuleUsage[].class),
3412                ReadJSON.getNUMBER(jo, "timestamp", false, true)
3413            );
3414        
3415        // Pass the 'defaultSender' to Script-Constructor
3416        // The sender that is used can be changed before executing script.
3417        return new Script<>(BRDPC.defaultSender, webSocketID, requestJSON, responseProcessor);
3418    }
3419    
3420    /**
3421     * Enables/disables rendering of local CSS fonts (enabled by default).
3422     * <BR /><B>EXPERIMENTAL</B>
3423     * 
3424     * @param enabled Whether rendering of local fonts is enabled.
3425     * 
3426     * @return An instance of <CODE>{@link Script}&lt;String, {@link JsonObject},
3427     * {@link Ret0}&gt;</CODE>
3428     *
3429     * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the
3430     * browser receives the invocation-request.
3431     *
3432     * <BR /><BR />This Browser-Function <I>does not have</I> a return-value.  You may choose to
3433     * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0}
3434     * {@code >} to ensure the Browser Function has run to completion.
3435     */
3436    public static Script<String, JsonObject, Ret0> setLocalFontsEnabled(boolean enabled)
3437    {
3438        final int       webSocketID = 12025000 + counter++;
3439        final boolean[] optionals   = { false, };
3440        
3441        // Convert Method Parameters into JSON.  Build the JSON Request-Object (as a String)
3442        String requestJSON = WriteJSON.get(
3443            parameterTypes.get("setLocalFontsEnabled"),
3444            parameterNames.get("setLocalFontsEnabled"),
3445            optionals, webSocketID,
3446            "CSS.setLocalFontsEnabled",
3447            enabled
3448        );
3449        
3450        // This Remote Command does not have a Return-Value.
3451        return new Script<>
3452            (BRDPC.defaultSender, webSocketID, requestJSON, BRDPC.NoReturnValues);
3453    }
3454    
3455}