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