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