001package Torello.Browser.BrowserAPI; 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.Browser.BrowserEvent; 013import Torello.Browser.JavaScriptAPI.*; 014import Torello.Browser.helper.*; 015 016import Torello.Java.Additional.*; 017import Torello.Java.JSON.*; 018 019import static Torello.Java.JSON.JFlag.*; 020 021import Torello.Java.StrCmpr; 022import Torello.JavaDoc.StaticFunctional; 023import Torello.JavaDoc.JDHeaderBackgroundImg; 024import Torello.JavaDoc.Excuse; 025 026/** 027 * <SPAN CLASS=COPIEDJDK><B>This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles) 028 * have an associated {@code id} used in subsequent operations on the related object. Each object type has 029 * a specific {@code id} structure, and those are not interchangeable between objects of different kinds. 030 * CSS objects can be loaded using the {@code get*ForNode()} calls (which accept a DOM node id). A client 031 * can also keep track of stylesheets via the {@code styleSheetAdded}/{@code styleSheetRemoved} events and 032 * subsequently load the required stylesheet contents using the {@code getStyleSheet[Text]()} methods.</B></SPAN> 033 * 034 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE> 035 */ 036@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION}) 037@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE") 038public class CSS 039{ 040 // ******************************************************************************************** 041 // ******************************************************************************************** 042 // Class Header Stuff 043 // ******************************************************************************************** 044 // ******************************************************************************************** 045 046 047 // No Pubic Constructors 048 private CSS () { } 049 050 // These two Vector's are used by all the "Methods" exported by this class. java.lang.reflect 051 // is used to generate the JSON String's. It saves thousands of lines of Auto-Generated Code. 052 private static final Map<String, Vector<String>> parameterNames = new HashMap<>(); 053 private static final Map<String, Vector<Class<?>>> parameterTypes = new HashMap<>(); 054 055 // Some Methods do not take any parameters - for instance all the "enable()" and "disable()" 056 // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now, 057 // offically, two empty-vectors. One for String's, and the other for Classes. 058 059 private static final Vector<String> EMPTY_VEC_STR = new Vector<>(); 060 private static final Vector<Class<?>> EMPTY_VEC_CLASS = new Vector<>(); 061 062 static 063 { 064 for (Method m : CSS.class.getMethods()) 065 { 066 // This doesn't work! The parameter names are all "arg0" ... "argN" 067 // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter! 068 // 069 // Vector<String> parameterNamesList = new Vector<>(); -- NOPE! 070 071 Vector<Class<?>> parameterTypesList = new Vector<>(); 072 073 for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType()); 074 075 parameterTypes.put( 076 m.getName(), 077 (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS 078 ); 079 } 080 } 081 082 static 083 { 084 Vector<String> v = null; 085 086 v = new Vector<String>(4); 087 parameterNames.put("addRule", v); 088 Collections.addAll(v, new String[] 089 { "styleSheetId", "ruleText", "location", "nodeForPropertySyntaxValidation", }); 090 091 v = new Vector<String>(1); 092 parameterNames.put("collectClassNames", v); 093 Collections.addAll(v, new String[] 094 { "styleSheetId", }); 095 096 v = new Vector<String>(2); 097 parameterNames.put("createStyleSheet", v); 098 Collections.addAll(v, new String[] 099 { "frameId", "force", }); 100 101 parameterNames.put("disable", EMPTY_VEC_STR); 102 103 parameterNames.put("enable", EMPTY_VEC_STR); 104 105 v = new Vector<String>(2); 106 parameterNames.put("forcePseudoState", v); 107 Collections.addAll(v, new String[] 108 { "nodeId", "forcedPseudoClasses", }); 109 110 v = new Vector<String>(2); 111 parameterNames.put("forceStartingStyle", v); 112 Collections.addAll(v, new String[] 113 { "nodeId", "forced", }); 114 115 v = new Vector<String>(1); 116 parameterNames.put("getBackgroundColors", v); 117 Collections.addAll(v, new String[] 118 { "nodeId", }); 119 120 v = new Vector<String>(1); 121 parameterNames.put("getComputedStyleForNode", v); 122 Collections.addAll(v, new String[] 123 { "nodeId", }); 124 125 v = new Vector<String>(5); 126 parameterNames.put("resolveValues", v); 127 Collections.addAll(v, new String[] 128 { "values", "nodeId", "propertyName", "pseudoType", "pseudoIdentifier", }); 129 130 v = new Vector<String>(2); 131 parameterNames.put("getLonghandProperties", v); 132 Collections.addAll(v, new String[] 133 { "shorthandName", "value", }); 134 135 v = new Vector<String>(1); 136 parameterNames.put("getInlineStylesForNode", v); 137 Collections.addAll(v, new String[] 138 { "nodeId", }); 139 140 v = new Vector<String>(1); 141 parameterNames.put("getAnimatedStylesForNode", v); 142 Collections.addAll(v, new String[] 143 { "nodeId", }); 144 145 v = new Vector<String>(1); 146 parameterNames.put("getMatchedStylesForNode", v); 147 Collections.addAll(v, new String[] 148 { "nodeId", }); 149 150 parameterNames.put("getEnvironmentVariables", EMPTY_VEC_STR); 151 152 parameterNames.put("getMediaQueries", EMPTY_VEC_STR); 153 154 v = new Vector<String>(1); 155 parameterNames.put("getPlatformFontsForNode", v); 156 Collections.addAll(v, new String[] 157 { "nodeId", }); 158 159 v = new Vector<String>(1); 160 parameterNames.put("getStyleSheetText", v); 161 Collections.addAll(v, new String[] 162 { "styleSheetId", }); 163 164 v = new Vector<String>(1); 165 parameterNames.put("getLayersForNode", v); 166 Collections.addAll(v, new String[] 167 { "nodeId", }); 168 169 v = new Vector<String>(2); 170 parameterNames.put("getLocationForSelector", v); 171 Collections.addAll(v, new String[] 172 { "styleSheetId", "selectorText", }); 173 174 v = new Vector<String>(1); 175 parameterNames.put("trackComputedStyleUpdatesForNode", v); 176 Collections.addAll(v, new String[] 177 { "nodeId", }); 178 179 v = new Vector<String>(1); 180 parameterNames.put("trackComputedStyleUpdates", v); 181 Collections.addAll(v, new String[] 182 { "propertiesToTrack", }); 183 184 parameterNames.put("takeComputedStyleUpdates", EMPTY_VEC_STR); 185 186 v = new Vector<String>(3); 187 parameterNames.put("setEffectivePropertyValueForNode", v); 188 Collections.addAll(v, new String[] 189 { "nodeId", "propertyName", "value", }); 190 191 v = new Vector<String>(3); 192 parameterNames.put("setPropertyRulePropertyName", v); 193 Collections.addAll(v, new String[] 194 { "styleSheetId", "range", "propertyName", }); 195 196 v = new Vector<String>(3); 197 parameterNames.put("setKeyframeKey", v); 198 Collections.addAll(v, new String[] 199 { "styleSheetId", "range", "keyText", }); 200 201 v = new Vector<String>(3); 202 parameterNames.put("setMediaText", v); 203 Collections.addAll(v, new String[] 204 { "styleSheetId", "range", "text", }); 205 206 v = new Vector<String>(3); 207 parameterNames.put("setContainerQueryText", v); 208 Collections.addAll(v, new String[] 209 { "styleSheetId", "range", "text", }); 210 211 v = new Vector<String>(3); 212 parameterNames.put("setSupportsText", v); 213 Collections.addAll(v, new String[] 214 { "styleSheetId", "range", "text", }); 215 216 v = new Vector<String>(3); 217 parameterNames.put("setScopeText", v); 218 Collections.addAll(v, new String[] 219 { "styleSheetId", "range", "text", }); 220 221 v = new Vector<String>(3); 222 parameterNames.put("setRuleSelector", v); 223 Collections.addAll(v, new String[] 224 { "styleSheetId", "range", "selector", }); 225 226 v = new Vector<String>(2); 227 parameterNames.put("setStyleSheetText", v); 228 Collections.addAll(v, new String[] 229 { "styleSheetId", "text", }); 230 231 v = new Vector<String>(2); 232 parameterNames.put("setStyleTexts", v); 233 Collections.addAll(v, new String[] 234 { "edits", "nodeForPropertySyntaxValidation", }); 235 236 parameterNames.put("startRuleUsageTracking", EMPTY_VEC_STR); 237 238 parameterNames.put("stopRuleUsageTracking", EMPTY_VEC_STR); 239 240 parameterNames.put("takeCoverageDelta", EMPTY_VEC_STR); 241 242 v = new Vector<String>(1); 243 parameterNames.put("setLocalFontsEnabled", v); 244 Collections.addAll(v, new String[] 245 { "enabled", }); 246 } 247 248 249 // ******************************************************************************************** 250 // ******************************************************************************************** 251 // Types - Static Inner Classes 252 // ******************************************************************************************** 253 // ******************************************************************************************** 254 255 // public static class StyleSheetId => String 256 257 /** 258 * Stylesheet type: "injected" for stylesheets injected via extension, "user-agent" for user-agent 259 * stylesheets, "inspector" for stylesheets created by the inspector (i.e. those holding the "via 260 * inspector" rules), "regular" for regular stylesheets. 261 */ 262 public static final String[] StyleSheetOrigin = 263 { "injected", "user-agent", "inspector", "regular", }; 264 265 /** 266 * Enum indicating the type of a CSS rule, used to represent the order of a style rule's ancestors. 267 * This list only contains rule types that are collected during the ancestor rule collection. 268 * <BR /><B CLASS=Exp>EXPERIMENTAL</B> 269 */ 270 public static final String[] CSSRuleType = 271 { 272 "MediaRule", "SupportsRule", "ContainerRule", "LayerRule", "ScopeRule", "StyleRule", 273 "StartingStyleRule", 274 }; 275 276 /** CSS rule collection for a single pseudo style. */ 277 public static class PseudoElementMatches 278 extends BaseType 279 implements java.io.Serializable 280 { 281 /** For Object Serialization. java.io.Serializable */ 282 protected static final long serialVersionUID = 1; 283 284 public boolean[] optionals() 285 { return new boolean[] { false, true, false, }; } 286 287 /** Pseudo element type. */ 288 public final String pseudoType; 289 290 /** 291 * Pseudo element custom ident. 292 * <BR /><B CLASS=Opt>OPTIONAL</B> 293 */ 294 public final String pseudoIdentifier; 295 296 /** Matches of CSS rules applicable to the pseudo style. */ 297 public final CSS.RuleMatch[] matches; 298 299 /** 300 * Constructor 301 * 302 * @param pseudoType Pseudo element type. 303 * 304 * @param pseudoIdentifier Pseudo element custom ident. 305 * <BR /><B CLASS=Opt>OPTIONAL</B> 306 * 307 * @param matches Matches of CSS rules applicable to the pseudo style. 308 */ 309 public PseudoElementMatches 310 (String pseudoType, String pseudoIdentifier, CSS.RuleMatch[] matches) 311 { 312 // Exception-Check(s) to ensure that if any parameters which are not declared as 313 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 314 315 if (pseudoType == null) THROWS.throwNPE("pseudoType"); 316 if (matches == null) THROWS.throwNPE("matches"); 317 318 // Exception-Check(s) to ensure that if any parameters which must adhere to a 319 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 320 321 THROWS.checkIAE("pseudoType", pseudoType, "DOM.PseudoType", DOM.PseudoType); 322 323 this.pseudoType = pseudoType; 324 this.pseudoIdentifier = pseudoIdentifier; 325 this.matches = matches; 326 } 327 328 /** 329 * JSON Object Constructor 330 * @param jo A Json-Object having data about an instance of {@code 'PseudoElementMatches'}. 331 */ 332 public PseudoElementMatches (JsonObject jo) 333 { 334 this.pseudoType = ReadJSON.getString(jo, "pseudoType", false, true); 335 this.pseudoIdentifier = ReadJSON.getString(jo, "pseudoIdentifier", true, false); 336 this.matches = (jo.getJsonArray("matches") == null) 337 ? null 338 : RJArrIntoStream.objArr(jo.getJsonArray("matches"), null, 0, CSS.RuleMatch.class).toArray(CSS.RuleMatch[]::new); 339 340 } 341 342 343 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 344 public boolean equals(Object other) 345 { 346 if (this == other) return true; 347 if (other == null) return false; 348 if (other.getClass() != this.getClass()) return false; 349 350 PseudoElementMatches o = (PseudoElementMatches) other; 351 352 return 353 Objects.equals(this.pseudoType, o.pseudoType) 354 && Objects.equals(this.pseudoIdentifier, o.pseudoIdentifier) 355 && Arrays.deepEquals(this.matches, o.matches); 356 } 357 358 /** Generates a Hash-Code for {@code 'this'} instance */ 359 public int hashCode() 360 { 361 return 362 Objects.hashCode(this.pseudoType) 363 + Objects.hashCode(this.pseudoIdentifier) 364 + Arrays.deepHashCode(this.matches); 365 } 366 } 367 368 /** CSS style coming from animations with the name of the animation. */ 369 public static class CSSAnimationStyle 370 extends BaseType 371 implements java.io.Serializable 372 { 373 /** For Object Serialization. java.io.Serializable */ 374 protected static final long serialVersionUID = 1; 375 376 public boolean[] optionals() 377 { return new boolean[] { true, false, }; } 378 379 /** 380 * The name of the animation. 381 * <BR /><B CLASS=Opt>OPTIONAL</B> 382 */ 383 public final String name; 384 385 /** The style coming from the animation. */ 386 public final CSS.CSSStyle style; 387 388 /** 389 * Constructor 390 * 391 * @param name The name of the animation. 392 * <BR /><B CLASS=Opt>OPTIONAL</B> 393 * 394 * @param style The style coming from the animation. 395 */ 396 public CSSAnimationStyle(String name, CSS.CSSStyle style) 397 { 398 // Exception-Check(s) to ensure that if any parameters which are not declared as 399 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 400 401 if (style == null) THROWS.throwNPE("style"); 402 403 this.name = name; 404 this.style = style; 405 } 406 407 /** 408 * JSON Object Constructor 409 * @param jo A Json-Object having data about an instance of {@code 'CSSAnimationStyle'}. 410 */ 411 public CSSAnimationStyle (JsonObject jo) 412 { 413 this.name = ReadJSON.getString(jo, "name", true, false); 414 this.style = ReadJSON.getObject(jo, "style", CSS.CSSStyle.class, false, true); 415 } 416 417 418 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 419 public boolean equals(Object other) 420 { 421 if (this == other) return true; 422 if (other == null) return false; 423 if (other.getClass() != this.getClass()) return false; 424 425 CSSAnimationStyle o = (CSSAnimationStyle) other; 426 427 return 428 Objects.equals(this.name, o.name) 429 && Objects.equals(this.style, o.style); 430 } 431 432 /** Generates a Hash-Code for {@code 'this'} instance */ 433 public int hashCode() 434 { 435 return 436 Objects.hashCode(this.name) 437 + this.style.hashCode(); 438 } 439 } 440 441 /** Inherited CSS rule collection from ancestor node. */ 442 public static class InheritedStyleEntry 443 extends BaseType 444 implements java.io.Serializable 445 { 446 /** For Object Serialization. java.io.Serializable */ 447 protected static final long serialVersionUID = 1; 448 449 public boolean[] optionals() 450 { return new boolean[] { true, false, }; } 451 452 /** 453 * The ancestor node's inline style, if any, in the style inheritance chain. 454 * <BR /><B CLASS=Opt>OPTIONAL</B> 455 */ 456 public final CSS.CSSStyle inlineStyle; 457 458 /** Matches of CSS rules matching the ancestor node in the style inheritance chain. */ 459 public final CSS.RuleMatch[] matchedCSSRules; 460 461 /** 462 * Constructor 463 * 464 * @param inlineStyle The ancestor node's inline style, if any, in the style inheritance chain. 465 * <BR /><B CLASS=Opt>OPTIONAL</B> 466 * 467 * @param matchedCSSRules Matches of CSS rules matching the ancestor node in the style inheritance chain. 468 */ 469 public InheritedStyleEntry(CSS.CSSStyle inlineStyle, CSS.RuleMatch[] matchedCSSRules) 470 { 471 // Exception-Check(s) to ensure that if any parameters which are not declared as 472 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 473 474 if (matchedCSSRules == null) THROWS.throwNPE("matchedCSSRules"); 475 476 this.inlineStyle = inlineStyle; 477 this.matchedCSSRules = matchedCSSRules; 478 } 479 480 /** 481 * JSON Object Constructor 482 * @param jo A Json-Object having data about an instance of {@code 'InheritedStyleEntry'}. 483 */ 484 public InheritedStyleEntry (JsonObject jo) 485 { 486 this.inlineStyle = ReadJSON.getObject(jo, "inlineStyle", CSS.CSSStyle.class, true, false); 487 this.matchedCSSRules = (jo.getJsonArray("matchedCSSRules") == null) 488 ? null 489 : RJArrIntoStream.objArr(jo.getJsonArray("matchedCSSRules"), null, 0, CSS.RuleMatch.class).toArray(CSS.RuleMatch[]::new); 490 491 } 492 493 494 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 495 public boolean equals(Object other) 496 { 497 if (this == other) return true; 498 if (other == null) return false; 499 if (other.getClass() != this.getClass()) return false; 500 501 InheritedStyleEntry o = (InheritedStyleEntry) other; 502 503 return 504 Objects.equals(this.inlineStyle, o.inlineStyle) 505 && Arrays.deepEquals(this.matchedCSSRules, o.matchedCSSRules); 506 } 507 508 /** Generates a Hash-Code for {@code 'this'} instance */ 509 public int hashCode() 510 { 511 return 512 this.inlineStyle.hashCode() 513 + Arrays.deepHashCode(this.matchedCSSRules); 514 } 515 } 516 517 /** Inherited CSS style collection for animated styles from ancestor node. */ 518 public static class InheritedAnimatedStyleEntry 519 extends BaseType 520 implements java.io.Serializable 521 { 522 /** For Object Serialization. java.io.Serializable */ 523 protected static final long serialVersionUID = 1; 524 525 public boolean[] optionals() 526 { return new boolean[] { true, true, }; } 527 528 /** 529 * Styles coming from the animations of the ancestor, if any, in the style inheritance chain. 530 * <BR /><B CLASS=Opt>OPTIONAL</B> 531 */ 532 public final CSS.CSSAnimationStyle[] animationStyles; 533 534 /** 535 * The style coming from the transitions of the ancestor, if any, in the style inheritance chain. 536 * <BR /><B CLASS=Opt>OPTIONAL</B> 537 */ 538 public final CSS.CSSStyle transitionsStyle; 539 540 /** 541 * Constructor 542 * 543 * @param animationStyles Styles coming from the animations of the ancestor, if any, in the style inheritance chain. 544 * <BR /><B CLASS=Opt>OPTIONAL</B> 545 * 546 * @param transitionsStyle The style coming from the transitions of the ancestor, if any, in the style inheritance chain. 547 * <BR /><B CLASS=Opt>OPTIONAL</B> 548 */ 549 public InheritedAnimatedStyleEntry 550 (CSS.CSSAnimationStyle[] animationStyles, CSS.CSSStyle transitionsStyle) 551 { 552 this.animationStyles = animationStyles; 553 this.transitionsStyle = transitionsStyle; 554 } 555 556 /** 557 * JSON Object Constructor 558 * @param jo A Json-Object having data about an instance of {@code 'InheritedAnimatedStyleEntry'}. 559 */ 560 public InheritedAnimatedStyleEntry (JsonObject jo) 561 { 562 this.animationStyles = (jo.getJsonArray("animationStyles") == null) 563 ? null 564 : RJArrIntoStream.objArr(jo.getJsonArray("animationStyles"), null, 0, CSS.CSSAnimationStyle.class).toArray(CSS.CSSAnimationStyle[]::new); 565 566 this.transitionsStyle = ReadJSON.getObject(jo, "transitionsStyle", CSS.CSSStyle.class, true, false); 567 } 568 569 570 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 571 public boolean equals(Object other) 572 { 573 if (this == other) return true; 574 if (other == null) return false; 575 if (other.getClass() != this.getClass()) return false; 576 577 InheritedAnimatedStyleEntry o = (InheritedAnimatedStyleEntry) other; 578 579 return 580 Arrays.deepEquals(this.animationStyles, o.animationStyles) 581 && Objects.equals(this.transitionsStyle, o.transitionsStyle); 582 } 583 584 /** Generates a Hash-Code for {@code 'this'} instance */ 585 public int hashCode() 586 { 587 return 588 Arrays.deepHashCode(this.animationStyles) 589 + this.transitionsStyle.hashCode(); 590 } 591 } 592 593 /** Inherited pseudo element matches from pseudos of an ancestor node. */ 594 public static class InheritedPseudoElementMatches 595 extends BaseType 596 implements java.io.Serializable 597 { 598 /** For Object Serialization. java.io.Serializable */ 599 protected static final long serialVersionUID = 1; 600 601 public boolean[] optionals() 602 { return new boolean[] { false, }; } 603 604 /** Matches of pseudo styles from the pseudos of an ancestor node. */ 605 public final CSS.PseudoElementMatches[] pseudoElements; 606 607 /** 608 * Constructor 609 * 610 * @param pseudoElements Matches of pseudo styles from the pseudos of an ancestor node. 611 */ 612 public InheritedPseudoElementMatches(CSS.PseudoElementMatches[] pseudoElements) 613 { 614 // Exception-Check(s) to ensure that if any parameters which are not declared as 615 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 616 617 if (pseudoElements == null) THROWS.throwNPE("pseudoElements"); 618 619 this.pseudoElements = pseudoElements; 620 } 621 622 /** 623 * JSON Object Constructor 624 * @param jo A Json-Object having data about an instance of {@code 'InheritedPseudoElementMatches'}. 625 */ 626 public InheritedPseudoElementMatches (JsonObject jo) 627 { 628 this.pseudoElements = (jo.getJsonArray("pseudoElements") == null) 629 ? null 630 : RJArrIntoStream.objArr(jo.getJsonArray("pseudoElements"), null, 0, CSS.PseudoElementMatches.class).toArray(CSS.PseudoElementMatches[]::new); 631 632 } 633 634 635 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 636 public boolean equals(Object other) 637 { 638 if (this == other) return true; 639 if (other == null) return false; 640 if (other.getClass() != this.getClass()) return false; 641 642 InheritedPseudoElementMatches o = (InheritedPseudoElementMatches) other; 643 644 return 645 Arrays.deepEquals(this.pseudoElements, o.pseudoElements); 646 } 647 648 /** Generates a Hash-Code for {@code 'this'} instance */ 649 public int hashCode() 650 { 651 return 652 Arrays.deepHashCode(this.pseudoElements); 653 } 654 } 655 656 /** Match data for a CSS rule. */ 657 public static class RuleMatch 658 extends BaseType 659 implements java.io.Serializable 660 { 661 /** For Object Serialization. java.io.Serializable */ 662 protected static final long serialVersionUID = 1; 663 664 public boolean[] optionals() 665 { return new boolean[] { false, false, }; } 666 667 /** CSS rule in the match. */ 668 public final CSS.CSSRule rule; 669 670 /** Matching selector indices in the rule's selectorList selectors (0-based). */ 671 public final int[] matchingSelectors; 672 673 /** 674 * Constructor 675 * 676 * @param rule CSS rule in the match. 677 * 678 * @param matchingSelectors Matching selector indices in the rule's selectorList selectors (0-based). 679 */ 680 public RuleMatch(CSS.CSSRule rule, int[] matchingSelectors) 681 { 682 // Exception-Check(s) to ensure that if any parameters which are not declared as 683 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 684 685 if (rule == null) THROWS.throwNPE("rule"); 686 if (matchingSelectors == null) THROWS.throwNPE("matchingSelectors"); 687 688 this.rule = rule; 689 this.matchingSelectors = matchingSelectors; 690 } 691 692 /** 693 * JSON Object Constructor 694 * @param jo A Json-Object having data about an instance of {@code 'RuleMatch'}. 695 */ 696 public RuleMatch (JsonObject jo) 697 { 698 this.rule = ReadJSON.getObject(jo, "rule", CSS.CSSRule.class, false, true); 699 this.matchingSelectors = (jo.getJsonArray("matchingSelectors") == null) 700 ? null 701 : RJArrIntoPrimArray.intArr(jo.getJsonArray("matchingSelectors"), -1, 0, null); 702 703 } 704 705 706 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 707 public boolean equals(Object other) 708 { 709 if (this == other) return true; 710 if (other == null) return false; 711 if (other.getClass() != this.getClass()) return false; 712 713 RuleMatch o = (RuleMatch) other; 714 715 return 716 Objects.equals(this.rule, o.rule) 717 && Arrays.equals(this.matchingSelectors, o.matchingSelectors); 718 } 719 720 /** Generates a Hash-Code for {@code 'this'} instance */ 721 public int hashCode() 722 { 723 return 724 this.rule.hashCode() 725 + Arrays.hashCode(this.matchingSelectors); 726 } 727 } 728 729 /** Data for a simple selector (these are delimited by commas in a selector list). */ 730 public static class Value 731 extends BaseType 732 implements java.io.Serializable 733 { 734 /** For Object Serialization. java.io.Serializable */ 735 protected static final long serialVersionUID = 1; 736 737 public boolean[] optionals() 738 { return new boolean[] { false, true, true, }; } 739 740 /** Value text. */ 741 public final String text; 742 743 /** 744 * Value range in the underlying resource (if available). 745 * <BR /><B CLASS=Opt>OPTIONAL</B> 746 */ 747 public final CSS.SourceRange range; 748 749 /** 750 * Specificity of the selector. 751 * <BR /><B CLASS=Opt>OPTIONAL</B> 752 <B CLASS=Exp>EXPERIMENTAL</B> 753 */ 754 public final CSS.Specificity specificity; 755 756 /** 757 * Constructor 758 * 759 * @param text Value text. 760 * 761 * @param range Value range in the underlying resource (if available). 762 * <BR /><B CLASS=Opt>OPTIONAL</B> 763 * 764 * @param specificity Specificity of the selector. 765 * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B> 766 */ 767 public Value(String text, CSS.SourceRange range, CSS.Specificity specificity) 768 { 769 // Exception-Check(s) to ensure that if any parameters which are not declared as 770 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 771 772 if (text == null) THROWS.throwNPE("text"); 773 774 this.text = text; 775 this.range = range; 776 this.specificity = specificity; 777 } 778 779 /** 780 * JSON Object Constructor 781 * @param jo A Json-Object having data about an instance of {@code 'Value'}. 782 */ 783 public Value (JsonObject jo) 784 { 785 this.text = ReadJSON.getString(jo, "text", false, true); 786 this.range = ReadJSON.getObject(jo, "range", CSS.SourceRange.class, true, false); 787 this.specificity = ReadJSON.getObject(jo, "specificity", CSS.Specificity.class, true, false); 788 } 789 790 791 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 792 public boolean equals(Object other) 793 { 794 if (this == other) return true; 795 if (other == null) return false; 796 if (other.getClass() != this.getClass()) return false; 797 798 Value o = (Value) other; 799 800 return 801 Objects.equals(this.text, o.text) 802 && Objects.equals(this.range, o.range) 803 && Objects.equals(this.specificity, o.specificity); 804 } 805 806 /** Generates a Hash-Code for {@code 'this'} instance */ 807 public int hashCode() 808 { 809 return 810 Objects.hashCode(this.text) 811 + this.range.hashCode() 812 + this.specificity.hashCode(); 813 } 814 } 815 816 /** 817 * Specificity: 818 * https://drafts.csswg.org/selectors/#specificity-rules 819 * <BR /><B CLASS=Exp>EXPERIMENTAL</B> 820 */ 821 public static class Specificity 822 extends BaseType 823 implements java.io.Serializable 824 { 825 /** For Object Serialization. java.io.Serializable */ 826 protected static final long serialVersionUID = 1; 827 828 public boolean[] optionals() 829 { return new boolean[] { false, false, false, }; } 830 831 /** The a component, which represents the number of ID selectors. */ 832 public final int a; 833 834 /** 835 * The b component, which represents the number of class selectors, attributes selectors, and 836 * pseudo-classes. 837 */ 838 public final int b; 839 840 /** The c component, which represents the number of type selectors and pseudo-elements. */ 841 public final int c; 842 843 /** 844 * Constructor 845 * 846 * @param a The a component, which represents the number of ID selectors. 847 * 848 * @param b 849 * The b component, which represents the number of class selectors, attributes selectors, and 850 * pseudo-classes. 851 * 852 * @param c The c component, which represents the number of type selectors and pseudo-elements. 853 */ 854 public Specificity(int a, int b, int c) 855 { 856 this.a = a; 857 this.b = b; 858 this.c = c; 859 } 860 861 /** 862 * JSON Object Constructor 863 * @param jo A Json-Object having data about an instance of {@code 'Specificity'}. 864 */ 865 public Specificity (JsonObject jo) 866 { 867 this.a = ReadPrimJSON.getInt(jo, "a"); 868 this.b = ReadPrimJSON.getInt(jo, "b"); 869 this.c = ReadPrimJSON.getInt(jo, "c"); 870 } 871 872 873 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 874 public boolean equals(Object other) 875 { 876 if (this == other) return true; 877 if (other == null) return false; 878 if (other.getClass() != this.getClass()) return false; 879 880 Specificity o = (Specificity) other; 881 882 return 883 (this.a == o.a) 884 && (this.b == o.b) 885 && (this.c == o.c); 886 } 887 888 /** Generates a Hash-Code for {@code 'this'} instance */ 889 public int hashCode() 890 { 891 return 892 this.a 893 + this.b 894 + this.c; 895 } 896 } 897 898 /** Selector list data. */ 899 public static class SelectorList 900 extends BaseType 901 implements java.io.Serializable 902 { 903 /** For Object Serialization. java.io.Serializable */ 904 protected static final long serialVersionUID = 1; 905 906 public boolean[] optionals() 907 { return new boolean[] { false, false, }; } 908 909 /** Selectors in the list. */ 910 public final CSS.Value[] selectors; 911 912 /** Rule selector text. */ 913 public final String text; 914 915 /** 916 * Constructor 917 * 918 * @param selectors Selectors in the list. 919 * 920 * @param text Rule selector text. 921 */ 922 public SelectorList(CSS.Value[] selectors, String text) 923 { 924 // Exception-Check(s) to ensure that if any parameters which are not declared as 925 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 926 927 if (selectors == null) THROWS.throwNPE("selectors"); 928 if (text == null) THROWS.throwNPE("text"); 929 930 this.selectors = selectors; 931 this.text = text; 932 } 933 934 /** 935 * JSON Object Constructor 936 * @param jo A Json-Object having data about an instance of {@code 'SelectorList'}. 937 */ 938 public SelectorList (JsonObject jo) 939 { 940 this.selectors = (jo.getJsonArray("selectors") == null) 941 ? null 942 : RJArrIntoStream.objArr(jo.getJsonArray("selectors"), null, 0, CSS.Value.class).toArray(CSS.Value[]::new); 943 944 this.text = ReadJSON.getString(jo, "text", false, true); 945 } 946 947 948 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 949 public boolean equals(Object other) 950 { 951 if (this == other) return true; 952 if (other == null) return false; 953 if (other.getClass() != this.getClass()) return false; 954 955 SelectorList o = (SelectorList) other; 956 957 return 958 Arrays.deepEquals(this.selectors, o.selectors) 959 && Objects.equals(this.text, o.text); 960 } 961 962 /** Generates a Hash-Code for {@code 'this'} instance */ 963 public int hashCode() 964 { 965 return 966 Arrays.deepHashCode(this.selectors) 967 + Objects.hashCode(this.text); 968 } 969 } 970 971 /** CSS stylesheet metainformation. */ 972 public static class CSSStyleSheetHeader 973 extends BaseType 974 implements java.io.Serializable 975 { 976 /** For Object Serialization. java.io.Serializable */ 977 protected static final long serialVersionUID = 1; 978 979 public boolean[] optionals() 980 { return new boolean[] { false, false, false, true, false, false, true, false, true, false, false, false, false, false, false, false, false, true, }; } 981 982 /** The stylesheet identifier. */ 983 public final String styleSheetId; 984 985 /** Owner frame identifier. */ 986 public final String frameId; 987 988 /** 989 * Stylesheet resource URL. Empty if this is a constructed stylesheet created using 990 * new CSSStyleSheet() (but non-empty if this is a constructed stylesheet imported 991 * as a CSS module script). 992 */ 993 public final String sourceURL; 994 995 /** 996 * URL of source map associated with the stylesheet (if any). 997 * <BR /><B CLASS=Opt>OPTIONAL</B> 998 */ 999 public final String sourceMapURL; 1000 1001 /** Stylesheet origin. */ 1002 public final String origin; 1003 1004 /** Stylesheet title. */ 1005 public final String title; 1006 1007 /** 1008 * The backend id for the owner node of the stylesheet. 1009 * <BR /><B CLASS=Opt>OPTIONAL</B> 1010 */ 1011 public final Integer ownerNode; 1012 1013 /** Denotes whether the stylesheet is disabled. */ 1014 public final boolean disabled; 1015 1016 /** 1017 * Whether the sourceURL field value comes from the sourceURL comment. 1018 * <BR /><B CLASS=Opt>OPTIONAL</B> 1019 */ 1020 public final Boolean hasSourceURL; 1021 1022 /** 1023 * Whether this stylesheet is created for STYLE tag by parser. This flag is not set for 1024 * document.written STYLE tags. 1025 */ 1026 public final boolean isInline; 1027 1028 /** 1029 * Whether this stylesheet is mutable. Inline stylesheets become mutable 1030 * after they have been modified via CSSOM API. 1031 * {@code <link>} element's stylesheets become mutable only if DevTools modifies them. 1032 * Constructed stylesheets (new CSSStyleSheet()) are mutable immediately after creation. 1033 */ 1034 public final boolean isMutable; 1035 1036 /** 1037 * True if this stylesheet is created through new CSSStyleSheet() or imported as a 1038 * CSS module script. 1039 */ 1040 public final boolean isConstructed; 1041 1042 /** Line offset of the stylesheet within the resource (zero based). */ 1043 public final Number startLine; 1044 1045 /** Column offset of the stylesheet within the resource (zero based). */ 1046 public final Number startColumn; 1047 1048 /** Size of the content (in characters). */ 1049 public final Number length; 1050 1051 /** Line offset of the end of the stylesheet within the resource (zero based). */ 1052 public final Number endLine; 1053 1054 /** Column offset of the end of the stylesheet within the resource (zero based). */ 1055 public final Number endColumn; 1056 1057 /** 1058 * If the style sheet was loaded from a network resource, this indicates when the resource failed to load 1059 * <BR /><B CLASS=Opt>OPTIONAL</B> 1060 <B CLASS=Exp>EXPERIMENTAL</B> 1061 */ 1062 public final Boolean loadingFailed; 1063 1064 /** 1065 * Constructor 1066 * 1067 * @param styleSheetId The stylesheet identifier. 1068 * 1069 * @param frameId Owner frame identifier. 1070 * 1071 * @param sourceURL 1072 * Stylesheet resource URL. Empty if this is a constructed stylesheet created using 1073 * new CSSStyleSheet() (but non-empty if this is a constructed stylesheet imported 1074 * as a CSS module script). 1075 * 1076 * @param sourceMapURL URL of source map associated with the stylesheet (if any). 1077 * <BR /><B CLASS=Opt>OPTIONAL</B> 1078 * 1079 * @param origin Stylesheet origin. 1080 * 1081 * @param title Stylesheet title. 1082 * 1083 * @param ownerNode The backend id for the owner node of the stylesheet. 1084 * <BR /><B CLASS=Opt>OPTIONAL</B> 1085 * 1086 * @param disabled Denotes whether the stylesheet is disabled. 1087 * 1088 * @param hasSourceURL Whether the sourceURL field value comes from the sourceURL comment. 1089 * <BR /><B CLASS=Opt>OPTIONAL</B> 1090 * 1091 * @param isInline 1092 * Whether this stylesheet is created for STYLE tag by parser. This flag is not set for 1093 * document.written STYLE tags. 1094 * 1095 * @param isMutable 1096 * Whether this stylesheet is mutable. Inline stylesheets become mutable 1097 * after they have been modified via CSSOM API. 1098 * {@code <link>} element's stylesheets become mutable only if DevTools modifies them. 1099 * Constructed stylesheets (new CSSStyleSheet()) are mutable immediately after creation. 1100 * 1101 * @param isConstructed 1102 * True if this stylesheet is created through new CSSStyleSheet() or imported as a 1103 * CSS module script. 1104 * 1105 * @param startLine Line offset of the stylesheet within the resource (zero based). 1106 * 1107 * @param startColumn Column offset of the stylesheet within the resource (zero based). 1108 * 1109 * @param length Size of the content (in characters). 1110 * 1111 * @param endLine Line offset of the end of the stylesheet within the resource (zero based). 1112 * 1113 * @param endColumn Column offset of the end of the stylesheet within the resource (zero based). 1114 * 1115 * @param loadingFailed If the style sheet was loaded from a network resource, this indicates when the resource failed to load 1116 * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B> 1117 */ 1118 public CSSStyleSheetHeader( 1119 String styleSheetId, String frameId, String sourceURL, String sourceMapURL, 1120 String origin, String title, Integer ownerNode, boolean disabled, 1121 Boolean hasSourceURL, boolean isInline, boolean isMutable, boolean isConstructed, 1122 Number startLine, Number startColumn, Number length, Number endLine, 1123 Number endColumn, Boolean loadingFailed 1124 ) 1125 { 1126 // Exception-Check(s) to ensure that if any parameters which are not declared as 1127 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1128 1129 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 1130 if (frameId == null) THROWS.throwNPE("frameId"); 1131 if (sourceURL == null) THROWS.throwNPE("sourceURL"); 1132 if (origin == null) THROWS.throwNPE("origin"); 1133 if (title == null) THROWS.throwNPE("title"); 1134 if (startLine == null) THROWS.throwNPE("startLine"); 1135 if (startColumn == null) THROWS.throwNPE("startColumn"); 1136 if (length == null) THROWS.throwNPE("length"); 1137 if (endLine == null) THROWS.throwNPE("endLine"); 1138 if (endColumn == null) THROWS.throwNPE("endColumn"); 1139 1140 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1141 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1142 1143 THROWS.checkIAE("origin", origin, "CSS.StyleSheetOrigin", CSS.StyleSheetOrigin); 1144 1145 this.styleSheetId = styleSheetId; 1146 this.frameId = frameId; 1147 this.sourceURL = sourceURL; 1148 this.sourceMapURL = sourceMapURL; 1149 this.origin = origin; 1150 this.title = title; 1151 this.ownerNode = ownerNode; 1152 this.disabled = disabled; 1153 this.hasSourceURL = hasSourceURL; 1154 this.isInline = isInline; 1155 this.isMutable = isMutable; 1156 this.isConstructed = isConstructed; 1157 this.startLine = startLine; 1158 this.startColumn = startColumn; 1159 this.length = length; 1160 this.endLine = endLine; 1161 this.endColumn = endColumn; 1162 this.loadingFailed = loadingFailed; 1163 } 1164 1165 /** 1166 * JSON Object Constructor 1167 * @param jo A Json-Object having data about an instance of {@code 'CSSStyleSheetHeader'}. 1168 */ 1169 public CSSStyleSheetHeader (JsonObject jo) 1170 { 1171 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", false, true); 1172 this.frameId = ReadJSON.getString(jo, "frameId", false, true); 1173 this.sourceURL = ReadJSON.getString(jo, "sourceURL", false, true); 1174 this.sourceMapURL = ReadJSON.getString(jo, "sourceMapURL", true, false); 1175 this.origin = ReadJSON.getString(jo, "origin", false, true); 1176 this.title = ReadJSON.getString(jo, "title", false, true); 1177 this.ownerNode = ReadBoxedJSON.getInteger(jo, "ownerNode", true); 1178 this.disabled = ReadPrimJSON.getBoolean(jo, "disabled"); 1179 this.hasSourceURL = ReadBoxedJSON.getBoolean(jo, "hasSourceURL", true); 1180 this.isInline = ReadPrimJSON.getBoolean(jo, "isInline"); 1181 this.isMutable = ReadPrimJSON.getBoolean(jo, "isMutable"); 1182 this.isConstructed = ReadPrimJSON.getBoolean(jo, "isConstructed"); 1183 this.startLine = ReadNumberJSON.get(jo, "startLine", false, true); 1184 this.startColumn = ReadNumberJSON.get(jo, "startColumn", false, true); 1185 this.length = ReadNumberJSON.get(jo, "length", false, true); 1186 this.endLine = ReadNumberJSON.get(jo, "endLine", false, true); 1187 this.endColumn = ReadNumberJSON.get(jo, "endColumn", false, true); 1188 this.loadingFailed = ReadBoxedJSON.getBoolean(jo, "loadingFailed", true); 1189 } 1190 1191 1192 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1193 public boolean equals(Object other) 1194 { 1195 if (this == other) return true; 1196 if (other == null) return false; 1197 if (other.getClass() != this.getClass()) return false; 1198 1199 CSSStyleSheetHeader o = (CSSStyleSheetHeader) other; 1200 1201 return 1202 Objects.equals(this.styleSheetId, o.styleSheetId) 1203 && Objects.equals(this.frameId, o.frameId) 1204 && Objects.equals(this.sourceURL, o.sourceURL) 1205 && Objects.equals(this.sourceMapURL, o.sourceMapURL) 1206 && Objects.equals(this.origin, o.origin) 1207 && Objects.equals(this.title, o.title) 1208 && Objects.equals(this.ownerNode, o.ownerNode) 1209 && (this.disabled == o.disabled) 1210 && Objects.equals(this.hasSourceURL, o.hasSourceURL) 1211 && (this.isInline == o.isInline) 1212 && (this.isMutable == o.isMutable) 1213 && (this.isConstructed == o.isConstructed) 1214 && Objects.equals(this.startLine, o.startLine) 1215 && Objects.equals(this.startColumn, o.startColumn) 1216 && Objects.equals(this.length, o.length) 1217 && Objects.equals(this.endLine, o.endLine) 1218 && Objects.equals(this.endColumn, o.endColumn) 1219 && Objects.equals(this.loadingFailed, o.loadingFailed); 1220 } 1221 1222 /** Generates a Hash-Code for {@code 'this'} instance */ 1223 public int hashCode() 1224 { 1225 return 1226 Objects.hashCode(this.styleSheetId) 1227 + Objects.hashCode(this.frameId) 1228 + Objects.hashCode(this.sourceURL) 1229 + Objects.hashCode(this.sourceMapURL) 1230 + Objects.hashCode(this.origin) 1231 + Objects.hashCode(this.title) 1232 + Objects.hashCode(this.ownerNode) 1233 + (this.disabled ? 1 : 0) 1234 + Objects.hashCode(this.hasSourceURL) 1235 + (this.isInline ? 1 : 0) 1236 + (this.isMutable ? 1 : 0) 1237 + (this.isConstructed ? 1 : 0) 1238 + Objects.hashCode(this.startLine) 1239 + Objects.hashCode(this.startColumn) 1240 + Objects.hashCode(this.length) 1241 + Objects.hashCode(this.endLine) 1242 + Objects.hashCode(this.endColumn) 1243 + Objects.hashCode(this.loadingFailed); 1244 } 1245 } 1246 1247 /** CSS rule representation. */ 1248 public static class CSSRule 1249 extends BaseType 1250 implements java.io.Serializable 1251 { 1252 /** For Object Serialization. java.io.Serializable */ 1253 protected static final long serialVersionUID = 1; 1254 1255 public boolean[] optionals() 1256 { return new boolean[] { true, false, true, false, false, true, true, true, true, true, true, true, }; } 1257 1258 /** 1259 * The css style sheet identifier (absent for user agent stylesheet and user-specified 1260 * stylesheet rules) this rule came from. 1261 * <BR /><B CLASS=Opt>OPTIONAL</B> 1262 */ 1263 public final String styleSheetId; 1264 1265 /** Rule selector data. */ 1266 public final CSS.SelectorList selectorList; 1267 1268 /** 1269 * Array of selectors from ancestor style rules, sorted by distance from the current rule. 1270 * <BR /><B CLASS=Opt>OPTIONAL</B> 1271 <B CLASS=Exp>EXPERIMENTAL</B> 1272 */ 1273 public final String[] nestingSelectors; 1274 1275 /** Parent stylesheet's origin. */ 1276 public final String origin; 1277 1278 /** Associated style declaration. */ 1279 public final CSS.CSSStyle style; 1280 1281 /** 1282 * Media list array (for rules involving media queries). The array enumerates media queries 1283 * starting with the innermost one, going outwards. 1284 * <BR /><B CLASS=Opt>OPTIONAL</B> 1285 */ 1286 public final CSS.CSSMedia[] media; 1287 1288 /** 1289 * Container query list array (for rules involving container queries). 1290 * The array enumerates container queries starting with the innermost one, going outwards. 1291 * <BR /><B CLASS=Opt>OPTIONAL</B> 1292 <B CLASS=Exp>EXPERIMENTAL</B> 1293 */ 1294 public final CSS.CSSContainerQuery[] containerQueries; 1295 1296 /** 1297 * @supports CSS at-rule array. 1298 * The array enumerates @supports at-rules starting with the innermost one, going outwards. 1299 * <BR /><B CLASS=Opt>OPTIONAL</B> 1300 <B CLASS=Exp>EXPERIMENTAL</B> 1301 */ 1302 public final CSS.CSSSupports[] supports; 1303 1304 /** 1305 * Cascade layer array. Contains the layer hierarchy that this rule belongs to starting 1306 * with the innermost layer and going outwards. 1307 * <BR /><B CLASS=Opt>OPTIONAL</B> 1308 <B CLASS=Exp>EXPERIMENTAL</B> 1309 */ 1310 public final CSS.CSSLayer[] layers; 1311 1312 /** 1313 * @scope CSS at-rule array. 1314 * The array enumerates @scope at-rules starting with the innermost one, going outwards. 1315 * <BR /><B CLASS=Opt>OPTIONAL</B> 1316 <B CLASS=Exp>EXPERIMENTAL</B> 1317 */ 1318 public final CSS.CSSScope[] scopes; 1319 1320 /** 1321 * The array keeps the types of ancestor CSSRules from the innermost going outwards. 1322 * <BR /><B CLASS=Opt>OPTIONAL</B> 1323 <B CLASS=Exp>EXPERIMENTAL</B> 1324 */ 1325 public final String[] ruleTypes; 1326 1327 /** 1328 * @starting-style CSS at-rule array. 1329 * The array enumerates @starting-style at-rules starting with the innermost one, going outwards. 1330 * <BR /><B CLASS=Opt>OPTIONAL</B> 1331 <B CLASS=Exp>EXPERIMENTAL</B> 1332 */ 1333 public final CSS.CSSStartingStyle[] startingStyles; 1334 1335 /** 1336 * Constructor 1337 * 1338 * @param styleSheetId 1339 * The css style sheet identifier (absent for user agent stylesheet and user-specified 1340 * stylesheet rules) this rule came from. 1341 * <BR /><B CLASS=Opt>OPTIONAL</B> 1342 * 1343 * @param selectorList Rule selector data. 1344 * 1345 * @param nestingSelectors Array of selectors from ancestor style rules, sorted by distance from the current rule. 1346 * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B> 1347 * 1348 * @param origin Parent stylesheet's origin. 1349 * 1350 * @param style Associated style declaration. 1351 * 1352 * @param media 1353 * Media list array (for rules involving media queries). The array enumerates media queries 1354 * starting with the innermost one, going outwards. 1355 * <BR /><B CLASS=Opt>OPTIONAL</B> 1356 * 1357 * @param containerQueries 1358 * Container query list array (for rules involving container queries). 1359 * The array enumerates container queries starting with the innermost one, going outwards. 1360 * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B> 1361 * 1362 * @param supports 1363 * @supports CSS at-rule array. 1364 * The array enumerates @supports at-rules starting with the innermost one, going outwards. 1365 * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B> 1366 * 1367 * @param layers 1368 * Cascade layer array. Contains the layer hierarchy that this rule belongs to starting 1369 * with the innermost layer and going outwards. 1370 * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B> 1371 * 1372 * @param scopes 1373 * @scope CSS at-rule array. 1374 * The array enumerates @scope at-rules starting with the innermost one, going outwards. 1375 * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B> 1376 * 1377 * @param ruleTypes The array keeps the types of ancestor CSSRules from the innermost going outwards. 1378 * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B> 1379 * 1380 * @param startingStyles 1381 * @starting-style CSS at-rule array. 1382 * The array enumerates @starting-style at-rules starting with the innermost one, going outwards. 1383 * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B> 1384 */ 1385 public CSSRule( 1386 String styleSheetId, CSS.SelectorList selectorList, String[] nestingSelectors, 1387 String origin, CSS.CSSStyle style, CSS.CSSMedia[] media, 1388 CSS.CSSContainerQuery[] containerQueries, CSS.CSSSupports[] supports, 1389 CSS.CSSLayer[] layers, CSS.CSSScope[] scopes, String[] ruleTypes, 1390 CSS.CSSStartingStyle[] startingStyles 1391 ) 1392 { 1393 // Exception-Check(s) to ensure that if any parameters which are not declared as 1394 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1395 1396 if (selectorList == null) THROWS.throwNPE("selectorList"); 1397 if (origin == null) THROWS.throwNPE("origin"); 1398 if (style == null) THROWS.throwNPE("style"); 1399 1400 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1401 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1402 1403 THROWS.checkIAE("origin", origin, "CSS.StyleSheetOrigin", CSS.StyleSheetOrigin); 1404 1405 this.styleSheetId = styleSheetId; 1406 this.selectorList = selectorList; 1407 this.nestingSelectors = nestingSelectors; 1408 this.origin = origin; 1409 this.style = style; 1410 this.media = media; 1411 this.containerQueries = containerQueries; 1412 this.supports = supports; 1413 this.layers = layers; 1414 this.scopes = scopes; 1415 this.ruleTypes = ruleTypes; 1416 this.startingStyles = startingStyles; 1417 } 1418 1419 /** 1420 * JSON Object Constructor 1421 * @param jo A Json-Object having data about an instance of {@code 'CSSRule'}. 1422 */ 1423 public CSSRule (JsonObject jo) 1424 { 1425 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", true, false); 1426 this.selectorList = ReadJSON.getObject(jo, "selectorList", CSS.SelectorList.class, false, true); 1427 this.nestingSelectors = (jo.getJsonArray("nestingSelectors") == null) 1428 ? null 1429 : RJArrIntoStream.strArr(jo.getJsonArray("nestingSelectors"), null, 0).toArray(String[]::new); 1430 1431 this.origin = ReadJSON.getString(jo, "origin", false, true); 1432 this.style = ReadJSON.getObject(jo, "style", CSS.CSSStyle.class, false, true); 1433 this.media = (jo.getJsonArray("media") == null) 1434 ? null 1435 : RJArrIntoStream.objArr(jo.getJsonArray("media"), null, 0, CSS.CSSMedia.class).toArray(CSS.CSSMedia[]::new); 1436 1437 this.containerQueries = (jo.getJsonArray("containerQueries") == null) 1438 ? null 1439 : RJArrIntoStream.objArr(jo.getJsonArray("containerQueries"), null, 0, CSS.CSSContainerQuery.class).toArray(CSS.CSSContainerQuery[]::new); 1440 1441 this.supports = (jo.getJsonArray("supports") == null) 1442 ? null 1443 : RJArrIntoStream.objArr(jo.getJsonArray("supports"), null, 0, CSS.CSSSupports.class).toArray(CSS.CSSSupports[]::new); 1444 1445 this.layers = (jo.getJsonArray("layers") == null) 1446 ? null 1447 : RJArrIntoStream.objArr(jo.getJsonArray("layers"), null, 0, CSS.CSSLayer.class).toArray(CSS.CSSLayer[]::new); 1448 1449 this.scopes = (jo.getJsonArray("scopes") == null) 1450 ? null 1451 : RJArrIntoStream.objArr(jo.getJsonArray("scopes"), null, 0, CSS.CSSScope.class).toArray(CSS.CSSScope[]::new); 1452 1453 this.ruleTypes = (jo.getJsonArray("ruleTypes") == null) 1454 ? null 1455 : RJArrIntoStream.strArr(jo.getJsonArray("ruleTypes"), null, 0).toArray(String[]::new); 1456 1457 this.startingStyles = (jo.getJsonArray("startingStyles") == null) 1458 ? null 1459 : RJArrIntoStream.objArr(jo.getJsonArray("startingStyles"), null, 0, CSS.CSSStartingStyle.class).toArray(CSS.CSSStartingStyle[]::new); 1460 1461 } 1462 1463 1464 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1465 public boolean equals(Object other) 1466 { 1467 if (this == other) return true; 1468 if (other == null) return false; 1469 if (other.getClass() != this.getClass()) return false; 1470 1471 CSSRule o = (CSSRule) other; 1472 1473 return 1474 Objects.equals(this.styleSheetId, o.styleSheetId) 1475 && Objects.equals(this.selectorList, o.selectorList) 1476 && Arrays.deepEquals(this.nestingSelectors, o.nestingSelectors) 1477 && Objects.equals(this.origin, o.origin) 1478 && Objects.equals(this.style, o.style) 1479 && Arrays.deepEquals(this.media, o.media) 1480 && Arrays.deepEquals(this.containerQueries, o.containerQueries) 1481 && Arrays.deepEquals(this.supports, o.supports) 1482 && Arrays.deepEquals(this.layers, o.layers) 1483 && Arrays.deepEquals(this.scopes, o.scopes) 1484 && Arrays.deepEquals(this.ruleTypes, o.ruleTypes) 1485 && Arrays.deepEquals(this.startingStyles, o.startingStyles); 1486 } 1487 1488 /** Generates a Hash-Code for {@code 'this'} instance */ 1489 public int hashCode() 1490 { 1491 return 1492 Objects.hashCode(this.styleSheetId) 1493 + this.selectorList.hashCode() 1494 + Arrays.deepHashCode(this.nestingSelectors) 1495 + Objects.hashCode(this.origin) 1496 + this.style.hashCode() 1497 + Arrays.deepHashCode(this.media) 1498 + Arrays.deepHashCode(this.containerQueries) 1499 + Arrays.deepHashCode(this.supports) 1500 + Arrays.deepHashCode(this.layers) 1501 + Arrays.deepHashCode(this.scopes) 1502 + Arrays.deepHashCode(this.ruleTypes) 1503 + Arrays.deepHashCode(this.startingStyles); 1504 } 1505 } 1506 1507 /** CSS coverage information. */ 1508 public static class RuleUsage 1509 extends BaseType 1510 implements java.io.Serializable 1511 { 1512 /** For Object Serialization. java.io.Serializable */ 1513 protected static final long serialVersionUID = 1; 1514 1515 public boolean[] optionals() 1516 { return new boolean[] { false, false, false, false, }; } 1517 1518 /** 1519 * The css style sheet identifier (absent for user agent stylesheet and user-specified 1520 * stylesheet rules) this rule came from. 1521 */ 1522 public final String styleSheetId; 1523 1524 /** Offset of the start of the rule (including selector) from the beginning of the stylesheet. */ 1525 public final Number startOffset; 1526 1527 /** Offset of the end of the rule body from the beginning of the stylesheet. */ 1528 public final Number endOffset; 1529 1530 /** Indicates whether the rule was actually used by some element in the page. */ 1531 public final boolean used; 1532 1533 /** 1534 * Constructor 1535 * 1536 * @param styleSheetId 1537 * The css style sheet identifier (absent for user agent stylesheet and user-specified 1538 * stylesheet rules) this rule came from. 1539 * 1540 * @param startOffset Offset of the start of the rule (including selector) from the beginning of the stylesheet. 1541 * 1542 * @param endOffset Offset of the end of the rule body from the beginning of the stylesheet. 1543 * 1544 * @param used Indicates whether the rule was actually used by some element in the page. 1545 */ 1546 public RuleUsage 1547 (String styleSheetId, Number startOffset, Number endOffset, boolean used) 1548 { 1549 // Exception-Check(s) to ensure that if any parameters which are not declared as 1550 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1551 1552 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 1553 if (startOffset == null) THROWS.throwNPE("startOffset"); 1554 if (endOffset == null) THROWS.throwNPE("endOffset"); 1555 1556 this.styleSheetId = styleSheetId; 1557 this.startOffset = startOffset; 1558 this.endOffset = endOffset; 1559 this.used = used; 1560 } 1561 1562 /** 1563 * JSON Object Constructor 1564 * @param jo A Json-Object having data about an instance of {@code 'RuleUsage'}. 1565 */ 1566 public RuleUsage (JsonObject jo) 1567 { 1568 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", false, true); 1569 this.startOffset = ReadNumberJSON.get(jo, "startOffset", false, true); 1570 this.endOffset = ReadNumberJSON.get(jo, "endOffset", false, true); 1571 this.used = ReadPrimJSON.getBoolean(jo, "used"); 1572 } 1573 1574 1575 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1576 public boolean equals(Object other) 1577 { 1578 if (this == other) return true; 1579 if (other == null) return false; 1580 if (other.getClass() != this.getClass()) return false; 1581 1582 RuleUsage o = (RuleUsage) other; 1583 1584 return 1585 Objects.equals(this.styleSheetId, o.styleSheetId) 1586 && Objects.equals(this.startOffset, o.startOffset) 1587 && Objects.equals(this.endOffset, o.endOffset) 1588 && (this.used == o.used); 1589 } 1590 1591 /** Generates a Hash-Code for {@code 'this'} instance */ 1592 public int hashCode() 1593 { 1594 return 1595 Objects.hashCode(this.styleSheetId) 1596 + Objects.hashCode(this.startOffset) 1597 + Objects.hashCode(this.endOffset) 1598 + (this.used ? 1 : 0); 1599 } 1600 } 1601 1602 /** Text range within a resource. All numbers are zero-based. */ 1603 public static class SourceRange 1604 extends BaseType 1605 implements java.io.Serializable 1606 { 1607 /** For Object Serialization. java.io.Serializable */ 1608 protected static final long serialVersionUID = 1; 1609 1610 public boolean[] optionals() 1611 { return new boolean[] { false, false, false, false, }; } 1612 1613 /** Start line of range. */ 1614 public final int startLine; 1615 1616 /** Start column of range (inclusive). */ 1617 public final int startColumn; 1618 1619 /** End line of range */ 1620 public final int endLine; 1621 1622 /** End column of range (exclusive). */ 1623 public final int endColumn; 1624 1625 /** 1626 * Constructor 1627 * 1628 * @param startLine Start line of range. 1629 * 1630 * @param startColumn Start column of range (inclusive). 1631 * 1632 * @param endLine End line of range 1633 * 1634 * @param endColumn End column of range (exclusive). 1635 */ 1636 public SourceRange(int startLine, int startColumn, int endLine, int endColumn) 1637 { 1638 this.startLine = startLine; 1639 this.startColumn = startColumn; 1640 this.endLine = endLine; 1641 this.endColumn = endColumn; 1642 } 1643 1644 /** 1645 * JSON Object Constructor 1646 * @param jo A Json-Object having data about an instance of {@code 'SourceRange'}. 1647 */ 1648 public SourceRange (JsonObject jo) 1649 { 1650 this.startLine = ReadPrimJSON.getInt(jo, "startLine"); 1651 this.startColumn = ReadPrimJSON.getInt(jo, "startColumn"); 1652 this.endLine = ReadPrimJSON.getInt(jo, "endLine"); 1653 this.endColumn = ReadPrimJSON.getInt(jo, "endColumn"); 1654 } 1655 1656 1657 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1658 public boolean equals(Object other) 1659 { 1660 if (this == other) return true; 1661 if (other == null) return false; 1662 if (other.getClass() != this.getClass()) return false; 1663 1664 SourceRange o = (SourceRange) other; 1665 1666 return 1667 (this.startLine == o.startLine) 1668 && (this.startColumn == o.startColumn) 1669 && (this.endLine == o.endLine) 1670 && (this.endColumn == o.endColumn); 1671 } 1672 1673 /** Generates a Hash-Code for {@code 'this'} instance */ 1674 public int hashCode() 1675 { 1676 return 1677 this.startLine 1678 + this.startColumn 1679 + this.endLine 1680 + this.endColumn; 1681 } 1682 } 1683 1684 /** <CODE>[No Description Provided by Google]</CODE> */ 1685 public static class ShorthandEntry 1686 extends BaseType 1687 implements java.io.Serializable 1688 { 1689 /** For Object Serialization. java.io.Serializable */ 1690 protected static final long serialVersionUID = 1; 1691 1692 public boolean[] optionals() 1693 { return new boolean[] { false, false, true, }; } 1694 1695 /** Shorthand name. */ 1696 public final String name; 1697 1698 /** Shorthand value. */ 1699 public final String value; 1700 1701 /** 1702 * Whether the property has "!important" annotation (implies {@code false} if absent). 1703 * <BR /><B CLASS=Opt>OPTIONAL</B> 1704 */ 1705 public final Boolean important; 1706 1707 /** 1708 * Constructor 1709 * 1710 * @param name Shorthand name. 1711 * 1712 * @param value Shorthand value. 1713 * 1714 * @param important Whether the property has "!important" annotation (implies {@code false} if absent). 1715 * <BR /><B CLASS=Opt>OPTIONAL</B> 1716 */ 1717 public ShorthandEntry(String name, String value, Boolean important) 1718 { 1719 // Exception-Check(s) to ensure that if any parameters which are not declared as 1720 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1721 1722 if (name == null) THROWS.throwNPE("name"); 1723 if (value == null) THROWS.throwNPE("value"); 1724 1725 this.name = name; 1726 this.value = value; 1727 this.important = important; 1728 } 1729 1730 /** 1731 * JSON Object Constructor 1732 * @param jo A Json-Object having data about an instance of {@code 'ShorthandEntry'}. 1733 */ 1734 public ShorthandEntry (JsonObject jo) 1735 { 1736 this.name = ReadJSON.getString(jo, "name", false, true); 1737 this.value = ReadJSON.getString(jo, "value", false, true); 1738 this.important = ReadBoxedJSON.getBoolean(jo, "important", true); 1739 } 1740 1741 1742 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1743 public boolean equals(Object other) 1744 { 1745 if (this == other) return true; 1746 if (other == null) return false; 1747 if (other.getClass() != this.getClass()) return false; 1748 1749 ShorthandEntry o = (ShorthandEntry) other; 1750 1751 return 1752 Objects.equals(this.name, o.name) 1753 && Objects.equals(this.value, o.value) 1754 && Objects.equals(this.important, o.important); 1755 } 1756 1757 /** Generates a Hash-Code for {@code 'this'} instance */ 1758 public int hashCode() 1759 { 1760 return 1761 Objects.hashCode(this.name) 1762 + Objects.hashCode(this.value) 1763 + Objects.hashCode(this.important); 1764 } 1765 } 1766 1767 /** <CODE>[No Description Provided by Google]</CODE> */ 1768 public static class CSSComputedStyleProperty 1769 extends BaseType 1770 implements java.io.Serializable 1771 { 1772 /** For Object Serialization. java.io.Serializable */ 1773 protected static final long serialVersionUID = 1; 1774 1775 public boolean[] optionals() 1776 { return new boolean[] { false, false, }; } 1777 1778 /** Computed style property name. */ 1779 public final String name; 1780 1781 /** Computed style property value. */ 1782 public final String value; 1783 1784 /** 1785 * Constructor 1786 * 1787 * @param name Computed style property name. 1788 * 1789 * @param value Computed style property value. 1790 */ 1791 public CSSComputedStyleProperty(String name, String value) 1792 { 1793 // Exception-Check(s) to ensure that if any parameters which are not declared as 1794 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1795 1796 if (name == null) THROWS.throwNPE("name"); 1797 if (value == null) THROWS.throwNPE("value"); 1798 1799 this.name = name; 1800 this.value = value; 1801 } 1802 1803 /** 1804 * JSON Object Constructor 1805 * @param jo A Json-Object having data about an instance of {@code 'CSSComputedStyleProperty'}. 1806 */ 1807 public CSSComputedStyleProperty (JsonObject jo) 1808 { 1809 this.name = ReadJSON.getString(jo, "name", false, true); 1810 this.value = ReadJSON.getString(jo, "value", false, true); 1811 } 1812 1813 1814 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1815 public boolean equals(Object other) 1816 { 1817 if (this == other) return true; 1818 if (other == null) return false; 1819 if (other.getClass() != this.getClass()) return false; 1820 1821 CSSComputedStyleProperty o = (CSSComputedStyleProperty) other; 1822 1823 return 1824 Objects.equals(this.name, o.name) 1825 && Objects.equals(this.value, o.value); 1826 } 1827 1828 /** Generates a Hash-Code for {@code 'this'} instance */ 1829 public int hashCode() 1830 { 1831 return 1832 Objects.hashCode(this.name) 1833 + Objects.hashCode(this.value); 1834 } 1835 } 1836 1837 /** CSS style representation. */ 1838 public static class CSSStyle 1839 extends BaseType 1840 implements java.io.Serializable 1841 { 1842 /** For Object Serialization. java.io.Serializable */ 1843 protected static final long serialVersionUID = 1; 1844 1845 public boolean[] optionals() 1846 { return new boolean[] { true, false, false, true, true, }; } 1847 1848 /** 1849 * The css style sheet identifier (absent for user agent stylesheet and user-specified 1850 * stylesheet rules) this rule came from. 1851 * <BR /><B CLASS=Opt>OPTIONAL</B> 1852 */ 1853 public final String styleSheetId; 1854 1855 /** CSS properties in the style. */ 1856 public final CSS.CSSProperty[] cssProperties; 1857 1858 /** Computed values for all shorthands found in the style. */ 1859 public final CSS.ShorthandEntry[] shorthandEntries; 1860 1861 /** 1862 * Style declaration text (if available). 1863 * <BR /><B CLASS=Opt>OPTIONAL</B> 1864 */ 1865 public final String cssText; 1866 1867 /** 1868 * Style declaration range in the enclosing stylesheet (if available). 1869 * <BR /><B CLASS=Opt>OPTIONAL</B> 1870 */ 1871 public final CSS.SourceRange range; 1872 1873 /** 1874 * Constructor 1875 * 1876 * @param styleSheetId 1877 * The css style sheet identifier (absent for user agent stylesheet and user-specified 1878 * stylesheet rules) this rule came from. 1879 * <BR /><B CLASS=Opt>OPTIONAL</B> 1880 * 1881 * @param cssProperties CSS properties in the style. 1882 * 1883 * @param shorthandEntries Computed values for all shorthands found in the style. 1884 * 1885 * @param cssText Style declaration text (if available). 1886 * <BR /><B CLASS=Opt>OPTIONAL</B> 1887 * 1888 * @param range Style declaration range in the enclosing stylesheet (if available). 1889 * <BR /><B CLASS=Opt>OPTIONAL</B> 1890 */ 1891 public CSSStyle( 1892 String styleSheetId, CSS.CSSProperty[] cssProperties, 1893 CSS.ShorthandEntry[] shorthandEntries, String cssText, CSS.SourceRange range 1894 ) 1895 { 1896 // Exception-Check(s) to ensure that if any parameters which are not declared as 1897 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1898 1899 if (cssProperties == null) THROWS.throwNPE("cssProperties"); 1900 if (shorthandEntries == null) THROWS.throwNPE("shorthandEntries"); 1901 1902 this.styleSheetId = styleSheetId; 1903 this.cssProperties = cssProperties; 1904 this.shorthandEntries = shorthandEntries; 1905 this.cssText = cssText; 1906 this.range = range; 1907 } 1908 1909 /** 1910 * JSON Object Constructor 1911 * @param jo A Json-Object having data about an instance of {@code 'CSSStyle'}. 1912 */ 1913 public CSSStyle (JsonObject jo) 1914 { 1915 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", true, false); 1916 this.cssProperties = (jo.getJsonArray("cssProperties") == null) 1917 ? null 1918 : RJArrIntoStream.objArr(jo.getJsonArray("cssProperties"), null, 0, CSS.CSSProperty.class).toArray(CSS.CSSProperty[]::new); 1919 1920 this.shorthandEntries = (jo.getJsonArray("shorthandEntries") == null) 1921 ? null 1922 : RJArrIntoStream.objArr(jo.getJsonArray("shorthandEntries"), null, 0, CSS.ShorthandEntry.class).toArray(CSS.ShorthandEntry[]::new); 1923 1924 this.cssText = ReadJSON.getString(jo, "cssText", true, false); 1925 this.range = ReadJSON.getObject(jo, "range", CSS.SourceRange.class, true, false); 1926 } 1927 1928 1929 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1930 public boolean equals(Object other) 1931 { 1932 if (this == other) return true; 1933 if (other == null) return false; 1934 if (other.getClass() != this.getClass()) return false; 1935 1936 CSSStyle o = (CSSStyle) other; 1937 1938 return 1939 Objects.equals(this.styleSheetId, o.styleSheetId) 1940 && Arrays.deepEquals(this.cssProperties, o.cssProperties) 1941 && Arrays.deepEquals(this.shorthandEntries, o.shorthandEntries) 1942 && Objects.equals(this.cssText, o.cssText) 1943 && Objects.equals(this.range, o.range); 1944 } 1945 1946 /** Generates a Hash-Code for {@code 'this'} instance */ 1947 public int hashCode() 1948 { 1949 return 1950 Objects.hashCode(this.styleSheetId) 1951 + Arrays.deepHashCode(this.cssProperties) 1952 + Arrays.deepHashCode(this.shorthandEntries) 1953 + Objects.hashCode(this.cssText) 1954 + this.range.hashCode(); 1955 } 1956 } 1957 1958 /** CSS property declaration data. */ 1959 public static class CSSProperty 1960 extends BaseType 1961 implements java.io.Serializable 1962 { 1963 /** For Object Serialization. java.io.Serializable */ 1964 protected static final long serialVersionUID = 1; 1965 1966 public boolean[] optionals() 1967 { return new boolean[] { false, false, true, true, true, true, true, true, true, }; } 1968 1969 /** The property name. */ 1970 public final String name; 1971 1972 /** The property value. */ 1973 public final String value; 1974 1975 /** 1976 * Whether the property has "!important" annotation (implies {@code false} if absent). 1977 * <BR /><B CLASS=Opt>OPTIONAL</B> 1978 */ 1979 public final Boolean important; 1980 1981 /** 1982 * Whether the property is implicit (implies {@code false} if absent). 1983 * <BR /><B CLASS=Opt>OPTIONAL</B> 1984 */ 1985 public final Boolean implicit; 1986 1987 /** 1988 * The full property text as specified in the style. 1989 * <BR /><B CLASS=Opt>OPTIONAL</B> 1990 */ 1991 public final String text; 1992 1993 /** 1994 * Whether the property is understood by the browser (implies {@code true} if absent). 1995 * <BR /><B CLASS=Opt>OPTIONAL</B> 1996 */ 1997 public final Boolean parsedOk; 1998 1999 /** 2000 * Whether the property is disabled by the user (present for source-based properties only). 2001 * <BR /><B CLASS=Opt>OPTIONAL</B> 2002 */ 2003 public final Boolean disabled; 2004 2005 /** 2006 * The entire property range in the enclosing style declaration (if available). 2007 * <BR /><B CLASS=Opt>OPTIONAL</B> 2008 */ 2009 public final CSS.SourceRange range; 2010 2011 /** 2012 * Parsed longhand components of this property if it is a shorthand. 2013 * This field will be empty if the given property is not a shorthand. 2014 * <BR /><B CLASS=Opt>OPTIONAL</B> 2015 <B CLASS=Exp>EXPERIMENTAL</B> 2016 */ 2017 public final CSS.CSSProperty[] longhandProperties; 2018 2019 /** 2020 * Constructor 2021 * 2022 * @param name The property name. 2023 * 2024 * @param value The property value. 2025 * 2026 * @param important Whether the property has "!important" annotation (implies {@code false} if absent). 2027 * <BR /><B CLASS=Opt>OPTIONAL</B> 2028 * 2029 * @param implicit Whether the property is implicit (implies {@code false} if absent). 2030 * <BR /><B CLASS=Opt>OPTIONAL</B> 2031 * 2032 * @param text The full property text as specified in the style. 2033 * <BR /><B CLASS=Opt>OPTIONAL</B> 2034 * 2035 * @param parsedOk Whether the property is understood by the browser (implies {@code true} if absent). 2036 * <BR /><B CLASS=Opt>OPTIONAL</B> 2037 * 2038 * @param disabled Whether the property is disabled by the user (present for source-based properties only). 2039 * <BR /><B CLASS=Opt>OPTIONAL</B> 2040 * 2041 * @param range The entire property range in the enclosing style declaration (if available). 2042 * <BR /><B CLASS=Opt>OPTIONAL</B> 2043 * 2044 * @param longhandProperties 2045 * Parsed longhand components of this property if it is a shorthand. 2046 * This field will be empty if the given property is not a shorthand. 2047 * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B> 2048 */ 2049 public CSSProperty( 2050 String name, String value, Boolean important, Boolean implicit, String text, 2051 Boolean parsedOk, Boolean disabled, CSS.SourceRange range, 2052 CSS.CSSProperty[] longhandProperties 2053 ) 2054 { 2055 // Exception-Check(s) to ensure that if any parameters which are not declared as 2056 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2057 2058 if (name == null) THROWS.throwNPE("name"); 2059 if (value == null) THROWS.throwNPE("value"); 2060 2061 this.name = name; 2062 this.value = value; 2063 this.important = important; 2064 this.implicit = implicit; 2065 this.text = text; 2066 this.parsedOk = parsedOk; 2067 this.disabled = disabled; 2068 this.range = range; 2069 this.longhandProperties = longhandProperties; 2070 } 2071 2072 /** 2073 * JSON Object Constructor 2074 * @param jo A Json-Object having data about an instance of {@code 'CSSProperty'}. 2075 */ 2076 public CSSProperty (JsonObject jo) 2077 { 2078 this.name = ReadJSON.getString(jo, "name", false, true); 2079 this.value = ReadJSON.getString(jo, "value", false, true); 2080 this.important = ReadBoxedJSON.getBoolean(jo, "important", true); 2081 this.implicit = ReadBoxedJSON.getBoolean(jo, "implicit", true); 2082 this.text = ReadJSON.getString(jo, "text", true, false); 2083 this.parsedOk = ReadBoxedJSON.getBoolean(jo, "parsedOk", true); 2084 this.disabled = ReadBoxedJSON.getBoolean(jo, "disabled", true); 2085 this.range = ReadJSON.getObject(jo, "range", CSS.SourceRange.class, true, false); 2086 this.longhandProperties = (jo.getJsonArray("longhandProperties") == null) 2087 ? null 2088 : RJArrIntoStream.objArr(jo.getJsonArray("longhandProperties"), null, 0, CSS.CSSProperty.class).toArray(CSS.CSSProperty[]::new); 2089 2090 } 2091 2092 2093 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2094 public boolean equals(Object other) 2095 { 2096 if (this == other) return true; 2097 if (other == null) return false; 2098 if (other.getClass() != this.getClass()) return false; 2099 2100 CSSProperty o = (CSSProperty) other; 2101 2102 return 2103 Objects.equals(this.name, o.name) 2104 && Objects.equals(this.value, o.value) 2105 && Objects.equals(this.important, o.important) 2106 && Objects.equals(this.implicit, o.implicit) 2107 && Objects.equals(this.text, o.text) 2108 && Objects.equals(this.parsedOk, o.parsedOk) 2109 && Objects.equals(this.disabled, o.disabled) 2110 && Objects.equals(this.range, o.range) 2111 && Arrays.deepEquals(this.longhandProperties, o.longhandProperties); 2112 } 2113 2114 /** Generates a Hash-Code for {@code 'this'} instance */ 2115 public int hashCode() 2116 { 2117 return 2118 Objects.hashCode(this.name) 2119 + Objects.hashCode(this.value) 2120 + Objects.hashCode(this.important) 2121 + Objects.hashCode(this.implicit) 2122 + Objects.hashCode(this.text) 2123 + Objects.hashCode(this.parsedOk) 2124 + Objects.hashCode(this.disabled) 2125 + this.range.hashCode() 2126 + Arrays.deepHashCode(this.longhandProperties); 2127 } 2128 } 2129 2130 /** CSS media rule descriptor. */ 2131 public static class CSSMedia 2132 extends BaseType 2133 implements java.io.Serializable 2134 { 2135 /** For Object Serialization. java.io.Serializable */ 2136 protected static final long serialVersionUID = 1; 2137 2138 public boolean[] optionals() 2139 { return new boolean[] { false, false, true, true, true, true, }; } 2140 2141 /** Media query text. */ 2142 public final String text; 2143 2144 /** 2145 * Source of the media query: "mediaRule" if specified by a @media rule, "importRule" if 2146 * specified by an @import rule, "linkedSheet" if specified by a "media" attribute in a linked 2147 * stylesheet's LINK tag, "inlineSheet" if specified by a "media" attribute in an inline 2148 * stylesheet's STYLE tag. 2149 */ 2150 public final String source; 2151 2152 /** 2153 * URL of the document containing the media query description. 2154 * <BR /><B CLASS=Opt>OPTIONAL</B> 2155 */ 2156 public final String sourceURL; 2157 2158 /** 2159 * The associated rule (@media or @import) header range in the enclosing stylesheet (if 2160 * available). 2161 * <BR /><B CLASS=Opt>OPTIONAL</B> 2162 */ 2163 public final CSS.SourceRange range; 2164 2165 /** 2166 * Identifier of the stylesheet containing this object (if exists). 2167 * <BR /><B CLASS=Opt>OPTIONAL</B> 2168 */ 2169 public final String styleSheetId; 2170 2171 /** 2172 * Array of media queries. 2173 * <BR /><B CLASS=Opt>OPTIONAL</B> 2174 */ 2175 public final CSS.MediaQuery[] mediaList; 2176 2177 /** 2178 * Constructor 2179 * 2180 * @param text Media query text. 2181 * 2182 * @param source 2183 * Source of the media query: "mediaRule" if specified by a @media rule, "importRule" if 2184 * specified by an @import rule, "linkedSheet" if specified by a "media" attribute in a linked 2185 * stylesheet's LINK tag, "inlineSheet" if specified by a "media" attribute in an inline 2186 * stylesheet's STYLE tag. 2187 * <BR />Acceptable Values: ["mediaRule", "importRule", "linkedSheet", "inlineSheet"] 2188 * 2189 * @param sourceURL URL of the document containing the media query description. 2190 * <BR /><B CLASS=Opt>OPTIONAL</B> 2191 * 2192 * @param range 2193 * The associated rule (@media or @import) header range in the enclosing stylesheet (if 2194 * available). 2195 * <BR /><B CLASS=Opt>OPTIONAL</B> 2196 * 2197 * @param styleSheetId Identifier of the stylesheet containing this object (if exists). 2198 * <BR /><B CLASS=Opt>OPTIONAL</B> 2199 * 2200 * @param mediaList Array of media queries. 2201 * <BR /><B CLASS=Opt>OPTIONAL</B> 2202 */ 2203 public CSSMedia( 2204 String text, String source, String sourceURL, CSS.SourceRange range, 2205 String styleSheetId, CSS.MediaQuery[] mediaList 2206 ) 2207 { 2208 // Exception-Check(s) to ensure that if any parameters which are not declared as 2209 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2210 2211 if (text == null) THROWS.throwNPE("text"); 2212 if (source == null) THROWS.throwNPE("source"); 2213 2214 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2215 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2216 2217 THROWS.checkIAE( 2218 "source", source, 2219 "mediaRule", "importRule", "linkedSheet", "inlineSheet" 2220 ); 2221 2222 this.text = text; 2223 this.source = source; 2224 this.sourceURL = sourceURL; 2225 this.range = range; 2226 this.styleSheetId = styleSheetId; 2227 this.mediaList = mediaList; 2228 } 2229 2230 /** 2231 * JSON Object Constructor 2232 * @param jo A Json-Object having data about an instance of {@code 'CSSMedia'}. 2233 */ 2234 public CSSMedia (JsonObject jo) 2235 { 2236 this.text = ReadJSON.getString(jo, "text", false, true); 2237 this.source = ReadJSON.getString(jo, "source", false, true); 2238 this.sourceURL = ReadJSON.getString(jo, "sourceURL", true, false); 2239 this.range = ReadJSON.getObject(jo, "range", CSS.SourceRange.class, true, false); 2240 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", true, false); 2241 this.mediaList = (jo.getJsonArray("mediaList") == null) 2242 ? null 2243 : RJArrIntoStream.objArr(jo.getJsonArray("mediaList"), null, 0, CSS.MediaQuery.class).toArray(CSS.MediaQuery[]::new); 2244 2245 } 2246 2247 2248 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2249 public boolean equals(Object other) 2250 { 2251 if (this == other) return true; 2252 if (other == null) return false; 2253 if (other.getClass() != this.getClass()) return false; 2254 2255 CSSMedia o = (CSSMedia) other; 2256 2257 return 2258 Objects.equals(this.text, o.text) 2259 && Objects.equals(this.source, o.source) 2260 && Objects.equals(this.sourceURL, o.sourceURL) 2261 && Objects.equals(this.range, o.range) 2262 && Objects.equals(this.styleSheetId, o.styleSheetId) 2263 && Arrays.deepEquals(this.mediaList, o.mediaList); 2264 } 2265 2266 /** Generates a Hash-Code for {@code 'this'} instance */ 2267 public int hashCode() 2268 { 2269 return 2270 Objects.hashCode(this.text) 2271 + Objects.hashCode(this.source) 2272 + Objects.hashCode(this.sourceURL) 2273 + this.range.hashCode() 2274 + Objects.hashCode(this.styleSheetId) 2275 + Arrays.deepHashCode(this.mediaList); 2276 } 2277 } 2278 2279 /** Media query descriptor. */ 2280 public static class MediaQuery 2281 extends BaseType 2282 implements java.io.Serializable 2283 { 2284 /** For Object Serialization. java.io.Serializable */ 2285 protected static final long serialVersionUID = 1; 2286 2287 public boolean[] optionals() 2288 { return new boolean[] { false, false, }; } 2289 2290 /** Array of media query expressions. */ 2291 public final CSS.MediaQueryExpression[] expressions; 2292 2293 /** Whether the media query condition is satisfied. */ 2294 public final boolean active; 2295 2296 /** 2297 * Constructor 2298 * 2299 * @param expressions Array of media query expressions. 2300 * 2301 * @param active Whether the media query condition is satisfied. 2302 */ 2303 public MediaQuery(CSS.MediaQueryExpression[] expressions, boolean active) 2304 { 2305 // Exception-Check(s) to ensure that if any parameters which are not declared as 2306 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2307 2308 if (expressions == null) THROWS.throwNPE("expressions"); 2309 2310 this.expressions = expressions; 2311 this.active = active; 2312 } 2313 2314 /** 2315 * JSON Object Constructor 2316 * @param jo A Json-Object having data about an instance of {@code 'MediaQuery'}. 2317 */ 2318 public MediaQuery (JsonObject jo) 2319 { 2320 this.expressions = (jo.getJsonArray("expressions") == null) 2321 ? null 2322 : RJArrIntoStream.objArr(jo.getJsonArray("expressions"), null, 0, CSS.MediaQueryExpression.class).toArray(CSS.MediaQueryExpression[]::new); 2323 2324 this.active = ReadPrimJSON.getBoolean(jo, "active"); 2325 } 2326 2327 2328 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2329 public boolean equals(Object other) 2330 { 2331 if (this == other) return true; 2332 if (other == null) return false; 2333 if (other.getClass() != this.getClass()) return false; 2334 2335 MediaQuery o = (MediaQuery) other; 2336 2337 return 2338 Arrays.deepEquals(this.expressions, o.expressions) 2339 && (this.active == o.active); 2340 } 2341 2342 /** Generates a Hash-Code for {@code 'this'} instance */ 2343 public int hashCode() 2344 { 2345 return 2346 Arrays.deepHashCode(this.expressions) 2347 + (this.active ? 1 : 0); 2348 } 2349 } 2350 2351 /** Media query expression descriptor. */ 2352 public static class MediaQueryExpression 2353 extends BaseType 2354 implements java.io.Serializable 2355 { 2356 /** For Object Serialization. java.io.Serializable */ 2357 protected static final long serialVersionUID = 1; 2358 2359 public boolean[] optionals() 2360 { return new boolean[] { false, false, false, true, true, }; } 2361 2362 /** Media query expression value. */ 2363 public final Number value; 2364 2365 /** Media query expression units. */ 2366 public final String unit; 2367 2368 /** Media query expression feature. */ 2369 public final String feature; 2370 2371 /** 2372 * The associated range of the value text in the enclosing stylesheet (if available). 2373 * <BR /><B CLASS=Opt>OPTIONAL</B> 2374 */ 2375 public final CSS.SourceRange valueRange; 2376 2377 /** 2378 * Computed length of media query expression (if applicable). 2379 * <BR /><B CLASS=Opt>OPTIONAL</B> 2380 */ 2381 public final Number computedLength; 2382 2383 /** 2384 * Constructor 2385 * 2386 * @param value Media query expression value. 2387 * 2388 * @param unit Media query expression units. 2389 * 2390 * @param feature Media query expression feature. 2391 * 2392 * @param valueRange The associated range of the value text in the enclosing stylesheet (if available). 2393 * <BR /><B CLASS=Opt>OPTIONAL</B> 2394 * 2395 * @param computedLength Computed length of media query expression (if applicable). 2396 * <BR /><B CLASS=Opt>OPTIONAL</B> 2397 */ 2398 public MediaQueryExpression( 2399 Number value, String unit, String feature, CSS.SourceRange valueRange, 2400 Number computedLength 2401 ) 2402 { 2403 // Exception-Check(s) to ensure that if any parameters which are not declared as 2404 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2405 2406 if (value == null) THROWS.throwNPE("value"); 2407 if (unit == null) THROWS.throwNPE("unit"); 2408 if (feature == null) THROWS.throwNPE("feature"); 2409 2410 this.value = value; 2411 this.unit = unit; 2412 this.feature = feature; 2413 this.valueRange = valueRange; 2414 this.computedLength = computedLength; 2415 } 2416 2417 /** 2418 * JSON Object Constructor 2419 * @param jo A Json-Object having data about an instance of {@code 'MediaQueryExpression'}. 2420 */ 2421 public MediaQueryExpression (JsonObject jo) 2422 { 2423 this.value = ReadNumberJSON.get(jo, "value", false, true); 2424 this.unit = ReadJSON.getString(jo, "unit", false, true); 2425 this.feature = ReadJSON.getString(jo, "feature", false, true); 2426 this.valueRange = ReadJSON.getObject(jo, "valueRange", CSS.SourceRange.class, true, false); 2427 this.computedLength = ReadNumberJSON.get(jo, "computedLength", true, false); 2428 } 2429 2430 2431 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2432 public boolean equals(Object other) 2433 { 2434 if (this == other) return true; 2435 if (other == null) return false; 2436 if (other.getClass() != this.getClass()) return false; 2437 2438 MediaQueryExpression o = (MediaQueryExpression) other; 2439 2440 return 2441 Objects.equals(this.value, o.value) 2442 && Objects.equals(this.unit, o.unit) 2443 && Objects.equals(this.feature, o.feature) 2444 && Objects.equals(this.valueRange, o.valueRange) 2445 && Objects.equals(this.computedLength, o.computedLength); 2446 } 2447 2448 /** Generates a Hash-Code for {@code 'this'} instance */ 2449 public int hashCode() 2450 { 2451 return 2452 Objects.hashCode(this.value) 2453 + Objects.hashCode(this.unit) 2454 + Objects.hashCode(this.feature) 2455 + this.valueRange.hashCode() 2456 + Objects.hashCode(this.computedLength); 2457 } 2458 } 2459 2460 /** 2461 * CSS container query rule descriptor. 2462 * <BR /><B CLASS=Exp>EXPERIMENTAL</B> 2463 */ 2464 public static class CSSContainerQuery 2465 extends BaseType 2466 implements java.io.Serializable 2467 { 2468 /** For Object Serialization. java.io.Serializable */ 2469 protected static final long serialVersionUID = 1; 2470 2471 public boolean[] optionals() 2472 { return new boolean[] { false, true, true, true, true, true, true, true, }; } 2473 2474 /** Container query text. */ 2475 public final String text; 2476 2477 /** 2478 * The associated rule header range in the enclosing stylesheet (if 2479 * available). 2480 * <BR /><B CLASS=Opt>OPTIONAL</B> 2481 */ 2482 public final CSS.SourceRange range; 2483 2484 /** 2485 * Identifier of the stylesheet containing this object (if exists). 2486 * <BR /><B CLASS=Opt>OPTIONAL</B> 2487 */ 2488 public final String styleSheetId; 2489 2490 /** 2491 * Optional name for the container. 2492 * <BR /><B CLASS=Opt>OPTIONAL</B> 2493 */ 2494 public final String name; 2495 2496 /** 2497 * Optional physical axes queried for the container. 2498 * <BR /><B CLASS=Opt>OPTIONAL</B> 2499 */ 2500 public final String physicalAxes; 2501 2502 /** 2503 * Optional logical axes queried for the container. 2504 * <BR /><B CLASS=Opt>OPTIONAL</B> 2505 */ 2506 public final String logicalAxes; 2507 2508 /** 2509 * true if the query contains scroll-state() queries. 2510 * <BR /><B CLASS=Opt>OPTIONAL</B> 2511 */ 2512 public final Boolean queriesScrollState; 2513 2514 /** 2515 * true if the query contains anchored() queries. 2516 * <BR /><B CLASS=Opt>OPTIONAL</B> 2517 */ 2518 public final Boolean queriesAnchored; 2519 2520 /** 2521 * Constructor 2522 * 2523 * @param text Container query text. 2524 * 2525 * @param range 2526 * The associated rule header range in the enclosing stylesheet (if 2527 * available). 2528 * <BR /><B CLASS=Opt>OPTIONAL</B> 2529 * 2530 * @param styleSheetId Identifier of the stylesheet containing this object (if exists). 2531 * <BR /><B CLASS=Opt>OPTIONAL</B> 2532 * 2533 * @param name Optional name for the container. 2534 * <BR /><B CLASS=Opt>OPTIONAL</B> 2535 * 2536 * @param physicalAxes Optional physical axes queried for the container. 2537 * <BR /><B CLASS=Opt>OPTIONAL</B> 2538 * 2539 * @param logicalAxes Optional logical axes queried for the container. 2540 * <BR /><B CLASS=Opt>OPTIONAL</B> 2541 * 2542 * @param queriesScrollState true if the query contains scroll-state() queries. 2543 * <BR /><B CLASS=Opt>OPTIONAL</B> 2544 * 2545 * @param queriesAnchored true if the query contains anchored() queries. 2546 * <BR /><B CLASS=Opt>OPTIONAL</B> 2547 */ 2548 public CSSContainerQuery( 2549 String text, CSS.SourceRange range, String styleSheetId, String name, 2550 String physicalAxes, String logicalAxes, Boolean queriesScrollState, 2551 Boolean queriesAnchored 2552 ) 2553 { 2554 // Exception-Check(s) to ensure that if any parameters which are not declared as 2555 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2556 2557 if (text == null) THROWS.throwNPE("text"); 2558 2559 // Exception-Check(s) to ensure that if any parameters which must adhere to a 2560 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 2561 2562 THROWS.checkIAE("physicalAxes", physicalAxes, "DOM.PhysicalAxes", DOM.PhysicalAxes); 2563 THROWS.checkIAE("logicalAxes", logicalAxes, "DOM.LogicalAxes", DOM.LogicalAxes); 2564 2565 this.text = text; 2566 this.range = range; 2567 this.styleSheetId = styleSheetId; 2568 this.name = name; 2569 this.physicalAxes = physicalAxes; 2570 this.logicalAxes = logicalAxes; 2571 this.queriesScrollState = queriesScrollState; 2572 this.queriesAnchored = queriesAnchored; 2573 } 2574 2575 /** 2576 * JSON Object Constructor 2577 * @param jo A Json-Object having data about an instance of {@code 'CSSContainerQuery'}. 2578 */ 2579 public CSSContainerQuery (JsonObject jo) 2580 { 2581 this.text = ReadJSON.getString(jo, "text", false, true); 2582 this.range = ReadJSON.getObject(jo, "range", CSS.SourceRange.class, true, false); 2583 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", true, false); 2584 this.name = ReadJSON.getString(jo, "name", true, false); 2585 this.physicalAxes = ReadJSON.getString(jo, "physicalAxes", true, false); 2586 this.logicalAxes = ReadJSON.getString(jo, "logicalAxes", true, false); 2587 this.queriesScrollState = ReadBoxedJSON.getBoolean(jo, "queriesScrollState", true); 2588 this.queriesAnchored = ReadBoxedJSON.getBoolean(jo, "queriesAnchored", true); 2589 } 2590 2591 2592 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2593 public boolean equals(Object other) 2594 { 2595 if (this == other) return true; 2596 if (other == null) return false; 2597 if (other.getClass() != this.getClass()) return false; 2598 2599 CSSContainerQuery o = (CSSContainerQuery) other; 2600 2601 return 2602 Objects.equals(this.text, o.text) 2603 && Objects.equals(this.range, o.range) 2604 && Objects.equals(this.styleSheetId, o.styleSheetId) 2605 && Objects.equals(this.name, o.name) 2606 && Objects.equals(this.physicalAxes, o.physicalAxes) 2607 && Objects.equals(this.logicalAxes, o.logicalAxes) 2608 && Objects.equals(this.queriesScrollState, o.queriesScrollState) 2609 && Objects.equals(this.queriesAnchored, o.queriesAnchored); 2610 } 2611 2612 /** Generates a Hash-Code for {@code 'this'} instance */ 2613 public int hashCode() 2614 { 2615 return 2616 Objects.hashCode(this.text) 2617 + this.range.hashCode() 2618 + Objects.hashCode(this.styleSheetId) 2619 + Objects.hashCode(this.name) 2620 + Objects.hashCode(this.physicalAxes) 2621 + Objects.hashCode(this.logicalAxes) 2622 + Objects.hashCode(this.queriesScrollState) 2623 + Objects.hashCode(this.queriesAnchored); 2624 } 2625 } 2626 2627 /** 2628 * CSS Supports at-rule descriptor. 2629 * <BR /><B CLASS=Exp>EXPERIMENTAL</B> 2630 */ 2631 public static class CSSSupports 2632 extends BaseType 2633 implements java.io.Serializable 2634 { 2635 /** For Object Serialization. java.io.Serializable */ 2636 protected static final long serialVersionUID = 1; 2637 2638 public boolean[] optionals() 2639 { return new boolean[] { false, false, true, true, }; } 2640 2641 /** Supports rule text. */ 2642 public final String text; 2643 2644 /** Whether the supports condition is satisfied. */ 2645 public final boolean active; 2646 2647 /** 2648 * The associated rule header range in the enclosing stylesheet (if 2649 * available). 2650 * <BR /><B CLASS=Opt>OPTIONAL</B> 2651 */ 2652 public final CSS.SourceRange range; 2653 2654 /** 2655 * Identifier of the stylesheet containing this object (if exists). 2656 * <BR /><B CLASS=Opt>OPTIONAL</B> 2657 */ 2658 public final String styleSheetId; 2659 2660 /** 2661 * Constructor 2662 * 2663 * @param text Supports rule text. 2664 * 2665 * @param active Whether the supports condition is satisfied. 2666 * 2667 * @param range 2668 * The associated rule header range in the enclosing stylesheet (if 2669 * available). 2670 * <BR /><B CLASS=Opt>OPTIONAL</B> 2671 * 2672 * @param styleSheetId Identifier of the stylesheet containing this object (if exists). 2673 * <BR /><B CLASS=Opt>OPTIONAL</B> 2674 */ 2675 public CSSSupports 2676 (String text, boolean active, CSS.SourceRange range, String styleSheetId) 2677 { 2678 // Exception-Check(s) to ensure that if any parameters which are not declared as 2679 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2680 2681 if (text == null) THROWS.throwNPE("text"); 2682 2683 this.text = text; 2684 this.active = active; 2685 this.range = range; 2686 this.styleSheetId = styleSheetId; 2687 } 2688 2689 /** 2690 * JSON Object Constructor 2691 * @param jo A Json-Object having data about an instance of {@code 'CSSSupports'}. 2692 */ 2693 public CSSSupports (JsonObject jo) 2694 { 2695 this.text = ReadJSON.getString(jo, "text", false, true); 2696 this.active = ReadPrimJSON.getBoolean(jo, "active"); 2697 this.range = ReadJSON.getObject(jo, "range", CSS.SourceRange.class, true, false); 2698 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", true, false); 2699 } 2700 2701 2702 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2703 public boolean equals(Object other) 2704 { 2705 if (this == other) return true; 2706 if (other == null) return false; 2707 if (other.getClass() != this.getClass()) return false; 2708 2709 CSSSupports o = (CSSSupports) other; 2710 2711 return 2712 Objects.equals(this.text, o.text) 2713 && (this.active == o.active) 2714 && Objects.equals(this.range, o.range) 2715 && Objects.equals(this.styleSheetId, o.styleSheetId); 2716 } 2717 2718 /** Generates a Hash-Code for {@code 'this'} instance */ 2719 public int hashCode() 2720 { 2721 return 2722 Objects.hashCode(this.text) 2723 + (this.active ? 1 : 0) 2724 + this.range.hashCode() 2725 + Objects.hashCode(this.styleSheetId); 2726 } 2727 } 2728 2729 /** 2730 * CSS Scope at-rule descriptor. 2731 * <BR /><B CLASS=Exp>EXPERIMENTAL</B> 2732 */ 2733 public static class CSSScope 2734 extends BaseType 2735 implements java.io.Serializable 2736 { 2737 /** For Object Serialization. java.io.Serializable */ 2738 protected static final long serialVersionUID = 1; 2739 2740 public boolean[] optionals() 2741 { return new boolean[] { false, true, true, }; } 2742 2743 /** Scope rule text. */ 2744 public final String text; 2745 2746 /** 2747 * The associated rule header range in the enclosing stylesheet (if 2748 * available). 2749 * <BR /><B CLASS=Opt>OPTIONAL</B> 2750 */ 2751 public final CSS.SourceRange range; 2752 2753 /** 2754 * Identifier of the stylesheet containing this object (if exists). 2755 * <BR /><B CLASS=Opt>OPTIONAL</B> 2756 */ 2757 public final String styleSheetId; 2758 2759 /** 2760 * Constructor 2761 * 2762 * @param text Scope rule text. 2763 * 2764 * @param range 2765 * The associated rule header range in the enclosing stylesheet (if 2766 * available). 2767 * <BR /><B CLASS=Opt>OPTIONAL</B> 2768 * 2769 * @param styleSheetId Identifier of the stylesheet containing this object (if exists). 2770 * <BR /><B CLASS=Opt>OPTIONAL</B> 2771 */ 2772 public CSSScope(String text, CSS.SourceRange range, String styleSheetId) 2773 { 2774 // Exception-Check(s) to ensure that if any parameters which are not declared as 2775 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2776 2777 if (text == null) THROWS.throwNPE("text"); 2778 2779 this.text = text; 2780 this.range = range; 2781 this.styleSheetId = styleSheetId; 2782 } 2783 2784 /** 2785 * JSON Object Constructor 2786 * @param jo A Json-Object having data about an instance of {@code 'CSSScope'}. 2787 */ 2788 public CSSScope (JsonObject jo) 2789 { 2790 this.text = ReadJSON.getString(jo, "text", false, true); 2791 this.range = ReadJSON.getObject(jo, "range", CSS.SourceRange.class, true, false); 2792 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", true, false); 2793 } 2794 2795 2796 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2797 public boolean equals(Object other) 2798 { 2799 if (this == other) return true; 2800 if (other == null) return false; 2801 if (other.getClass() != this.getClass()) return false; 2802 2803 CSSScope o = (CSSScope) other; 2804 2805 return 2806 Objects.equals(this.text, o.text) 2807 && Objects.equals(this.range, o.range) 2808 && Objects.equals(this.styleSheetId, o.styleSheetId); 2809 } 2810 2811 /** Generates a Hash-Code for {@code 'this'} instance */ 2812 public int hashCode() 2813 { 2814 return 2815 Objects.hashCode(this.text) 2816 + this.range.hashCode() 2817 + Objects.hashCode(this.styleSheetId); 2818 } 2819 } 2820 2821 /** 2822 * CSS Layer at-rule descriptor. 2823 * <BR /><B CLASS=Exp>EXPERIMENTAL</B> 2824 */ 2825 public static class CSSLayer 2826 extends BaseType 2827 implements java.io.Serializable 2828 { 2829 /** For Object Serialization. java.io.Serializable */ 2830 protected static final long serialVersionUID = 1; 2831 2832 public boolean[] optionals() 2833 { return new boolean[] { false, true, true, }; } 2834 2835 /** Layer name. */ 2836 public final String text; 2837 2838 /** 2839 * The associated rule header range in the enclosing stylesheet (if 2840 * available). 2841 * <BR /><B CLASS=Opt>OPTIONAL</B> 2842 */ 2843 public final CSS.SourceRange range; 2844 2845 /** 2846 * Identifier of the stylesheet containing this object (if exists). 2847 * <BR /><B CLASS=Opt>OPTIONAL</B> 2848 */ 2849 public final String styleSheetId; 2850 2851 /** 2852 * Constructor 2853 * 2854 * @param text Layer name. 2855 * 2856 * @param range 2857 * The associated rule header range in the enclosing stylesheet (if 2858 * available). 2859 * <BR /><B CLASS=Opt>OPTIONAL</B> 2860 * 2861 * @param styleSheetId Identifier of the stylesheet containing this object (if exists). 2862 * <BR /><B CLASS=Opt>OPTIONAL</B> 2863 */ 2864 public CSSLayer(String text, CSS.SourceRange range, String styleSheetId) 2865 { 2866 // Exception-Check(s) to ensure that if any parameters which are not declared as 2867 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 2868 2869 if (text == null) THROWS.throwNPE("text"); 2870 2871 this.text = text; 2872 this.range = range; 2873 this.styleSheetId = styleSheetId; 2874 } 2875 2876 /** 2877 * JSON Object Constructor 2878 * @param jo A Json-Object having data about an instance of {@code 'CSSLayer'}. 2879 */ 2880 public CSSLayer (JsonObject jo) 2881 { 2882 this.text = ReadJSON.getString(jo, "text", false, true); 2883 this.range = ReadJSON.getObject(jo, "range", CSS.SourceRange.class, true, false); 2884 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", true, false); 2885 } 2886 2887 2888 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2889 public boolean equals(Object other) 2890 { 2891 if (this == other) return true; 2892 if (other == null) return false; 2893 if (other.getClass() != this.getClass()) return false; 2894 2895 CSSLayer o = (CSSLayer) other; 2896 2897 return 2898 Objects.equals(this.text, o.text) 2899 && Objects.equals(this.range, o.range) 2900 && Objects.equals(this.styleSheetId, o.styleSheetId); 2901 } 2902 2903 /** Generates a Hash-Code for {@code 'this'} instance */ 2904 public int hashCode() 2905 { 2906 return 2907 Objects.hashCode(this.text) 2908 + this.range.hashCode() 2909 + Objects.hashCode(this.styleSheetId); 2910 } 2911 } 2912 2913 /** 2914 * CSS Starting Style at-rule descriptor. 2915 * <BR /><B CLASS=Exp>EXPERIMENTAL</B> 2916 */ 2917 public static class CSSStartingStyle 2918 extends BaseType 2919 implements java.io.Serializable 2920 { 2921 /** For Object Serialization. java.io.Serializable */ 2922 protected static final long serialVersionUID = 1; 2923 2924 public boolean[] optionals() 2925 { return new boolean[] { true, true, }; } 2926 2927 /** 2928 * The associated rule header range in the enclosing stylesheet (if 2929 * available). 2930 * <BR /><B CLASS=Opt>OPTIONAL</B> 2931 */ 2932 public final CSS.SourceRange range; 2933 2934 /** 2935 * Identifier of the stylesheet containing this object (if exists). 2936 * <BR /><B CLASS=Opt>OPTIONAL</B> 2937 */ 2938 public final String styleSheetId; 2939 2940 /** 2941 * Constructor 2942 * 2943 * @param range 2944 * The associated rule header range in the enclosing stylesheet (if 2945 * available). 2946 * <BR /><B CLASS=Opt>OPTIONAL</B> 2947 * 2948 * @param styleSheetId Identifier of the stylesheet containing this object (if exists). 2949 * <BR /><B CLASS=Opt>OPTIONAL</B> 2950 */ 2951 public CSSStartingStyle(CSS.SourceRange range, String styleSheetId) 2952 { 2953 this.range = range; 2954 this.styleSheetId = styleSheetId; 2955 } 2956 2957 /** 2958 * JSON Object Constructor 2959 * @param jo A Json-Object having data about an instance of {@code 'CSSStartingStyle'}. 2960 */ 2961 public CSSStartingStyle (JsonObject jo) 2962 { 2963 this.range = ReadJSON.getObject(jo, "range", CSS.SourceRange.class, true, false); 2964 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", true, false); 2965 } 2966 2967 2968 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 2969 public boolean equals(Object other) 2970 { 2971 if (this == other) return true; 2972 if (other == null) return false; 2973 if (other.getClass() != this.getClass()) return false; 2974 2975 CSSStartingStyle o = (CSSStartingStyle) other; 2976 2977 return 2978 Objects.equals(this.range, o.range) 2979 && Objects.equals(this.styleSheetId, o.styleSheetId); 2980 } 2981 2982 /** Generates a Hash-Code for {@code 'this'} instance */ 2983 public int hashCode() 2984 { 2985 return 2986 this.range.hashCode() 2987 + Objects.hashCode(this.styleSheetId); 2988 } 2989 } 2990 2991 /** 2992 * CSS Layer data. 2993 * <BR /><B CLASS=Exp>EXPERIMENTAL</B> 2994 */ 2995 public static class CSSLayerData 2996 extends BaseType 2997 implements java.io.Serializable 2998 { 2999 /** For Object Serialization. java.io.Serializable */ 3000 protected static final long serialVersionUID = 1; 3001 3002 public boolean[] optionals() 3003 { return new boolean[] { false, true, false, }; } 3004 3005 /** Layer name. */ 3006 public final String name; 3007 3008 /** 3009 * Direct sub-layers 3010 * <BR /><B CLASS=Opt>OPTIONAL</B> 3011 */ 3012 public final CSS.CSSLayerData[] subLayers; 3013 3014 /** 3015 * Layer order. The order determines the order of the layer in the cascade order. 3016 * A higher number has higher priority in the cascade order. 3017 */ 3018 public final Number order; 3019 3020 /** 3021 * Constructor 3022 * 3023 * @param name Layer name. 3024 * 3025 * @param subLayers Direct sub-layers 3026 * <BR /><B CLASS=Opt>OPTIONAL</B> 3027 * 3028 * @param order 3029 * Layer order. The order determines the order of the layer in the cascade order. 3030 * A higher number has higher priority in the cascade order. 3031 */ 3032 public CSSLayerData(String name, CSS.CSSLayerData[] subLayers, Number order) 3033 { 3034 // Exception-Check(s) to ensure that if any parameters which are not declared as 3035 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3036 3037 if (name == null) THROWS.throwNPE("name"); 3038 if (order == null) THROWS.throwNPE("order"); 3039 3040 this.name = name; 3041 this.subLayers = subLayers; 3042 this.order = order; 3043 } 3044 3045 /** 3046 * JSON Object Constructor 3047 * @param jo A Json-Object having data about an instance of {@code 'CSSLayerData'}. 3048 */ 3049 public CSSLayerData (JsonObject jo) 3050 { 3051 this.name = ReadJSON.getString(jo, "name", false, true); 3052 this.subLayers = (jo.getJsonArray("subLayers") == null) 3053 ? null 3054 : RJArrIntoStream.objArr(jo.getJsonArray("subLayers"), null, 0, CSS.CSSLayerData.class).toArray(CSS.CSSLayerData[]::new); 3055 3056 this.order = ReadNumberJSON.get(jo, "order", false, true); 3057 } 3058 3059 3060 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3061 public boolean equals(Object other) 3062 { 3063 if (this == other) return true; 3064 if (other == null) return false; 3065 if (other.getClass() != this.getClass()) return false; 3066 3067 CSSLayerData o = (CSSLayerData) other; 3068 3069 return 3070 Objects.equals(this.name, o.name) 3071 && Arrays.deepEquals(this.subLayers, o.subLayers) 3072 && Objects.equals(this.order, o.order); 3073 } 3074 3075 /** Generates a Hash-Code for {@code 'this'} instance */ 3076 public int hashCode() 3077 { 3078 return 3079 Objects.hashCode(this.name) 3080 + Arrays.deepHashCode(this.subLayers) 3081 + Objects.hashCode(this.order); 3082 } 3083 } 3084 3085 /** Information about amount of glyphs that were rendered with given font. */ 3086 public static class PlatformFontUsage 3087 extends BaseType 3088 implements java.io.Serializable 3089 { 3090 /** For Object Serialization. java.io.Serializable */ 3091 protected static final long serialVersionUID = 1; 3092 3093 public boolean[] optionals() 3094 { return new boolean[] { false, false, false, false, }; } 3095 3096 /** Font's family name reported by platform. */ 3097 public final String familyName; 3098 3099 /** Font's PostScript name reported by platform. */ 3100 public final String postScriptName; 3101 3102 /** Indicates if the font was downloaded or resolved locally. */ 3103 public final boolean isCustomFont; 3104 3105 /** Amount of glyphs that were rendered with this font. */ 3106 public final Number glyphCount; 3107 3108 /** 3109 * Constructor 3110 * 3111 * @param familyName Font's family name reported by platform. 3112 * 3113 * @param postScriptName Font's PostScript name reported by platform. 3114 * 3115 * @param isCustomFont Indicates if the font was downloaded or resolved locally. 3116 * 3117 * @param glyphCount Amount of glyphs that were rendered with this font. 3118 */ 3119 public PlatformFontUsage 3120 (String familyName, String postScriptName, boolean isCustomFont, Number glyphCount) 3121 { 3122 // Exception-Check(s) to ensure that if any parameters which are not declared as 3123 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3124 3125 if (familyName == null) THROWS.throwNPE("familyName"); 3126 if (postScriptName == null) THROWS.throwNPE("postScriptName"); 3127 if (glyphCount == null) THROWS.throwNPE("glyphCount"); 3128 3129 this.familyName = familyName; 3130 this.postScriptName = postScriptName; 3131 this.isCustomFont = isCustomFont; 3132 this.glyphCount = glyphCount; 3133 } 3134 3135 /** 3136 * JSON Object Constructor 3137 * @param jo A Json-Object having data about an instance of {@code 'PlatformFontUsage'}. 3138 */ 3139 public PlatformFontUsage (JsonObject jo) 3140 { 3141 this.familyName = ReadJSON.getString(jo, "familyName", false, true); 3142 this.postScriptName = ReadJSON.getString(jo, "postScriptName", false, true); 3143 this.isCustomFont = ReadPrimJSON.getBoolean(jo, "isCustomFont"); 3144 this.glyphCount = ReadNumberJSON.get(jo, "glyphCount", false, true); 3145 } 3146 3147 3148 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3149 public boolean equals(Object other) 3150 { 3151 if (this == other) return true; 3152 if (other == null) return false; 3153 if (other.getClass() != this.getClass()) return false; 3154 3155 PlatformFontUsage o = (PlatformFontUsage) other; 3156 3157 return 3158 Objects.equals(this.familyName, o.familyName) 3159 && Objects.equals(this.postScriptName, o.postScriptName) 3160 && (this.isCustomFont == o.isCustomFont) 3161 && Objects.equals(this.glyphCount, o.glyphCount); 3162 } 3163 3164 /** Generates a Hash-Code for {@code 'this'} instance */ 3165 public int hashCode() 3166 { 3167 return 3168 Objects.hashCode(this.familyName) 3169 + Objects.hashCode(this.postScriptName) 3170 + (this.isCustomFont ? 1 : 0) 3171 + Objects.hashCode(this.glyphCount); 3172 } 3173 } 3174 3175 /** Information about font variation axes for variable fonts */ 3176 public static class FontVariationAxis 3177 extends BaseType 3178 implements java.io.Serializable 3179 { 3180 /** For Object Serialization. java.io.Serializable */ 3181 protected static final long serialVersionUID = 1; 3182 3183 public boolean[] optionals() 3184 { return new boolean[] { false, false, false, false, false, }; } 3185 3186 /** The font-variation-setting tag (a.k.a. "axis tag"). */ 3187 public final String tag; 3188 3189 /** Human-readable variation name in the default language (normally, "en"). */ 3190 public final String name; 3191 3192 /** The minimum value (inclusive) the font supports for this tag. */ 3193 public final Number minValue; 3194 3195 /** The maximum value (inclusive) the font supports for this tag. */ 3196 public final Number maxValue; 3197 3198 /** The default value. */ 3199 public final Number defaultValue; 3200 3201 /** 3202 * Constructor 3203 * 3204 * @param tag The font-variation-setting tag (a.k.a. "axis tag"). 3205 * 3206 * @param name Human-readable variation name in the default language (normally, "en"). 3207 * 3208 * @param minValue The minimum value (inclusive) the font supports for this tag. 3209 * 3210 * @param maxValue The maximum value (inclusive) the font supports for this tag. 3211 * 3212 * @param defaultValue The default value. 3213 */ 3214 public FontVariationAxis 3215 (String tag, String name, Number minValue, Number maxValue, Number defaultValue) 3216 { 3217 // Exception-Check(s) to ensure that if any parameters which are not declared as 3218 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3219 3220 if (tag == null) THROWS.throwNPE("tag"); 3221 if (name == null) THROWS.throwNPE("name"); 3222 if (minValue == null) THROWS.throwNPE("minValue"); 3223 if (maxValue == null) THROWS.throwNPE("maxValue"); 3224 if (defaultValue == null) THROWS.throwNPE("defaultValue"); 3225 3226 this.tag = tag; 3227 this.name = name; 3228 this.minValue = minValue; 3229 this.maxValue = maxValue; 3230 this.defaultValue = defaultValue; 3231 } 3232 3233 /** 3234 * JSON Object Constructor 3235 * @param jo A Json-Object having data about an instance of {@code 'FontVariationAxis'}. 3236 */ 3237 public FontVariationAxis (JsonObject jo) 3238 { 3239 this.tag = ReadJSON.getString(jo, "tag", false, true); 3240 this.name = ReadJSON.getString(jo, "name", false, true); 3241 this.minValue = ReadNumberJSON.get(jo, "minValue", false, true); 3242 this.maxValue = ReadNumberJSON.get(jo, "maxValue", false, true); 3243 this.defaultValue = ReadNumberJSON.get(jo, "defaultValue", false, true); 3244 } 3245 3246 3247 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3248 public boolean equals(Object other) 3249 { 3250 if (this == other) return true; 3251 if (other == null) return false; 3252 if (other.getClass() != this.getClass()) return false; 3253 3254 FontVariationAxis o = (FontVariationAxis) other; 3255 3256 return 3257 Objects.equals(this.tag, o.tag) 3258 && Objects.equals(this.name, o.name) 3259 && Objects.equals(this.minValue, o.minValue) 3260 && Objects.equals(this.maxValue, o.maxValue) 3261 && Objects.equals(this.defaultValue, o.defaultValue); 3262 } 3263 3264 /** Generates a Hash-Code for {@code 'this'} instance */ 3265 public int hashCode() 3266 { 3267 return 3268 Objects.hashCode(this.tag) 3269 + Objects.hashCode(this.name) 3270 + Objects.hashCode(this.minValue) 3271 + Objects.hashCode(this.maxValue) 3272 + Objects.hashCode(this.defaultValue); 3273 } 3274 } 3275 3276 /** 3277 * Properties of a web font: https://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#font-descriptions 3278 * and additional information such as platformFontFamily and fontVariationAxes. 3279 */ 3280 public static class FontFace 3281 extends BaseType 3282 implements java.io.Serializable 3283 { 3284 /** For Object Serialization. java.io.Serializable */ 3285 protected static final long serialVersionUID = 1; 3286 3287 public boolean[] optionals() 3288 { return new boolean[] { false, false, false, false, false, false, false, false, false, true, }; } 3289 3290 /** The font-family. */ 3291 public final String fontFamily; 3292 3293 /** The font-style. */ 3294 public final String fontStyle; 3295 3296 /** The font-variant. */ 3297 public final String fontVariant; 3298 3299 /** The font-weight. */ 3300 public final String fontWeight; 3301 3302 /** The font-stretch. */ 3303 public final String fontStretch; 3304 3305 /** The font-display. */ 3306 public final String fontDisplay; 3307 3308 /** The unicode-range. */ 3309 public final String unicodeRange; 3310 3311 /** The src. */ 3312 public final String src; 3313 3314 /** The resolved platform font family */ 3315 public final String platformFontFamily; 3316 3317 /** 3318 * Available variation settings (a.k.a. "axes"). 3319 * <BR /><B CLASS=Opt>OPTIONAL</B> 3320 */ 3321 public final CSS.FontVariationAxis[] fontVariationAxes; 3322 3323 /** 3324 * Constructor 3325 * 3326 * @param fontFamily The font-family. 3327 * 3328 * @param fontStyle The font-style. 3329 * 3330 * @param fontVariant The font-variant. 3331 * 3332 * @param fontWeight The font-weight. 3333 * 3334 * @param fontStretch The font-stretch. 3335 * 3336 * @param fontDisplay The font-display. 3337 * 3338 * @param unicodeRange The unicode-range. 3339 * 3340 * @param src The src. 3341 * 3342 * @param platformFontFamily The resolved platform font family 3343 * 3344 * @param fontVariationAxes Available variation settings (a.k.a. "axes"). 3345 * <BR /><B CLASS=Opt>OPTIONAL</B> 3346 */ 3347 public FontFace( 3348 String fontFamily, String fontStyle, String fontVariant, String fontWeight, 3349 String fontStretch, String fontDisplay, String unicodeRange, String src, 3350 String platformFontFamily, CSS.FontVariationAxis[] fontVariationAxes 3351 ) 3352 { 3353 // Exception-Check(s) to ensure that if any parameters which are not declared as 3354 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3355 3356 if (fontFamily == null) THROWS.throwNPE("fontFamily"); 3357 if (fontStyle == null) THROWS.throwNPE("fontStyle"); 3358 if (fontVariant == null) THROWS.throwNPE("fontVariant"); 3359 if (fontWeight == null) THROWS.throwNPE("fontWeight"); 3360 if (fontStretch == null) THROWS.throwNPE("fontStretch"); 3361 if (fontDisplay == null) THROWS.throwNPE("fontDisplay"); 3362 if (unicodeRange == null) THROWS.throwNPE("unicodeRange"); 3363 if (src == null) THROWS.throwNPE("src"); 3364 if (platformFontFamily == null) THROWS.throwNPE("platformFontFamily"); 3365 3366 this.fontFamily = fontFamily; 3367 this.fontStyle = fontStyle; 3368 this.fontVariant = fontVariant; 3369 this.fontWeight = fontWeight; 3370 this.fontStretch = fontStretch; 3371 this.fontDisplay = fontDisplay; 3372 this.unicodeRange = unicodeRange; 3373 this.src = src; 3374 this.platformFontFamily = platformFontFamily; 3375 this.fontVariationAxes = fontVariationAxes; 3376 } 3377 3378 /** 3379 * JSON Object Constructor 3380 * @param jo A Json-Object having data about an instance of {@code 'FontFace'}. 3381 */ 3382 public FontFace (JsonObject jo) 3383 { 3384 this.fontFamily = ReadJSON.getString(jo, "fontFamily", false, true); 3385 this.fontStyle = ReadJSON.getString(jo, "fontStyle", false, true); 3386 this.fontVariant = ReadJSON.getString(jo, "fontVariant", false, true); 3387 this.fontWeight = ReadJSON.getString(jo, "fontWeight", false, true); 3388 this.fontStretch = ReadJSON.getString(jo, "fontStretch", false, true); 3389 this.fontDisplay = ReadJSON.getString(jo, "fontDisplay", false, true); 3390 this.unicodeRange = ReadJSON.getString(jo, "unicodeRange", false, true); 3391 this.src = ReadJSON.getString(jo, "src", false, true); 3392 this.platformFontFamily = ReadJSON.getString(jo, "platformFontFamily", false, true); 3393 this.fontVariationAxes = (jo.getJsonArray("fontVariationAxes") == null) 3394 ? null 3395 : RJArrIntoStream.objArr(jo.getJsonArray("fontVariationAxes"), null, 0, CSS.FontVariationAxis.class).toArray(CSS.FontVariationAxis[]::new); 3396 3397 } 3398 3399 3400 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3401 public boolean equals(Object other) 3402 { 3403 if (this == other) return true; 3404 if (other == null) return false; 3405 if (other.getClass() != this.getClass()) return false; 3406 3407 FontFace o = (FontFace) other; 3408 3409 return 3410 Objects.equals(this.fontFamily, o.fontFamily) 3411 && Objects.equals(this.fontStyle, o.fontStyle) 3412 && Objects.equals(this.fontVariant, o.fontVariant) 3413 && Objects.equals(this.fontWeight, o.fontWeight) 3414 && Objects.equals(this.fontStretch, o.fontStretch) 3415 && Objects.equals(this.fontDisplay, o.fontDisplay) 3416 && Objects.equals(this.unicodeRange, o.unicodeRange) 3417 && Objects.equals(this.src, o.src) 3418 && Objects.equals(this.platformFontFamily, o.platformFontFamily) 3419 && Arrays.deepEquals(this.fontVariationAxes, o.fontVariationAxes); 3420 } 3421 3422 /** Generates a Hash-Code for {@code 'this'} instance */ 3423 public int hashCode() 3424 { 3425 return 3426 Objects.hashCode(this.fontFamily) 3427 + Objects.hashCode(this.fontStyle) 3428 + Objects.hashCode(this.fontVariant) 3429 + Objects.hashCode(this.fontWeight) 3430 + Objects.hashCode(this.fontStretch) 3431 + Objects.hashCode(this.fontDisplay) 3432 + Objects.hashCode(this.unicodeRange) 3433 + Objects.hashCode(this.src) 3434 + Objects.hashCode(this.platformFontFamily) 3435 + Arrays.deepHashCode(this.fontVariationAxes); 3436 } 3437 } 3438 3439 /** CSS try rule representation. */ 3440 public static class CSSTryRule 3441 extends BaseType 3442 implements java.io.Serializable 3443 { 3444 /** For Object Serialization. java.io.Serializable */ 3445 protected static final long serialVersionUID = 1; 3446 3447 public boolean[] optionals() 3448 { return new boolean[] { true, false, false, }; } 3449 3450 /** 3451 * The css style sheet identifier (absent for user agent stylesheet and user-specified 3452 * stylesheet rules) this rule came from. 3453 * <BR /><B CLASS=Opt>OPTIONAL</B> 3454 */ 3455 public final String styleSheetId; 3456 3457 /** Parent stylesheet's origin. */ 3458 public final String origin; 3459 3460 /** Associated style declaration. */ 3461 public final CSS.CSSStyle style; 3462 3463 /** 3464 * Constructor 3465 * 3466 * @param styleSheetId 3467 * The css style sheet identifier (absent for user agent stylesheet and user-specified 3468 * stylesheet rules) this rule came from. 3469 * <BR /><B CLASS=Opt>OPTIONAL</B> 3470 * 3471 * @param origin Parent stylesheet's origin. 3472 * 3473 * @param style Associated style declaration. 3474 */ 3475 public CSSTryRule(String styleSheetId, String origin, CSS.CSSStyle style) 3476 { 3477 // Exception-Check(s) to ensure that if any parameters which are not declared as 3478 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3479 3480 if (origin == null) THROWS.throwNPE("origin"); 3481 if (style == null) THROWS.throwNPE("style"); 3482 3483 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3484 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3485 3486 THROWS.checkIAE("origin", origin, "CSS.StyleSheetOrigin", CSS.StyleSheetOrigin); 3487 3488 this.styleSheetId = styleSheetId; 3489 this.origin = origin; 3490 this.style = style; 3491 } 3492 3493 /** 3494 * JSON Object Constructor 3495 * @param jo A Json-Object having data about an instance of {@code 'CSSTryRule'}. 3496 */ 3497 public CSSTryRule (JsonObject jo) 3498 { 3499 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", true, false); 3500 this.origin = ReadJSON.getString(jo, "origin", false, true); 3501 this.style = ReadJSON.getObject(jo, "style", CSS.CSSStyle.class, false, true); 3502 } 3503 3504 3505 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3506 public boolean equals(Object other) 3507 { 3508 if (this == other) return true; 3509 if (other == null) return false; 3510 if (other.getClass() != this.getClass()) return false; 3511 3512 CSSTryRule o = (CSSTryRule) other; 3513 3514 return 3515 Objects.equals(this.styleSheetId, o.styleSheetId) 3516 && Objects.equals(this.origin, o.origin) 3517 && Objects.equals(this.style, o.style); 3518 } 3519 3520 /** Generates a Hash-Code for {@code 'this'} instance */ 3521 public int hashCode() 3522 { 3523 return 3524 Objects.hashCode(this.styleSheetId) 3525 + Objects.hashCode(this.origin) 3526 + this.style.hashCode(); 3527 } 3528 } 3529 3530 /** CSS @position-try rule representation. */ 3531 public static class CSSPositionTryRule 3532 extends BaseType 3533 implements java.io.Serializable 3534 { 3535 /** For Object Serialization. java.io.Serializable */ 3536 protected static final long serialVersionUID = 1; 3537 3538 public boolean[] optionals() 3539 { return new boolean[] { false, true, false, false, false, }; } 3540 3541 /** The prelude dashed-ident name */ 3542 public final CSS.Value name; 3543 3544 /** 3545 * The css style sheet identifier (absent for user agent stylesheet and user-specified 3546 * stylesheet rules) this rule came from. 3547 * <BR /><B CLASS=Opt>OPTIONAL</B> 3548 */ 3549 public final String styleSheetId; 3550 3551 /** Parent stylesheet's origin. */ 3552 public final String origin; 3553 3554 /** Associated style declaration. */ 3555 public final CSS.CSSStyle style; 3556 3557 /** <CODE>[No Description Provided by Google]</CODE> */ 3558 public final boolean active; 3559 3560 /** 3561 * Constructor 3562 * 3563 * @param name The prelude dashed-ident name 3564 * 3565 * @param styleSheetId 3566 * The css style sheet identifier (absent for user agent stylesheet and user-specified 3567 * stylesheet rules) this rule came from. 3568 * <BR /><B CLASS=Opt>OPTIONAL</B> 3569 * 3570 * @param origin Parent stylesheet's origin. 3571 * 3572 * @param style Associated style declaration. 3573 * 3574 * @param active - 3575 */ 3576 public CSSPositionTryRule 3577 (CSS.Value name, String styleSheetId, String origin, CSS.CSSStyle style, boolean active) 3578 { 3579 // Exception-Check(s) to ensure that if any parameters which are not declared as 3580 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3581 3582 if (name == null) THROWS.throwNPE("name"); 3583 if (origin == null) THROWS.throwNPE("origin"); 3584 if (style == null) THROWS.throwNPE("style"); 3585 3586 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3587 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3588 3589 THROWS.checkIAE("origin", origin, "CSS.StyleSheetOrigin", CSS.StyleSheetOrigin); 3590 3591 this.name = name; 3592 this.styleSheetId = styleSheetId; 3593 this.origin = origin; 3594 this.style = style; 3595 this.active = active; 3596 } 3597 3598 /** 3599 * JSON Object Constructor 3600 * @param jo A Json-Object having data about an instance of {@code 'CSSPositionTryRule'}. 3601 */ 3602 public CSSPositionTryRule (JsonObject jo) 3603 { 3604 this.name = ReadJSON.getObject(jo, "name", CSS.Value.class, false, true); 3605 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", true, false); 3606 this.origin = ReadJSON.getString(jo, "origin", false, true); 3607 this.style = ReadJSON.getObject(jo, "style", CSS.CSSStyle.class, false, true); 3608 this.active = ReadPrimJSON.getBoolean(jo, "active"); 3609 } 3610 3611 3612 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3613 public boolean equals(Object other) 3614 { 3615 if (this == other) return true; 3616 if (other == null) return false; 3617 if (other.getClass() != this.getClass()) return false; 3618 3619 CSSPositionTryRule o = (CSSPositionTryRule) other; 3620 3621 return 3622 Objects.equals(this.name, o.name) 3623 && Objects.equals(this.styleSheetId, o.styleSheetId) 3624 && Objects.equals(this.origin, o.origin) 3625 && Objects.equals(this.style, o.style) 3626 && (this.active == o.active); 3627 } 3628 3629 /** Generates a Hash-Code for {@code 'this'} instance */ 3630 public int hashCode() 3631 { 3632 return 3633 this.name.hashCode() 3634 + Objects.hashCode(this.styleSheetId) 3635 + Objects.hashCode(this.origin) 3636 + this.style.hashCode() 3637 + (this.active ? 1 : 0); 3638 } 3639 } 3640 3641 /** CSS keyframes rule representation. */ 3642 public static class CSSKeyframesRule 3643 extends BaseType 3644 implements java.io.Serializable 3645 { 3646 /** For Object Serialization. java.io.Serializable */ 3647 protected static final long serialVersionUID = 1; 3648 3649 public boolean[] optionals() 3650 { return new boolean[] { false, false, }; } 3651 3652 /** Animation name. */ 3653 public final CSS.Value animationName; 3654 3655 /** List of keyframes. */ 3656 public final CSS.CSSKeyframeRule[] keyframes; 3657 3658 /** 3659 * Constructor 3660 * 3661 * @param animationName Animation name. 3662 * 3663 * @param keyframes List of keyframes. 3664 */ 3665 public CSSKeyframesRule(CSS.Value animationName, CSS.CSSKeyframeRule[] keyframes) 3666 { 3667 // Exception-Check(s) to ensure that if any parameters which are not declared as 3668 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3669 3670 if (animationName == null) THROWS.throwNPE("animationName"); 3671 if (keyframes == null) THROWS.throwNPE("keyframes"); 3672 3673 this.animationName = animationName; 3674 this.keyframes = keyframes; 3675 } 3676 3677 /** 3678 * JSON Object Constructor 3679 * @param jo A Json-Object having data about an instance of {@code 'CSSKeyframesRule'}. 3680 */ 3681 public CSSKeyframesRule (JsonObject jo) 3682 { 3683 this.animationName = ReadJSON.getObject(jo, "animationName", CSS.Value.class, false, true); 3684 this.keyframes = (jo.getJsonArray("keyframes") == null) 3685 ? null 3686 : RJArrIntoStream.objArr(jo.getJsonArray("keyframes"), null, 0, CSS.CSSKeyframeRule.class).toArray(CSS.CSSKeyframeRule[]::new); 3687 3688 } 3689 3690 3691 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3692 public boolean equals(Object other) 3693 { 3694 if (this == other) return true; 3695 if (other == null) return false; 3696 if (other.getClass() != this.getClass()) return false; 3697 3698 CSSKeyframesRule o = (CSSKeyframesRule) other; 3699 3700 return 3701 Objects.equals(this.animationName, o.animationName) 3702 && Arrays.deepEquals(this.keyframes, o.keyframes); 3703 } 3704 3705 /** Generates a Hash-Code for {@code 'this'} instance */ 3706 public int hashCode() 3707 { 3708 return 3709 this.animationName.hashCode() 3710 + Arrays.deepHashCode(this.keyframes); 3711 } 3712 } 3713 3714 /** Representation of a custom property registration through CSS.registerProperty */ 3715 public static class CSSPropertyRegistration 3716 extends BaseType 3717 implements java.io.Serializable 3718 { 3719 /** For Object Serialization. java.io.Serializable */ 3720 protected static final long serialVersionUID = 1; 3721 3722 public boolean[] optionals() 3723 { return new boolean[] { false, true, false, false, }; } 3724 3725 /** <CODE>[No Description Provided by Google]</CODE> */ 3726 public final String propertyName; 3727 3728 /** 3729 * <CODE>[No Description Provided by Google]</CODE> 3730 * <BR /><B CLASS=Opt>OPTIONAL</B> 3731 */ 3732 public final CSS.Value initialValue; 3733 3734 /** <CODE>[No Description Provided by Google]</CODE> */ 3735 public final boolean inherits; 3736 3737 /** <CODE>[No Description Provided by Google]</CODE> */ 3738 public final String syntax; 3739 3740 /** 3741 * Constructor 3742 * 3743 * @param propertyName - 3744 * 3745 * @param initialValue - 3746 * <BR /><B CLASS=Opt>OPTIONAL</B> 3747 * 3748 * @param inherits - 3749 * 3750 * @param syntax - 3751 */ 3752 public CSSPropertyRegistration 3753 (String propertyName, CSS.Value initialValue, boolean inherits, String syntax) 3754 { 3755 // Exception-Check(s) to ensure that if any parameters which are not declared as 3756 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3757 3758 if (propertyName == null) THROWS.throwNPE("propertyName"); 3759 if (syntax == null) THROWS.throwNPE("syntax"); 3760 3761 this.propertyName = propertyName; 3762 this.initialValue = initialValue; 3763 this.inherits = inherits; 3764 this.syntax = syntax; 3765 } 3766 3767 /** 3768 * JSON Object Constructor 3769 * @param jo A Json-Object having data about an instance of {@code 'CSSPropertyRegistration'}. 3770 */ 3771 public CSSPropertyRegistration (JsonObject jo) 3772 { 3773 this.propertyName = ReadJSON.getString(jo, "propertyName", false, true); 3774 this.initialValue = ReadJSON.getObject(jo, "initialValue", CSS.Value.class, true, false); 3775 this.inherits = ReadPrimJSON.getBoolean(jo, "inherits"); 3776 this.syntax = ReadJSON.getString(jo, "syntax", false, true); 3777 } 3778 3779 3780 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3781 public boolean equals(Object other) 3782 { 3783 if (this == other) return true; 3784 if (other == null) return false; 3785 if (other.getClass() != this.getClass()) return false; 3786 3787 CSSPropertyRegistration o = (CSSPropertyRegistration) other; 3788 3789 return 3790 Objects.equals(this.propertyName, o.propertyName) 3791 && Objects.equals(this.initialValue, o.initialValue) 3792 && (this.inherits == o.inherits) 3793 && Objects.equals(this.syntax, o.syntax); 3794 } 3795 3796 /** Generates a Hash-Code for {@code 'this'} instance */ 3797 public int hashCode() 3798 { 3799 return 3800 Objects.hashCode(this.propertyName) 3801 + this.initialValue.hashCode() 3802 + (this.inherits ? 1 : 0) 3803 + Objects.hashCode(this.syntax); 3804 } 3805 } 3806 3807 /** CSS font-palette-values rule representation. */ 3808 public static class CSSFontPaletteValuesRule 3809 extends BaseType 3810 implements java.io.Serializable 3811 { 3812 /** For Object Serialization. java.io.Serializable */ 3813 protected static final long serialVersionUID = 1; 3814 3815 public boolean[] optionals() 3816 { return new boolean[] { true, false, false, false, }; } 3817 3818 /** 3819 * The css style sheet identifier (absent for user agent stylesheet and user-specified 3820 * stylesheet rules) this rule came from. 3821 * <BR /><B CLASS=Opt>OPTIONAL</B> 3822 */ 3823 public final String styleSheetId; 3824 3825 /** Parent stylesheet's origin. */ 3826 public final String origin; 3827 3828 /** Associated font palette name. */ 3829 public final CSS.Value fontPaletteName; 3830 3831 /** Associated style declaration. */ 3832 public final CSS.CSSStyle style; 3833 3834 /** 3835 * Constructor 3836 * 3837 * @param styleSheetId 3838 * The css style sheet identifier (absent for user agent stylesheet and user-specified 3839 * stylesheet rules) this rule came from. 3840 * <BR /><B CLASS=Opt>OPTIONAL</B> 3841 * 3842 * @param origin Parent stylesheet's origin. 3843 * 3844 * @param fontPaletteName Associated font palette name. 3845 * 3846 * @param style Associated style declaration. 3847 */ 3848 public CSSFontPaletteValuesRule 3849 (String styleSheetId, String origin, CSS.Value fontPaletteName, CSS.CSSStyle style) 3850 { 3851 // Exception-Check(s) to ensure that if any parameters which are not declared as 3852 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3853 3854 if (origin == null) THROWS.throwNPE("origin"); 3855 if (fontPaletteName == null) THROWS.throwNPE("fontPaletteName"); 3856 if (style == null) THROWS.throwNPE("style"); 3857 3858 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3859 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3860 3861 THROWS.checkIAE("origin", origin, "CSS.StyleSheetOrigin", CSS.StyleSheetOrigin); 3862 3863 this.styleSheetId = styleSheetId; 3864 this.origin = origin; 3865 this.fontPaletteName = fontPaletteName; 3866 this.style = style; 3867 } 3868 3869 /** 3870 * JSON Object Constructor 3871 * @param jo A Json-Object having data about an instance of {@code 'CSSFontPaletteValuesRule'}. 3872 */ 3873 public CSSFontPaletteValuesRule (JsonObject jo) 3874 { 3875 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", true, false); 3876 this.origin = ReadJSON.getString(jo, "origin", false, true); 3877 this.fontPaletteName = ReadJSON.getObject(jo, "fontPaletteName", CSS.Value.class, false, true); 3878 this.style = ReadJSON.getObject(jo, "style", CSS.CSSStyle.class, false, true); 3879 } 3880 3881 3882 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3883 public boolean equals(Object other) 3884 { 3885 if (this == other) return true; 3886 if (other == null) return false; 3887 if (other.getClass() != this.getClass()) return false; 3888 3889 CSSFontPaletteValuesRule o = (CSSFontPaletteValuesRule) other; 3890 3891 return 3892 Objects.equals(this.styleSheetId, o.styleSheetId) 3893 && Objects.equals(this.origin, o.origin) 3894 && Objects.equals(this.fontPaletteName, o.fontPaletteName) 3895 && Objects.equals(this.style, o.style); 3896 } 3897 3898 /** Generates a Hash-Code for {@code 'this'} instance */ 3899 public int hashCode() 3900 { 3901 return 3902 Objects.hashCode(this.styleSheetId) 3903 + Objects.hashCode(this.origin) 3904 + this.fontPaletteName.hashCode() 3905 + this.style.hashCode(); 3906 } 3907 } 3908 3909 /** CSS property at-rule representation. */ 3910 public static class CSSPropertyRule 3911 extends BaseType 3912 implements java.io.Serializable 3913 { 3914 /** For Object Serialization. java.io.Serializable */ 3915 protected static final long serialVersionUID = 1; 3916 3917 public boolean[] optionals() 3918 { return new boolean[] { true, false, false, false, }; } 3919 3920 /** 3921 * The css style sheet identifier (absent for user agent stylesheet and user-specified 3922 * stylesheet rules) this rule came from. 3923 * <BR /><B CLASS=Opt>OPTIONAL</B> 3924 */ 3925 public final String styleSheetId; 3926 3927 /** Parent stylesheet's origin. */ 3928 public final String origin; 3929 3930 /** Associated property name. */ 3931 public final CSS.Value propertyName; 3932 3933 /** Associated style declaration. */ 3934 public final CSS.CSSStyle style; 3935 3936 /** 3937 * Constructor 3938 * 3939 * @param styleSheetId 3940 * The css style sheet identifier (absent for user agent stylesheet and user-specified 3941 * stylesheet rules) this rule came from. 3942 * <BR /><B CLASS=Opt>OPTIONAL</B> 3943 * 3944 * @param origin Parent stylesheet's origin. 3945 * 3946 * @param propertyName Associated property name. 3947 * 3948 * @param style Associated style declaration. 3949 */ 3950 public CSSPropertyRule 3951 (String styleSheetId, String origin, CSS.Value propertyName, CSS.CSSStyle style) 3952 { 3953 // Exception-Check(s) to ensure that if any parameters which are not declared as 3954 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 3955 3956 if (origin == null) THROWS.throwNPE("origin"); 3957 if (propertyName == null) THROWS.throwNPE("propertyName"); 3958 if (style == null) THROWS.throwNPE("style"); 3959 3960 // Exception-Check(s) to ensure that if any parameters which must adhere to a 3961 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 3962 3963 THROWS.checkIAE("origin", origin, "CSS.StyleSheetOrigin", CSS.StyleSheetOrigin); 3964 3965 this.styleSheetId = styleSheetId; 3966 this.origin = origin; 3967 this.propertyName = propertyName; 3968 this.style = style; 3969 } 3970 3971 /** 3972 * JSON Object Constructor 3973 * @param jo A Json-Object having data about an instance of {@code 'CSSPropertyRule'}. 3974 */ 3975 public CSSPropertyRule (JsonObject jo) 3976 { 3977 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", true, false); 3978 this.origin = ReadJSON.getString(jo, "origin", false, true); 3979 this.propertyName = ReadJSON.getObject(jo, "propertyName", CSS.Value.class, false, true); 3980 this.style = ReadJSON.getObject(jo, "style", CSS.CSSStyle.class, false, true); 3981 } 3982 3983 3984 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 3985 public boolean equals(Object other) 3986 { 3987 if (this == other) return true; 3988 if (other == null) return false; 3989 if (other.getClass() != this.getClass()) return false; 3990 3991 CSSPropertyRule o = (CSSPropertyRule) other; 3992 3993 return 3994 Objects.equals(this.styleSheetId, o.styleSheetId) 3995 && Objects.equals(this.origin, o.origin) 3996 && Objects.equals(this.propertyName, o.propertyName) 3997 && Objects.equals(this.style, o.style); 3998 } 3999 4000 /** Generates a Hash-Code for {@code 'this'} instance */ 4001 public int hashCode() 4002 { 4003 return 4004 Objects.hashCode(this.styleSheetId) 4005 + Objects.hashCode(this.origin) 4006 + this.propertyName.hashCode() 4007 + this.style.hashCode(); 4008 } 4009 } 4010 4011 /** CSS function argument representation. */ 4012 public static class CSSFunctionParameter 4013 extends BaseType 4014 implements java.io.Serializable 4015 { 4016 /** For Object Serialization. java.io.Serializable */ 4017 protected static final long serialVersionUID = 1; 4018 4019 public boolean[] optionals() 4020 { return new boolean[] { false, false, }; } 4021 4022 /** The parameter name. */ 4023 public final String name; 4024 4025 /** The parameter type. */ 4026 public final String type; 4027 4028 /** 4029 * Constructor 4030 * 4031 * @param name The parameter name. 4032 * 4033 * @param type The parameter type. 4034 */ 4035 public CSSFunctionParameter(String name, String type) 4036 { 4037 // Exception-Check(s) to ensure that if any parameters which are not declared as 4038 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4039 4040 if (name == null) THROWS.throwNPE("name"); 4041 if (type == null) THROWS.throwNPE("type"); 4042 4043 this.name = name; 4044 this.type = type; 4045 } 4046 4047 /** 4048 * JSON Object Constructor 4049 * @param jo A Json-Object having data about an instance of {@code 'CSSFunctionParameter'}. 4050 */ 4051 public CSSFunctionParameter (JsonObject jo) 4052 { 4053 this.name = ReadJSON.getString(jo, "name", false, true); 4054 this.type = ReadJSON.getString(jo, "type", false, true); 4055 } 4056 4057 4058 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4059 public boolean equals(Object other) 4060 { 4061 if (this == other) return true; 4062 if (other == null) return false; 4063 if (other.getClass() != this.getClass()) return false; 4064 4065 CSSFunctionParameter o = (CSSFunctionParameter) other; 4066 4067 return 4068 Objects.equals(this.name, o.name) 4069 && Objects.equals(this.type, o.type); 4070 } 4071 4072 /** Generates a Hash-Code for {@code 'this'} instance */ 4073 public int hashCode() 4074 { 4075 return 4076 Objects.hashCode(this.name) 4077 + Objects.hashCode(this.type); 4078 } 4079 } 4080 4081 /** CSS function conditional block representation. */ 4082 public static class CSSFunctionConditionNode 4083 extends BaseType 4084 implements java.io.Serializable 4085 { 4086 /** For Object Serialization. java.io.Serializable */ 4087 protected static final long serialVersionUID = 1; 4088 4089 public boolean[] optionals() 4090 { return new boolean[] { true, true, true, false, false, }; } 4091 4092 /** 4093 * Media query for this conditional block. Only one type of condition should be set. 4094 * <BR /><B CLASS=Opt>OPTIONAL</B> 4095 */ 4096 public final CSS.CSSMedia media; 4097 4098 /** 4099 * Container query for this conditional block. Only one type of condition should be set. 4100 * <BR /><B CLASS=Opt>OPTIONAL</B> 4101 */ 4102 public final CSS.CSSContainerQuery containerQueries; 4103 4104 /** 4105 * @supports CSS at-rule condition. Only one type of condition should be set. 4106 * <BR /><B CLASS=Opt>OPTIONAL</B> 4107 */ 4108 public final CSS.CSSSupports supports; 4109 4110 /** Block body. */ 4111 public final CSS.CSSFunctionNode[] children; 4112 4113 /** The condition text. */ 4114 public final String conditionText; 4115 4116 /** 4117 * Constructor 4118 * 4119 * @param media Media query for this conditional block. Only one type of condition should be set. 4120 * <BR /><B CLASS=Opt>OPTIONAL</B> 4121 * 4122 * @param containerQueries Container query for this conditional block. Only one type of condition should be set. 4123 * <BR /><B CLASS=Opt>OPTIONAL</B> 4124 * 4125 * @param supports @supports CSS at-rule condition. Only one type of condition should be set. 4126 * <BR /><B CLASS=Opt>OPTIONAL</B> 4127 * 4128 * @param children Block body. 4129 * 4130 * @param conditionText The condition text. 4131 */ 4132 public CSSFunctionConditionNode( 4133 CSS.CSSMedia media, CSS.CSSContainerQuery containerQueries, 4134 CSS.CSSSupports supports, CSS.CSSFunctionNode[] children, String conditionText 4135 ) 4136 { 4137 // Exception-Check(s) to ensure that if any parameters which are not declared as 4138 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4139 4140 if (children == null) THROWS.throwNPE("children"); 4141 if (conditionText == null) THROWS.throwNPE("conditionText"); 4142 4143 this.media = media; 4144 this.containerQueries = containerQueries; 4145 this.supports = supports; 4146 this.children = children; 4147 this.conditionText = conditionText; 4148 } 4149 4150 /** 4151 * JSON Object Constructor 4152 * @param jo A Json-Object having data about an instance of {@code 'CSSFunctionConditionNode'}. 4153 */ 4154 public CSSFunctionConditionNode (JsonObject jo) 4155 { 4156 this.media = ReadJSON.getObject(jo, "media", CSS.CSSMedia.class, true, false); 4157 this.containerQueries = ReadJSON.getObject(jo, "containerQueries", CSS.CSSContainerQuery.class, true, false); 4158 this.supports = ReadJSON.getObject(jo, "supports", CSS.CSSSupports.class, true, false); 4159 this.children = (jo.getJsonArray("children") == null) 4160 ? null 4161 : RJArrIntoStream.objArr(jo.getJsonArray("children"), null, 0, CSS.CSSFunctionNode.class).toArray(CSS.CSSFunctionNode[]::new); 4162 4163 this.conditionText = ReadJSON.getString(jo, "conditionText", false, true); 4164 } 4165 4166 4167 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4168 public boolean equals(Object other) 4169 { 4170 if (this == other) return true; 4171 if (other == null) return false; 4172 if (other.getClass() != this.getClass()) return false; 4173 4174 CSSFunctionConditionNode o = (CSSFunctionConditionNode) other; 4175 4176 return 4177 Objects.equals(this.media, o.media) 4178 && Objects.equals(this.containerQueries, o.containerQueries) 4179 && Objects.equals(this.supports, o.supports) 4180 && Arrays.deepEquals(this.children, o.children) 4181 && Objects.equals(this.conditionText, o.conditionText); 4182 } 4183 4184 /** Generates a Hash-Code for {@code 'this'} instance */ 4185 public int hashCode() 4186 { 4187 return 4188 this.media.hashCode() 4189 + this.containerQueries.hashCode() 4190 + this.supports.hashCode() 4191 + Arrays.deepHashCode(this.children) 4192 + Objects.hashCode(this.conditionText); 4193 } 4194 } 4195 4196 /** Section of the body of a CSS function rule. */ 4197 public static class CSSFunctionNode 4198 extends BaseType 4199 implements java.io.Serializable 4200 { 4201 /** For Object Serialization. java.io.Serializable */ 4202 protected static final long serialVersionUID = 1; 4203 4204 public boolean[] optionals() 4205 { return new boolean[] { true, true, }; } 4206 4207 /** 4208 * A conditional block. If set, style should not be set. 4209 * <BR /><B CLASS=Opt>OPTIONAL</B> 4210 */ 4211 public final CSS.CSSFunctionConditionNode condition; 4212 4213 /** 4214 * Values set by this node. If set, condition should not be set. 4215 * <BR /><B CLASS=Opt>OPTIONAL</B> 4216 */ 4217 public final CSS.CSSStyle style; 4218 4219 /** 4220 * Constructor 4221 * 4222 * @param condition A conditional block. If set, style should not be set. 4223 * <BR /><B CLASS=Opt>OPTIONAL</B> 4224 * 4225 * @param style Values set by this node. If set, condition should not be set. 4226 * <BR /><B CLASS=Opt>OPTIONAL</B> 4227 */ 4228 public CSSFunctionNode(CSS.CSSFunctionConditionNode condition, CSS.CSSStyle style) 4229 { 4230 this.condition = condition; 4231 this.style = style; 4232 } 4233 4234 /** 4235 * JSON Object Constructor 4236 * @param jo A Json-Object having data about an instance of {@code 'CSSFunctionNode'}. 4237 */ 4238 public CSSFunctionNode (JsonObject jo) 4239 { 4240 this.condition = ReadJSON.getObject(jo, "condition", CSS.CSSFunctionConditionNode.class, true, false); 4241 this.style = ReadJSON.getObject(jo, "style", CSS.CSSStyle.class, true, false); 4242 } 4243 4244 4245 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4246 public boolean equals(Object other) 4247 { 4248 if (this == other) return true; 4249 if (other == null) return false; 4250 if (other.getClass() != this.getClass()) return false; 4251 4252 CSSFunctionNode o = (CSSFunctionNode) other; 4253 4254 return 4255 Objects.equals(this.condition, o.condition) 4256 && Objects.equals(this.style, o.style); 4257 } 4258 4259 /** Generates a Hash-Code for {@code 'this'} instance */ 4260 public int hashCode() 4261 { 4262 return 4263 this.condition.hashCode() 4264 + this.style.hashCode(); 4265 } 4266 } 4267 4268 /** CSS function at-rule representation. */ 4269 public static class CSSFunctionRule 4270 extends BaseType 4271 implements java.io.Serializable 4272 { 4273 /** For Object Serialization. java.io.Serializable */ 4274 protected static final long serialVersionUID = 1; 4275 4276 public boolean[] optionals() 4277 { return new boolean[] { false, true, false, false, false, }; } 4278 4279 /** Name of the function. */ 4280 public final CSS.Value name; 4281 4282 /** 4283 * The css style sheet identifier (absent for user agent stylesheet and user-specified 4284 * stylesheet rules) this rule came from. 4285 * <BR /><B CLASS=Opt>OPTIONAL</B> 4286 */ 4287 public final String styleSheetId; 4288 4289 /** Parent stylesheet's origin. */ 4290 public final String origin; 4291 4292 /** List of parameters. */ 4293 public final CSS.CSSFunctionParameter[] parameters; 4294 4295 /** Function body. */ 4296 public final CSS.CSSFunctionNode[] children; 4297 4298 /** 4299 * Constructor 4300 * 4301 * @param name Name of the function. 4302 * 4303 * @param styleSheetId 4304 * The css style sheet identifier (absent for user agent stylesheet and user-specified 4305 * stylesheet rules) this rule came from. 4306 * <BR /><B CLASS=Opt>OPTIONAL</B> 4307 * 4308 * @param origin Parent stylesheet's origin. 4309 * 4310 * @param parameters List of parameters. 4311 * 4312 * @param children Function body. 4313 */ 4314 public CSSFunctionRule( 4315 CSS.Value name, String styleSheetId, String origin, 4316 CSS.CSSFunctionParameter[] parameters, CSS.CSSFunctionNode[] children 4317 ) 4318 { 4319 // Exception-Check(s) to ensure that if any parameters which are not declared as 4320 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4321 4322 if (name == null) THROWS.throwNPE("name"); 4323 if (origin == null) THROWS.throwNPE("origin"); 4324 if (parameters == null) THROWS.throwNPE("parameters"); 4325 if (children == null) THROWS.throwNPE("children"); 4326 4327 // Exception-Check(s) to ensure that if any parameters which must adhere to a 4328 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 4329 4330 THROWS.checkIAE("origin", origin, "CSS.StyleSheetOrigin", CSS.StyleSheetOrigin); 4331 4332 this.name = name; 4333 this.styleSheetId = styleSheetId; 4334 this.origin = origin; 4335 this.parameters = parameters; 4336 this.children = children; 4337 } 4338 4339 /** 4340 * JSON Object Constructor 4341 * @param jo A Json-Object having data about an instance of {@code 'CSSFunctionRule'}. 4342 */ 4343 public CSSFunctionRule (JsonObject jo) 4344 { 4345 this.name = ReadJSON.getObject(jo, "name", CSS.Value.class, false, true); 4346 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", true, false); 4347 this.origin = ReadJSON.getString(jo, "origin", false, true); 4348 this.parameters = (jo.getJsonArray("parameters") == null) 4349 ? null 4350 : RJArrIntoStream.objArr(jo.getJsonArray("parameters"), null, 0, CSS.CSSFunctionParameter.class).toArray(CSS.CSSFunctionParameter[]::new); 4351 4352 this.children = (jo.getJsonArray("children") == null) 4353 ? null 4354 : RJArrIntoStream.objArr(jo.getJsonArray("children"), null, 0, CSS.CSSFunctionNode.class).toArray(CSS.CSSFunctionNode[]::new); 4355 4356 } 4357 4358 4359 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4360 public boolean equals(Object other) 4361 { 4362 if (this == other) return true; 4363 if (other == null) return false; 4364 if (other.getClass() != this.getClass()) return false; 4365 4366 CSSFunctionRule o = (CSSFunctionRule) other; 4367 4368 return 4369 Objects.equals(this.name, o.name) 4370 && Objects.equals(this.styleSheetId, o.styleSheetId) 4371 && Objects.equals(this.origin, o.origin) 4372 && Arrays.deepEquals(this.parameters, o.parameters) 4373 && Arrays.deepEquals(this.children, o.children); 4374 } 4375 4376 /** Generates a Hash-Code for {@code 'this'} instance */ 4377 public int hashCode() 4378 { 4379 return 4380 this.name.hashCode() 4381 + Objects.hashCode(this.styleSheetId) 4382 + Objects.hashCode(this.origin) 4383 + Arrays.deepHashCode(this.parameters) 4384 + Arrays.deepHashCode(this.children); 4385 } 4386 } 4387 4388 /** CSS keyframe rule representation. */ 4389 public static class CSSKeyframeRule 4390 extends BaseType 4391 implements java.io.Serializable 4392 { 4393 /** For Object Serialization. java.io.Serializable */ 4394 protected static final long serialVersionUID = 1; 4395 4396 public boolean[] optionals() 4397 { return new boolean[] { true, false, false, false, }; } 4398 4399 /** 4400 * The css style sheet identifier (absent for user agent stylesheet and user-specified 4401 * stylesheet rules) this rule came from. 4402 * <BR /><B CLASS=Opt>OPTIONAL</B> 4403 */ 4404 public final String styleSheetId; 4405 4406 /** Parent stylesheet's origin. */ 4407 public final String origin; 4408 4409 /** Associated key text. */ 4410 public final CSS.Value keyText; 4411 4412 /** Associated style declaration. */ 4413 public final CSS.CSSStyle style; 4414 4415 /** 4416 * Constructor 4417 * 4418 * @param styleSheetId 4419 * The css style sheet identifier (absent for user agent stylesheet and user-specified 4420 * stylesheet rules) this rule came from. 4421 * <BR /><B CLASS=Opt>OPTIONAL</B> 4422 * 4423 * @param origin Parent stylesheet's origin. 4424 * 4425 * @param keyText Associated key text. 4426 * 4427 * @param style Associated style declaration. 4428 */ 4429 public CSSKeyframeRule 4430 (String styleSheetId, String origin, CSS.Value keyText, CSS.CSSStyle style) 4431 { 4432 // Exception-Check(s) to ensure that if any parameters which are not declared as 4433 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4434 4435 if (origin == null) THROWS.throwNPE("origin"); 4436 if (keyText == null) THROWS.throwNPE("keyText"); 4437 if (style == null) THROWS.throwNPE("style"); 4438 4439 // Exception-Check(s) to ensure that if any parameters which must adhere to a 4440 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 4441 4442 THROWS.checkIAE("origin", origin, "CSS.StyleSheetOrigin", CSS.StyleSheetOrigin); 4443 4444 this.styleSheetId = styleSheetId; 4445 this.origin = origin; 4446 this.keyText = keyText; 4447 this.style = style; 4448 } 4449 4450 /** 4451 * JSON Object Constructor 4452 * @param jo A Json-Object having data about an instance of {@code 'CSSKeyframeRule'}. 4453 */ 4454 public CSSKeyframeRule (JsonObject jo) 4455 { 4456 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", true, false); 4457 this.origin = ReadJSON.getString(jo, "origin", false, true); 4458 this.keyText = ReadJSON.getObject(jo, "keyText", CSS.Value.class, false, true); 4459 this.style = ReadJSON.getObject(jo, "style", CSS.CSSStyle.class, false, true); 4460 } 4461 4462 4463 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4464 public boolean equals(Object other) 4465 { 4466 if (this == other) return true; 4467 if (other == null) return false; 4468 if (other.getClass() != this.getClass()) return false; 4469 4470 CSSKeyframeRule o = (CSSKeyframeRule) other; 4471 4472 return 4473 Objects.equals(this.styleSheetId, o.styleSheetId) 4474 && Objects.equals(this.origin, o.origin) 4475 && Objects.equals(this.keyText, o.keyText) 4476 && Objects.equals(this.style, o.style); 4477 } 4478 4479 /** Generates a Hash-Code for {@code 'this'} instance */ 4480 public int hashCode() 4481 { 4482 return 4483 Objects.hashCode(this.styleSheetId) 4484 + Objects.hashCode(this.origin) 4485 + this.keyText.hashCode() 4486 + this.style.hashCode(); 4487 } 4488 } 4489 4490 /** A descriptor of operation to mutate style declaration text. */ 4491 public static class StyleDeclarationEdit 4492 extends BaseType 4493 implements java.io.Serializable 4494 { 4495 /** For Object Serialization. java.io.Serializable */ 4496 protected static final long serialVersionUID = 1; 4497 4498 public boolean[] optionals() 4499 { return new boolean[] { false, false, false, }; } 4500 4501 /** The css style sheet identifier. */ 4502 public final String styleSheetId; 4503 4504 /** The range of the style text in the enclosing stylesheet. */ 4505 public final CSS.SourceRange range; 4506 4507 /** New style text. */ 4508 public final String text; 4509 4510 /** 4511 * Constructor 4512 * 4513 * @param styleSheetId The css style sheet identifier. 4514 * 4515 * @param range The range of the style text in the enclosing stylesheet. 4516 * 4517 * @param text New style text. 4518 */ 4519 public StyleDeclarationEdit(String styleSheetId, CSS.SourceRange range, String text) 4520 { 4521 // Exception-Check(s) to ensure that if any parameters which are not declared as 4522 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4523 4524 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 4525 if (range == null) THROWS.throwNPE("range"); 4526 if (text == null) THROWS.throwNPE("text"); 4527 4528 this.styleSheetId = styleSheetId; 4529 this.range = range; 4530 this.text = text; 4531 } 4532 4533 /** 4534 * JSON Object Constructor 4535 * @param jo A Json-Object having data about an instance of {@code 'StyleDeclarationEdit'}. 4536 */ 4537 public StyleDeclarationEdit (JsonObject jo) 4538 { 4539 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", false, true); 4540 this.range = ReadJSON.getObject(jo, "range", CSS.SourceRange.class, false, true); 4541 this.text = ReadJSON.getString(jo, "text", false, true); 4542 } 4543 4544 4545 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4546 public boolean equals(Object other) 4547 { 4548 if (this == other) return true; 4549 if (other == null) return false; 4550 if (other.getClass() != this.getClass()) return false; 4551 4552 StyleDeclarationEdit o = (StyleDeclarationEdit) other; 4553 4554 return 4555 Objects.equals(this.styleSheetId, o.styleSheetId) 4556 && Objects.equals(this.range, o.range) 4557 && Objects.equals(this.text, o.text); 4558 } 4559 4560 /** Generates a Hash-Code for {@code 'this'} instance */ 4561 public int hashCode() 4562 { 4563 return 4564 Objects.hashCode(this.styleSheetId) 4565 + this.range.hashCode() 4566 + Objects.hashCode(this.text); 4567 } 4568 } 4569 4570 /** 4571 * Fires whenever a MediaQuery result changes (for example, after a browser window has been 4572 * resized.) The current implementation considers only viewport-dependent media features. 4573 * 4574 * <BR /><BR />This is Marker-Event. Marker-Event's are Events that do not posses 4575 * any data, fields or state. When they are fired, only the event name is supplied. 4576 */ 4577 public static class mediaQueryResultChanged 4578 extends BrowserEvent 4579 implements java.io.Serializable 4580 { 4581 /** For Object Serialization. java.io.Serializable */ 4582 protected static final long serialVersionUID = 1; 4583 4584 public boolean[] optionals() { return new boolean[0]; } 4585 4586 /** JSON Object Constructor */ 4587 public mediaQueryResultChanged(JsonObject jo) 4588 { super("CSS", "mediaQueryResultChanged", 0); } 4589 4590 @Override 4591 public String toString() { return "CSS.mediaQueryResultChanged Marker Event\n"; } 4592 } 4593 4594 /** 4595 * Fires whenever a web font is updated. A non-empty font parameter indicates a successfully loaded 4596 * web font. 4597 */ 4598 public static class fontsUpdated 4599 extends BrowserEvent 4600 implements java.io.Serializable 4601 { 4602 /** For Object Serialization. java.io.Serializable */ 4603 protected static final long serialVersionUID = 1; 4604 4605 public boolean[] optionals() 4606 { return new boolean[] { true, }; } 4607 4608 /** 4609 * The web font that has loaded. 4610 * <BR /><B CLASS=Opt>OPTIONAL</B> 4611 */ 4612 public final CSS.FontFace font; 4613 4614 /** 4615 * Constructor 4616 * 4617 * @param font The web font that has loaded. 4618 * <BR /><B CLASS=Opt>OPTIONAL</B> 4619 */ 4620 public fontsUpdated(CSS.FontFace font) 4621 { 4622 super("CSS", "fontsUpdated", 1); 4623 4624 this.font = font; 4625 } 4626 4627 /** 4628 * JSON Object Constructor 4629 * @param jo A Json-Object having data about an instance of {@code 'fontsUpdated'}. 4630 */ 4631 public fontsUpdated (JsonObject jo) 4632 { 4633 super("CSS", "fontsUpdated", 1); 4634 4635 this.font = ReadJSON.getObject(jo, "font", CSS.FontFace.class, true, false); 4636 } 4637 4638 4639 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4640 public boolean equals(Object other) 4641 { 4642 if (this == other) return true; 4643 if (other == null) return false; 4644 if (other.getClass() != this.getClass()) return false; 4645 4646 fontsUpdated o = (fontsUpdated) other; 4647 4648 return 4649 Objects.equals(this.font, o.font); 4650 } 4651 4652 /** Generates a Hash-Code for {@code 'this'} instance */ 4653 public int hashCode() 4654 { 4655 return 4656 this.font.hashCode(); 4657 } 4658 } 4659 4660 /** Fired whenever an active document stylesheet is added. */ 4661 public static class styleSheetAdded 4662 extends BrowserEvent 4663 implements java.io.Serializable 4664 { 4665 /** For Object Serialization. java.io.Serializable */ 4666 protected static final long serialVersionUID = 1; 4667 4668 public boolean[] optionals() 4669 { return new boolean[] { false, }; } 4670 4671 /** Added stylesheet metainfo. */ 4672 public final CSS.CSSStyleSheetHeader header; 4673 4674 /** 4675 * Constructor 4676 * 4677 * @param header Added stylesheet metainfo. 4678 */ 4679 public styleSheetAdded(CSS.CSSStyleSheetHeader header) 4680 { 4681 super("CSS", "styleSheetAdded", 1); 4682 4683 // Exception-Check(s) to ensure that if any parameters which are not declared as 4684 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4685 4686 if (header == null) THROWS.throwNPE("header"); 4687 4688 this.header = header; 4689 } 4690 4691 /** 4692 * JSON Object Constructor 4693 * @param jo A Json-Object having data about an instance of {@code 'styleSheetAdded'}. 4694 */ 4695 public styleSheetAdded (JsonObject jo) 4696 { 4697 super("CSS", "styleSheetAdded", 1); 4698 4699 this.header = ReadJSON.getObject(jo, "header", CSS.CSSStyleSheetHeader.class, false, true); 4700 } 4701 4702 4703 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4704 public boolean equals(Object other) 4705 { 4706 if (this == other) return true; 4707 if (other == null) return false; 4708 if (other.getClass() != this.getClass()) return false; 4709 4710 styleSheetAdded o = (styleSheetAdded) other; 4711 4712 return 4713 Objects.equals(this.header, o.header); 4714 } 4715 4716 /** Generates a Hash-Code for {@code 'this'} instance */ 4717 public int hashCode() 4718 { 4719 return 4720 this.header.hashCode(); 4721 } 4722 } 4723 4724 /** Fired whenever a stylesheet is changed as a result of the client operation. */ 4725 public static class styleSheetChanged 4726 extends BrowserEvent 4727 implements java.io.Serializable 4728 { 4729 /** For Object Serialization. java.io.Serializable */ 4730 protected static final long serialVersionUID = 1; 4731 4732 public boolean[] optionals() 4733 { return new boolean[] { false, }; } 4734 4735 /** <CODE>[No Description Provided by Google]</CODE> */ 4736 public final String styleSheetId; 4737 4738 /** 4739 * Constructor 4740 * 4741 * @param styleSheetId - 4742 */ 4743 public styleSheetChanged(String styleSheetId) 4744 { 4745 super("CSS", "styleSheetChanged", 1); 4746 4747 // Exception-Check(s) to ensure that if any parameters which are not declared as 4748 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4749 4750 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 4751 4752 this.styleSheetId = styleSheetId; 4753 } 4754 4755 /** 4756 * JSON Object Constructor 4757 * @param jo A Json-Object having data about an instance of {@code 'styleSheetChanged'}. 4758 */ 4759 public styleSheetChanged (JsonObject jo) 4760 { 4761 super("CSS", "styleSheetChanged", 1); 4762 4763 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", false, true); 4764 } 4765 4766 4767 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4768 public boolean equals(Object other) 4769 { 4770 if (this == other) return true; 4771 if (other == null) return false; 4772 if (other.getClass() != this.getClass()) return false; 4773 4774 styleSheetChanged o = (styleSheetChanged) other; 4775 4776 return 4777 Objects.equals(this.styleSheetId, o.styleSheetId); 4778 } 4779 4780 /** Generates a Hash-Code for {@code 'this'} instance */ 4781 public int hashCode() 4782 { 4783 return 4784 Objects.hashCode(this.styleSheetId); 4785 } 4786 } 4787 4788 /** Fired whenever an active document stylesheet is removed. */ 4789 public static class styleSheetRemoved 4790 extends BrowserEvent 4791 implements java.io.Serializable 4792 { 4793 /** For Object Serialization. java.io.Serializable */ 4794 protected static final long serialVersionUID = 1; 4795 4796 public boolean[] optionals() 4797 { return new boolean[] { false, }; } 4798 4799 /** Identifier of the removed stylesheet. */ 4800 public final String styleSheetId; 4801 4802 /** 4803 * Constructor 4804 * 4805 * @param styleSheetId Identifier of the removed stylesheet. 4806 */ 4807 public styleSheetRemoved(String styleSheetId) 4808 { 4809 super("CSS", "styleSheetRemoved", 1); 4810 4811 // Exception-Check(s) to ensure that if any parameters which are not declared as 4812 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4813 4814 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 4815 4816 this.styleSheetId = styleSheetId; 4817 } 4818 4819 /** 4820 * JSON Object Constructor 4821 * @param jo A Json-Object having data about an instance of {@code 'styleSheetRemoved'}. 4822 */ 4823 public styleSheetRemoved (JsonObject jo) 4824 { 4825 super("CSS", "styleSheetRemoved", 1); 4826 4827 this.styleSheetId = ReadJSON.getString(jo, "styleSheetId", false, true); 4828 } 4829 4830 4831 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4832 public boolean equals(Object other) 4833 { 4834 if (this == other) return true; 4835 if (other == null) return false; 4836 if (other.getClass() != this.getClass()) return false; 4837 4838 styleSheetRemoved o = (styleSheetRemoved) other; 4839 4840 return 4841 Objects.equals(this.styleSheetId, o.styleSheetId); 4842 } 4843 4844 /** Generates a Hash-Code for {@code 'this'} instance */ 4845 public int hashCode() 4846 { 4847 return 4848 Objects.hashCode(this.styleSheetId); 4849 } 4850 } 4851 4852 /** 4853 * <CODE>[No Description Provided by Google]</CODE> 4854 * <BR /><B CLASS=Exp>EXPERIMENTAL</B> 4855 */ 4856 public static class computedStyleUpdated 4857 extends BrowserEvent 4858 implements java.io.Serializable 4859 { 4860 /** For Object Serialization. java.io.Serializable */ 4861 protected static final long serialVersionUID = 1; 4862 4863 public boolean[] optionals() 4864 { return new boolean[] { false, }; } 4865 4866 /** The node id that has updated computed styles. */ 4867 public final int nodeId; 4868 4869 /** 4870 * Constructor 4871 * 4872 * @param nodeId The node id that has updated computed styles. 4873 */ 4874 public computedStyleUpdated(int nodeId) 4875 { 4876 super("CSS", "computedStyleUpdated", 1); 4877 4878 this.nodeId = nodeId; 4879 } 4880 4881 /** 4882 * JSON Object Constructor 4883 * @param jo A Json-Object having data about an instance of {@code 'computedStyleUpdated'}. 4884 */ 4885 public computedStyleUpdated (JsonObject jo) 4886 { 4887 super("CSS", "computedStyleUpdated", 1); 4888 4889 this.nodeId = ReadPrimJSON.getInt(jo, "nodeId"); 4890 } 4891 4892 4893 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 4894 public boolean equals(Object other) 4895 { 4896 if (this == other) return true; 4897 if (other == null) return false; 4898 if (other.getClass() != this.getClass()) return false; 4899 4900 computedStyleUpdated o = (computedStyleUpdated) other; 4901 4902 return 4903 Objects.equals(this.nodeId, o.nodeId); 4904 } 4905 4906 /** Generates a Hash-Code for {@code 'this'} instance */ 4907 public int hashCode() 4908 { 4909 return 4910 this.nodeId; 4911 } 4912 } 4913 4914 4915 // Counter for keeping the WebSocket Request ID's distinct. 4916 private static int counter = 1; 4917 4918 /** 4919 * Inserts a new rule with the given {@code ruleText} in a stylesheet with given {@code styleSheetId}, at the 4920 * position specified by {@code location}. 4921 * 4922 * @param styleSheetId The css style sheet identifier where a new rule should be inserted. 4923 * 4924 * @param ruleText The text of a new rule. 4925 * 4926 * @param location Text position of a new rule in the target style sheet. 4927 * 4928 * @param nodeForPropertySyntaxValidation 4929 * NodeId for the DOM node in whose context custom property declarations for registered properties should be 4930 * validated. If omitted, declarations in the new rule text can only be validated statically, which may produce 4931 * incorrect results if the declaration contains a var() for example. 4932 * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B> 4933 * 4934 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4935 * {@link CSS.CSSRule}></CODE> 4936 * 4937 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 4938 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 4939 * {@link CSS.CSSRule}></CODE> will be returned. 4940 * 4941 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 4942 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 4943 * may be retrieved.</I> 4944 * 4945 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 4946 * <BR /><BR /><UL CLASS=JDUL> 4947 * <LI><CODE>{@link CSS.CSSRule} (<B>rule</B></CODE>) 4948 * <BR />The newly created rule. 4949 * </LI> 4950 * </UL> */ 4951 public static Script<String, JsonObject, CSS.CSSRule> addRule( 4952 String styleSheetId, String ruleText, CSS.SourceRange location, 4953 Integer nodeForPropertySyntaxValidation 4954 ) 4955 { 4956 // Exception-Check(s) to ensure that if any parameters which are not declared as 4957 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 4958 4959 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 4960 if (ruleText == null) THROWS.throwNPE("ruleText"); 4961 if (location == null) THROWS.throwNPE("location"); 4962 4963 final int webSocketID = 14000000 + counter++; 4964 final boolean[] optionals = { false, false, false, true, }; 4965 4966 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 4967 String requestJSON = WriteJSON.get( 4968 parameterTypes.get("addRule"), 4969 parameterNames.get("addRule"), 4970 optionals, webSocketID, 4971 "CSS.addRule", 4972 styleSheetId, ruleText, location, nodeForPropertySyntaxValidation 4973 ); 4974 4975 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSRule' 4976 Function<JsonObject, CSS.CSSRule> responseProcessor = (JsonObject jo) -> 4977 ReadJSON.getObject(jo, "rule", CSS.CSSRule.class, false, true); 4978 4979 return new Script<>(webSocketID, requestJSON, responseProcessor); 4980 } 4981 4982 /** 4983 * Returns all class names from specified stylesheet. 4984 * 4985 * @param styleSheetId - 4986 * 4987 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 4988 * String[]></CODE> 4989 * 4990 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 4991 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 4992 * String[]></CODE> will be returned. 4993 * 4994 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 4995 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 4996 * may be retrieved.</I> 4997 * 4998 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 4999 * <BR /><BR /><UL CLASS=JDUL> 5000 * <LI><CODE>String[] (<B>classNames</B></CODE>) 5001 * <BR />Class name list. 5002 * </LI> 5003 * </UL> */ 5004 public static Script<String, JsonObject, String[]> collectClassNames(String styleSheetId) 5005 { 5006 // Exception-Check(s) to ensure that if any parameters which are not declared as 5007 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5008 5009 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 5010 5011 final int webSocketID = 14001000 + counter++; 5012 final boolean[] optionals = { false, }; 5013 5014 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5015 String requestJSON = WriteJSON.get( 5016 parameterTypes.get("collectClassNames"), 5017 parameterNames.get("collectClassNames"), 5018 optionals, webSocketID, 5019 "CSS.collectClassNames", 5020 styleSheetId 5021 ); 5022 5023 // 'JSON Binding' ... Converts Browser Response-JSON to 'String[]' 5024 Function<JsonObject, String[]> responseProcessor = (JsonObject jo) -> 5025 (jo.getJsonArray("classNames") == null) 5026 ? null 5027 : RJArrIntoStream.strArr(jo.getJsonArray("classNames"), null, 0).toArray(String[]::new); 5028 5029 return new Script<>(webSocketID, requestJSON, responseProcessor); 5030 } 5031 5032 /** 5033 * Creates a new special "via-inspector" stylesheet in the frame with given {@code frameId}. 5034 * 5035 * @param frameId Identifier of the frame where "via-inspector" stylesheet should be created. 5036 * 5037 * @param force 5038 * If true, creates a new stylesheet for every call. If false, 5039 * returns a stylesheet previously created by a call with force=false 5040 * for the frame's document if it exists or creates a new stylesheet 5041 * (default: false). 5042 * <BR /><B CLASS=Opt>OPTIONAL</B> 5043 * 5044 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5045 * String></CODE> 5046 * 5047 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 5048 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 5049 * String></CODE> will be returned. 5050 * 5051 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 5052 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 5053 * may be retrieved.</I> 5054 * 5055 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 5056 * <BR /><BR /><UL CLASS=JDUL> 5057 * <LI><CODE>String (<B>styleSheetId</B></CODE>) 5058 * <BR />Identifier of the created "via-inspector" stylesheet. 5059 * </LI> 5060 * </UL> */ 5061 public static Script<String, JsonObject, String> createStyleSheet 5062 (String frameId, Boolean force) 5063 { 5064 // Exception-Check(s) to ensure that if any parameters which are not declared as 5065 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5066 5067 if (frameId == null) THROWS.throwNPE("frameId"); 5068 5069 final int webSocketID = 14002000 + counter++; 5070 final boolean[] optionals = { false, true, }; 5071 5072 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5073 String requestJSON = WriteJSON.get( 5074 parameterTypes.get("createStyleSheet"), 5075 parameterNames.get("createStyleSheet"), 5076 optionals, webSocketID, 5077 "CSS.createStyleSheet", 5078 frameId, force 5079 ); 5080 5081 // 'JSON Binding' ... Converts Browser Response-JSON to 'String' 5082 Function<JsonObject, String> responseProcessor = (JsonObject jo) -> 5083 ReadJSON.getString(jo, "styleSheetId", false, true); 5084 5085 return new Script<>(webSocketID, requestJSON, responseProcessor); 5086 } 5087 5088 /** 5089 * Disables the CSS agent for the given page. 5090 * 5091 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5092 * {@link Ret0}></CODE> 5093 * 5094 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5095 * browser receives the invocation-request. 5096 * 5097 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5098 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5099 * {@code >} to ensure the Browser Function has run to completion. 5100 */ 5101 public static Script<String, JsonObject, Ret0> disable() 5102 { 5103 final int webSocketID = 14003000 + counter++; 5104 final boolean[] optionals = new boolean[0]; 5105 5106 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5107 String requestJSON = WriteJSON.get( 5108 parameterTypes.get("disable"), 5109 parameterNames.get("disable"), 5110 optionals, webSocketID, 5111 "CSS.disable" 5112 ); 5113 5114 // This Remote Command does not have a Return-Value. 5115 return new Script<> 5116 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 5117 } 5118 5119 /** 5120 * Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been 5121 * enabled until the result of this command is received. 5122 * 5123 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5124 * {@link Ret0}></CODE> 5125 * 5126 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5127 * browser receives the invocation-request. 5128 * 5129 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5130 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5131 * {@code >} to ensure the Browser Function has run to completion. 5132 */ 5133 public static Script<String, JsonObject, Ret0> enable() 5134 { 5135 final int webSocketID = 14004000 + counter++; 5136 final boolean[] optionals = new boolean[0]; 5137 5138 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5139 String requestJSON = WriteJSON.get( 5140 parameterTypes.get("enable"), 5141 parameterNames.get("enable"), 5142 optionals, webSocketID, 5143 "CSS.enable" 5144 ); 5145 5146 // This Remote Command does not have a Return-Value. 5147 return new Script<> 5148 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 5149 } 5150 5151 /** 5152 * Ensures that the given node will have specified pseudo-classes whenever its style is computed by 5153 * the browser. 5154 * 5155 * @param nodeId The element id for which to force the pseudo state. 5156 * 5157 * @param forcedPseudoClasses Element pseudo classes to force when computing the element's style. 5158 * 5159 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5160 * {@link Ret0}></CODE> 5161 * 5162 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5163 * browser receives the invocation-request. 5164 * 5165 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5166 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5167 * {@code >} to ensure the Browser Function has run to completion. 5168 */ 5169 public static Script<String, JsonObject, Ret0> forcePseudoState 5170 (int nodeId, String[] forcedPseudoClasses) 5171 { 5172 // Exception-Check(s) to ensure that if any parameters which are not declared as 5173 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5174 5175 if (forcedPseudoClasses == null) THROWS.throwNPE("forcedPseudoClasses"); 5176 5177 final int webSocketID = 14005000 + counter++; 5178 final boolean[] optionals = { false, false, }; 5179 5180 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5181 String requestJSON = WriteJSON.get( 5182 parameterTypes.get("forcePseudoState"), 5183 parameterNames.get("forcePseudoState"), 5184 optionals, webSocketID, 5185 "CSS.forcePseudoState", 5186 nodeId, forcedPseudoClasses 5187 ); 5188 5189 // This Remote Command does not have a Return-Value. 5190 return new Script<> 5191 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 5192 } 5193 5194 /** 5195 * Ensures that the given node is in its starting-style state. 5196 * 5197 * @param nodeId The element id for which to force the starting-style state. 5198 * 5199 * @param forced Boolean indicating if this is on or off. 5200 * 5201 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5202 * {@link Ret0}></CODE> 5203 * 5204 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 5205 * browser receives the invocation-request. 5206 * 5207 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 5208 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 5209 * {@code >} to ensure the Browser Function has run to completion. 5210 */ 5211 public static Script<String, JsonObject, Ret0> forceStartingStyle 5212 (int nodeId, boolean forced) 5213 { 5214 final int webSocketID = 14006000 + counter++; 5215 final boolean[] optionals = { false, false, }; 5216 5217 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5218 String requestJSON = WriteJSON.get( 5219 parameterTypes.get("forceStartingStyle"), 5220 parameterNames.get("forceStartingStyle"), 5221 optionals, webSocketID, 5222 "CSS.forceStartingStyle", 5223 nodeId, forced 5224 ); 5225 5226 // This Remote Command does not have a Return-Value. 5227 return new Script<> 5228 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 5229 } 5230 5231 /** 5232 * <CODE>[No Description Provided by Google]</CODE> 5233 * 5234 * @param nodeId Id of the node to get background colors for. 5235 * 5236 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5237 * {@link Ret3}></CODE> 5238 * 5239 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 5240 * {@link Script#exec()}), and a {@link Promise} returned. 5241 * 5242 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 5243 * (using {@link Promise#await()}), the {@code Ret3} will subsequently 5244 * be returned from that call. 5245 * 5246 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 5247 * in an instance of <B>{@link Ret3}</B> 5248 * 5249 * <BR /><BR /><UL CLASS=JDUL> 5250 * <LI><CODE><B>Ret3.a:</B> String[] (<B>backgroundColors</B>)</CODE> 5251 * <BR />The range of background colors behind this element, if it contains any visible text. If no 5252 * visible text is present, this will be undefined. In the case of a flat background color, 5253 * this will consist of simply that color. In the case of a gradient, this will consist of each 5254 * of the color stops. For anything more complicated, this will be an empty array. Images will 5255 * be ignored (as if the image had failed to load). 5256 * <BR /><BR /></LI> 5257 * <LI><CODE><B>Ret3.b:</B> String (<B>computedFontSize</B>)</CODE> 5258 * <BR />The computed font size for this node, as a CSS computed value string (e.g. '12px'). 5259 * <BR /><BR /></LI> 5260 * <LI><CODE><B>Ret3.c:</B> String (<B>computedFontWeight</B>)</CODE> 5261 * <BR />The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or 5262 * '100'). 5263 * </LI> 5264 * </UL> 5265 */ 5266 public static Script<String, JsonObject, Ret3<String[], String, String>> getBackgroundColors 5267 (int nodeId) 5268 { 5269 final int webSocketID = 14007000 + counter++; 5270 final boolean[] optionals = { false, }; 5271 5272 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5273 String requestJSON = WriteJSON.get( 5274 parameterTypes.get("getBackgroundColors"), 5275 parameterNames.get("getBackgroundColors"), 5276 optionals, webSocketID, 5277 "CSS.getBackgroundColors", 5278 nodeId 5279 ); 5280 5281 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret3' 5282 Function<JsonObject, Ret3<String[], String, String>> 5283 responseProcessor = (JsonObject jo) -> new Ret3<>( 5284 (jo.getJsonArray("backgroundColors") == null) 5285 ? null 5286 : RJArrIntoStream.strArr(jo.getJsonArray("backgroundColors"), null, 0).toArray(String[]::new), 5287 ReadJSON.getString(jo, "computedFontSize", true, false), 5288 ReadJSON.getString(jo, "computedFontWeight", true, false) 5289 ); 5290 5291 return new Script<>(webSocketID, requestJSON, responseProcessor); 5292 } 5293 5294 /** 5295 * Returns the computed style for a DOM node identified by {@code nodeId}. 5296 * 5297 * @param nodeId - 5298 * 5299 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5300 * {@link CSS.CSSComputedStyleProperty}[]></CODE> 5301 * 5302 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 5303 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 5304 * {@link CSS.CSSComputedStyleProperty}[]></CODE> will be returned. 5305 * 5306 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 5307 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 5308 * may be retrieved.</I> 5309 * 5310 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 5311 * <BR /><BR /><UL CLASS=JDUL> 5312 * <LI><CODE>{@link CSS.CSSComputedStyleProperty}[] (<B>computedStyle</B></CODE>) 5313 * <BR />Computed style for the specified DOM node. 5314 * </LI> 5315 * </UL> */ 5316 public static Script<String, JsonObject, CSS.CSSComputedStyleProperty[]> getComputedStyleForNode 5317 (int nodeId) 5318 { 5319 final int webSocketID = 14008000 + counter++; 5320 final boolean[] optionals = { false, }; 5321 5322 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5323 String requestJSON = WriteJSON.get( 5324 parameterTypes.get("getComputedStyleForNode"), 5325 parameterNames.get("getComputedStyleForNode"), 5326 optionals, webSocketID, 5327 "CSS.getComputedStyleForNode", 5328 nodeId 5329 ); 5330 5331 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSComputedStyleProperty[]' 5332 Function<JsonObject, CSS.CSSComputedStyleProperty[]> responseProcessor = (JsonObject jo) -> 5333 (jo.getJsonArray("computedStyle") == null) 5334 ? null 5335 : RJArrIntoStream.objArr(jo.getJsonArray("computedStyle"), null, 0, CSS.CSSComputedStyleProperty.class).toArray(CSS.CSSComputedStyleProperty[]::new); 5336 5337 return new Script<>(webSocketID, requestJSON, responseProcessor); 5338 } 5339 5340 /** 5341 * Resolve the specified values in the context of the provided element. 5342 * For example, a value of '1em' is evaluated according to the computed 5343 * 'font-size' of the element and a value 'calc(1px + 2px)' will be 5344 * resolved to '3px'. 5345 * If the {@code propertyName} was specified the {@code values} are resolved as if 5346 * they were property's declaration. If a value cannot be parsed according 5347 * to the provided property syntax, the value is parsed using combined 5348 * syntax as if null {@code propertyName} was provided. If the value cannot be 5349 * resolved even then, return the provided value without any changes. 5350 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 5351 * 5352 * @param values 5353 * Substitution functions (var()/env()/attr()) and cascade-dependent 5354 * keywords (revert/revert-layer) do not work. 5355 * 5356 * @param nodeId Id of the node in whose context the expression is evaluated 5357 * 5358 * @param propertyName Only longhands and custom property names are accepted. 5359 * <BR /><B CLASS=Opt>OPTIONAL</B> 5360 * 5361 * @param pseudoType 5362 * Pseudo element type, only works for pseudo elements that generate 5363 * elements in the tree, such as ::before and ::after. 5364 * <BR /><B CLASS=Opt>OPTIONAL</B> 5365 * 5366 * @param pseudoIdentifier Pseudo element custom ident. 5367 * <BR /><B CLASS=Opt>OPTIONAL</B> 5368 * 5369 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5370 * String[]></CODE> 5371 * 5372 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 5373 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 5374 * String[]></CODE> will be returned. 5375 * 5376 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 5377 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 5378 * may be retrieved.</I> 5379 * 5380 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 5381 * <BR /><BR /><UL CLASS=JDUL> 5382 * <LI><CODE>String[] (<B>results</B></CODE>) 5383 * <BR />- 5384 * </LI> 5385 * </UL> */ 5386 public static Script<String, JsonObject, String[]> resolveValues( 5387 String[] values, int nodeId, String propertyName, String pseudoType, 5388 String pseudoIdentifier 5389 ) 5390 { 5391 // Exception-Check(s) to ensure that if any parameters which are not declared as 5392 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5393 5394 if (values == null) THROWS.throwNPE("values"); 5395 5396 // Exception-Check(s) to ensure that if any parameters which must adhere to a 5397 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 5398 5399 THROWS.checkIAE("pseudoType", pseudoType, "DOM.PseudoType", DOM.PseudoType); 5400 5401 final int webSocketID = 14009000 + counter++; 5402 final boolean[] optionals = { false, false, true, true, true, }; 5403 5404 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5405 String requestJSON = WriteJSON.get( 5406 parameterTypes.get("resolveValues"), 5407 parameterNames.get("resolveValues"), 5408 optionals, webSocketID, 5409 "CSS.resolveValues", 5410 values, nodeId, propertyName, pseudoType, pseudoIdentifier 5411 ); 5412 5413 // 'JSON Binding' ... Converts Browser Response-JSON to 'String[]' 5414 Function<JsonObject, String[]> responseProcessor = (JsonObject jo) -> 5415 (jo.getJsonArray("results") == null) 5416 ? null 5417 : RJArrIntoStream.strArr(jo.getJsonArray("results"), null, 0).toArray(String[]::new); 5418 5419 return new Script<>(webSocketID, requestJSON, responseProcessor); 5420 } 5421 5422 /** 5423 * <CODE>[No Description Provided by Google]</CODE> 5424 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 5425 * 5426 * @param shorthandName - 5427 * 5428 * @param value - 5429 * 5430 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5431 * {@link CSS.CSSProperty}[]></CODE> 5432 * 5433 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 5434 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 5435 * {@link CSS.CSSProperty}[]></CODE> will be returned. 5436 * 5437 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 5438 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 5439 * may be retrieved.</I> 5440 * 5441 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 5442 * <BR /><BR /><UL CLASS=JDUL> 5443 * <LI><CODE>{@link CSS.CSSProperty}[] (<B>longhandProperties</B></CODE>) 5444 * <BR />- 5445 * </LI> 5446 * </UL> */ 5447 public static Script<String, JsonObject, CSS.CSSProperty[]> getLonghandProperties 5448 (String shorthandName, String value) 5449 { 5450 // Exception-Check(s) to ensure that if any parameters which are not declared as 5451 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5452 5453 if (shorthandName == null) THROWS.throwNPE("shorthandName"); 5454 if (value == null) THROWS.throwNPE("value"); 5455 5456 final int webSocketID = 14010000 + counter++; 5457 final boolean[] optionals = { false, false, }; 5458 5459 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5460 String requestJSON = WriteJSON.get( 5461 parameterTypes.get("getLonghandProperties"), 5462 parameterNames.get("getLonghandProperties"), 5463 optionals, webSocketID, 5464 "CSS.getLonghandProperties", 5465 shorthandName, value 5466 ); 5467 5468 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSProperty[]' 5469 Function<JsonObject, CSS.CSSProperty[]> responseProcessor = (JsonObject jo) -> 5470 (jo.getJsonArray("longhandProperties") == null) 5471 ? null 5472 : RJArrIntoStream.objArr(jo.getJsonArray("longhandProperties"), null, 0, CSS.CSSProperty.class).toArray(CSS.CSSProperty[]::new); 5473 5474 return new Script<>(webSocketID, requestJSON, responseProcessor); 5475 } 5476 5477 /** 5478 * Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM 5479 * attributes) for a DOM node identified by {@code nodeId}. 5480 * 5481 * @param nodeId - 5482 * 5483 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5484 * {@link Ret2}></CODE> 5485 * 5486 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 5487 * {@link Script#exec()}), and a {@link Promise} returned. 5488 * 5489 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 5490 * (using {@link Promise#await()}), the {@code Ret2} will subsequently 5491 * be returned from that call. 5492 * 5493 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 5494 * in an instance of <B>{@link Ret2}</B> 5495 * 5496 * <BR /><BR /><UL CLASS=JDUL> 5497 * <LI><CODE><B>Ret2.a:</B> {@link CSS.CSSStyle} (<B>inlineStyle</B>)</CODE> 5498 * <BR />Inline style for the specified DOM node. 5499 * <BR /><BR /></LI> 5500 * <LI><CODE><B>Ret2.b:</B> {@link CSS.CSSStyle} (<B>attributesStyle</B>)</CODE> 5501 * <BR />Attribute-defined element style (e.g. resulting from "width=20 height=100%"). 5502 * </LI> 5503 * </UL> 5504 */ 5505 public static Script<String, JsonObject, Ret2<CSS.CSSStyle, CSS.CSSStyle>> getInlineStylesForNode 5506 (int nodeId) 5507 { 5508 final int webSocketID = 14011000 + counter++; 5509 final boolean[] optionals = { false, }; 5510 5511 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5512 String requestJSON = WriteJSON.get( 5513 parameterTypes.get("getInlineStylesForNode"), 5514 parameterNames.get("getInlineStylesForNode"), 5515 optionals, webSocketID, 5516 "CSS.getInlineStylesForNode", 5517 nodeId 5518 ); 5519 5520 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2' 5521 Function<JsonObject, Ret2<CSS.CSSStyle, CSS.CSSStyle>> 5522 responseProcessor = (JsonObject jo) -> new Ret2<>( 5523 ReadJSON.getObject(jo, "inlineStyle", CSS.CSSStyle.class, true, false), 5524 ReadJSON.getObject(jo, "attributesStyle", CSS.CSSStyle.class, true, false) 5525 ); 5526 5527 return new Script<>(webSocketID, requestJSON, responseProcessor); 5528 } 5529 5530 /** 5531 * Returns the styles coming from animations & transitions 5532 * including the animation & transition styles coming from inheritance chain. 5533 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 5534 * 5535 * @param nodeId - 5536 * 5537 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5538 * {@link Ret3}></CODE> 5539 * 5540 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 5541 * {@link Script#exec()}), and a {@link Promise} returned. 5542 * 5543 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 5544 * (using {@link Promise#await()}), the {@code Ret3} will subsequently 5545 * be returned from that call. 5546 * 5547 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 5548 * in an instance of <B>{@link Ret3}</B> 5549 * 5550 * <BR /><BR /><UL CLASS=JDUL> 5551 * <LI><CODE><B>Ret3.a:</B> {@link CSS.CSSAnimationStyle}[] (<B>animationStyles</B>)</CODE> 5552 * <BR />Styles coming from animations. 5553 * <BR /><BR /></LI> 5554 * <LI><CODE><B>Ret3.b:</B> {@link CSS.CSSStyle} (<B>transitionsStyle</B>)</CODE> 5555 * <BR />Style coming from transitions. 5556 * <BR /><BR /></LI> 5557 * <LI><CODE><B>Ret3.c:</B> {@link CSS.InheritedAnimatedStyleEntry}[] (<B>inherited</B>)</CODE> 5558 * <BR />Inherited style entries for animationsStyle and transitionsStyle from 5559 * the inheritance chain of the element. 5560 * </LI> 5561 * </UL> 5562 */ 5563 public static Script<String, JsonObject, Ret3<CSS.CSSAnimationStyle[], CSS.CSSStyle, CSS.InheritedAnimatedStyleEntry[]>> 5564 getAnimatedStylesForNode(int nodeId) 5565 { 5566 final int webSocketID = 14012000 + counter++; 5567 final boolean[] optionals = { false, }; 5568 5569 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5570 String requestJSON = WriteJSON.get( 5571 parameterTypes.get("getAnimatedStylesForNode"), 5572 parameterNames.get("getAnimatedStylesForNode"), 5573 optionals, webSocketID, 5574 "CSS.getAnimatedStylesForNode", 5575 nodeId 5576 ); 5577 5578 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret3' 5579 Function<JsonObject, Ret3<CSS.CSSAnimationStyle[], CSS.CSSStyle, CSS.InheritedAnimatedStyleEntry[]>> 5580 responseProcessor = (JsonObject jo) -> new Ret3<>( 5581 (jo.getJsonArray("animationStyles") == null) 5582 ? null 5583 : RJArrIntoStream.objArr(jo.getJsonArray("animationStyles"), null, 0, CSS.CSSAnimationStyle.class).toArray(CSS.CSSAnimationStyle[]::new), 5584 ReadJSON.getObject(jo, "transitionsStyle", CSS.CSSStyle.class, true, false), 5585 (jo.getJsonArray("inherited") == null) 5586 ? null 5587 : RJArrIntoStream.objArr(jo.getJsonArray("inherited"), null, 0, CSS.InheritedAnimatedStyleEntry.class).toArray(CSS.InheritedAnimatedStyleEntry[]::new) 5588 ); 5589 5590 return new Script<>(webSocketID, requestJSON, responseProcessor); 5591 } 5592 5593 /** 5594 * Returns requested styles for a DOM node identified by {@code nodeId}. 5595 * 5596 * @param nodeId - 5597 * 5598 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5599 * Object[]></CODE> 5600 * 5601 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 5602 * {@link Script#exec()}), and a {@link Promise} returned. 5603 * 5604 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 5605 * (using {@link Promise#await()}), the {@code Object[]} will subsequently 5606 * be returned from that call. 5607 * 5608 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 5609 * in a Java <B>{@code Object[]}-Array</B> 5610 * 5611 * <BR /><BR /><UL CLASS=JDUL> 5612 * <LI><CODE><B>Object[0]:</B> {@link CSS.CSSStyle} (<B>inlineStyle</B>)</CODE> 5613 * <BR />Inline style for the specified DOM node. 5614 * <BR /><BR /></LI> 5615 * <LI><CODE><B>Object[1]:</B> {@link CSS.CSSStyle} (<B>attributesStyle</B>)</CODE> 5616 * <BR />Attribute-defined element style (e.g. resulting from "width=20 height=100%"). 5617 * <BR /><BR /></LI> 5618 * <LI><CODE><B>Object[2]:</B> {@link CSS.RuleMatch}[] (<B>matchedCSSRules</B>)</CODE> 5619 * <BR />CSS rules matching this node, from all applicable stylesheets. 5620 * <BR /><BR /></LI> 5621 * <LI><CODE><B>Object[3]:</B> {@link CSS.PseudoElementMatches}[] (<B>pseudoElements</B>)</CODE> 5622 * <BR />Pseudo style matches for this node. 5623 * <BR /><BR /></LI> 5624 * <LI><CODE><B>Object[4]:</B> {@link CSS.InheritedStyleEntry}[] (<B>inherited</B>)</CODE> 5625 * <BR />A chain of inherited styles (from the immediate node parent up to the DOM tree root). 5626 * <BR /><BR /></LI> 5627 * <LI><CODE><B>Object[5]:</B> {@link CSS.InheritedPseudoElementMatches}[] (<B>inheritedPseudoElements</B>)</CODE> 5628 * <BR />A chain of inherited pseudo element styles (from the immediate node parent up to the DOM tree root). 5629 * <BR /><BR /></LI> 5630 * <LI><CODE><B>Object[6]:</B> {@link CSS.CSSKeyframesRule}[] (<B>cssKeyframesRules</B>)</CODE> 5631 * <BR />A list of CSS keyframed animations matching this node. 5632 * <BR /><BR /></LI> 5633 * <LI><CODE><B>Object[7]:</B> {@link CSS.CSSPositionTryRule}[] (<B>cssPositionTryRules</B>)</CODE> 5634 * <BR />A list of CSS @position-try rules matching this node, based on the position-try-fallbacks property. 5635 * <BR /><BR /></LI> 5636 * <LI><CODE><B>Object[8]:</B> Integer (<B>activePositionFallbackIndex</B>)</CODE> 5637 * <BR />Index of the active fallback in the applied position-try-fallback property, 5638 * will not be set if there is no active position-try fallback. 5639 * <BR /><BR /></LI> 5640 * <LI><CODE><B>Object[9]:</B> {@link CSS.CSSPropertyRule}[] (<B>cssPropertyRules</B>)</CODE> 5641 * <BR />A list of CSS at-property rules matching this node. 5642 * <BR /><BR /></LI> 5643 * <LI><CODE><B>Object[10]:</B> {@link CSS.CSSPropertyRegistration}[] (<B>cssPropertyRegistrations</B>)</CODE> 5644 * <BR />A list of CSS property registrations matching this node. 5645 * <BR /><BR /></LI> 5646 * <LI><CODE><B>Object[11]:</B> {@link CSS.CSSFontPaletteValuesRule} (<B>cssFontPaletteValuesRule</B>)</CODE> 5647 * <BR />A font-palette-values rule matching this node. 5648 * <BR /><BR /></LI> 5649 * <LI><CODE><B>Object[12]:</B> Integer (<B>parentLayoutNodeId</B>)</CODE> 5650 * <BR />Id of the first parent element that does not have display: contents. 5651 * <BR /><BR /></LI> 5652 * <LI><CODE><B>Object[13]:</B> {@link CSS.CSSFunctionRule}[] (<B>cssFunctionRules</B>)</CODE> 5653 * <BR />A list of CSS at-function rules referenced by styles of this node. 5654 * </LI> 5655 * </UL> 5656 */ 5657 public static Script<String, JsonObject, Object[]> getMatchedStylesForNode(int nodeId) 5658 { 5659 final int webSocketID = 14013000 + counter++; 5660 final boolean[] optionals = { false, }; 5661 5662 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5663 String requestJSON = WriteJSON.get( 5664 parameterTypes.get("getMatchedStylesForNode"), 5665 parameterNames.get("getMatchedStylesForNode"), 5666 optionals, webSocketID, 5667 "CSS.getMatchedStylesForNode", 5668 nodeId 5669 ); 5670 5671 // 'JSON Binding' ... Converts Browser Response-JSON into Java Object[]-Array 5672 Function<JsonObject, Object[]> responseProcessor = (JsonObject jo) -> new Object[] 5673 { 5674 ReadJSON.getObject(jo, "inlineStyle", CSS.CSSStyle.class, true, false), 5675 ReadJSON.getObject(jo, "attributesStyle", CSS.CSSStyle.class, true, false), 5676 (jo.getJsonArray("matchedCSSRules") == null) 5677 ? null 5678 : RJArrIntoStream.objArr(jo.getJsonArray("matchedCSSRules"), null, 0, CSS.RuleMatch.class).toArray(CSS.RuleMatch[]::new), 5679 (jo.getJsonArray("pseudoElements") == null) 5680 ? null 5681 : RJArrIntoStream.objArr(jo.getJsonArray("pseudoElements"), null, 0, CSS.PseudoElementMatches.class).toArray(CSS.PseudoElementMatches[]::new), 5682 (jo.getJsonArray("inherited") == null) 5683 ? null 5684 : RJArrIntoStream.objArr(jo.getJsonArray("inherited"), null, 0, CSS.InheritedStyleEntry.class).toArray(CSS.InheritedStyleEntry[]::new), 5685 (jo.getJsonArray("inheritedPseudoElements") == null) 5686 ? null 5687 : RJArrIntoStream.objArr(jo.getJsonArray("inheritedPseudoElements"), null, 0, CSS.InheritedPseudoElementMatches.class).toArray(CSS.InheritedPseudoElementMatches[]::new), 5688 (jo.getJsonArray("cssKeyframesRules") == null) 5689 ? null 5690 : RJArrIntoStream.objArr(jo.getJsonArray("cssKeyframesRules"), null, 0, CSS.CSSKeyframesRule.class).toArray(CSS.CSSKeyframesRule[]::new), 5691 (jo.getJsonArray("cssPositionTryRules") == null) 5692 ? null 5693 : RJArrIntoStream.objArr(jo.getJsonArray("cssPositionTryRules"), null, 0, CSS.CSSPositionTryRule.class).toArray(CSS.CSSPositionTryRule[]::new), 5694 ReadBoxedJSON.getInteger(jo, "activePositionFallbackIndex", true), 5695 (jo.getJsonArray("cssPropertyRules") == null) 5696 ? null 5697 : RJArrIntoStream.objArr(jo.getJsonArray("cssPropertyRules"), null, 0, CSS.CSSPropertyRule.class).toArray(CSS.CSSPropertyRule[]::new), 5698 (jo.getJsonArray("cssPropertyRegistrations") == null) 5699 ? null 5700 : RJArrIntoStream.objArr(jo.getJsonArray("cssPropertyRegistrations"), null, 0, CSS.CSSPropertyRegistration.class).toArray(CSS.CSSPropertyRegistration[]::new), 5701 ReadJSON.getObject(jo, "cssFontPaletteValuesRule", CSS.CSSFontPaletteValuesRule.class, true, false), 5702 ReadBoxedJSON.getInteger(jo, "parentLayoutNodeId", true), 5703 (jo.getJsonArray("cssFunctionRules") == null) 5704 ? null 5705 : RJArrIntoStream.objArr(jo.getJsonArray("cssFunctionRules"), null, 0, CSS.CSSFunctionRule.class).toArray(CSS.CSSFunctionRule[]::new) 5706 }; 5707 5708 return new Script<>(webSocketID, requestJSON, responseProcessor); 5709 } 5710 5711 /** 5712 * Returns the values of the default UA-defined environment variables used in env() 5713 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 5714 * 5715 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5716 * JsonObject></CODE> 5717 * 5718 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 5719 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 5720 * JsonObject></CODE> will be returned. 5721 * 5722 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 5723 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 5724 * may be retrieved.</I> 5725 * 5726 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 5727 * <BR /><BR /><UL CLASS=JDUL> 5728 * <LI><CODE>JsonObject (<B>environmentVariables</B></CODE>) 5729 * <BR />- 5730 * </LI> 5731 * </UL> */ 5732 public static Script<String, JsonObject, JsonObject> getEnvironmentVariables() 5733 { 5734 final int webSocketID = 14014000 + counter++; 5735 final boolean[] optionals = new boolean[0]; 5736 5737 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5738 String requestJSON = WriteJSON.get( 5739 parameterTypes.get("getEnvironmentVariables"), 5740 parameterNames.get("getEnvironmentVariables"), 5741 optionals, webSocketID, 5742 "CSS.getEnvironmentVariables" 5743 ); 5744 5745 // 'JSON Binding' ... Converts Browser Response-JSON to 'JsonObject' 5746 Function<JsonObject, JsonObject> responseProcessor = (JsonObject jo) -> 5747 jo.getJsonObject("environmentVariables"); 5748 5749 return new Script<>(webSocketID, requestJSON, responseProcessor); 5750 } 5751 5752 /** 5753 * Returns all media queries parsed by the rendering engine. 5754 * 5755 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5756 * {@link CSS.CSSMedia}[]></CODE> 5757 * 5758 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 5759 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 5760 * {@link CSS.CSSMedia}[]></CODE> will be returned. 5761 * 5762 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 5763 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 5764 * may be retrieved.</I> 5765 * 5766 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 5767 * <BR /><BR /><UL CLASS=JDUL> 5768 * <LI><CODE>{@link CSS.CSSMedia}[] (<B>medias</B></CODE>) 5769 * <BR />- 5770 * </LI> 5771 * </UL> */ 5772 public static Script<String, JsonObject, CSS.CSSMedia[]> getMediaQueries() 5773 { 5774 final int webSocketID = 14015000 + counter++; 5775 final boolean[] optionals = new boolean[0]; 5776 5777 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5778 String requestJSON = WriteJSON.get( 5779 parameterTypes.get("getMediaQueries"), 5780 parameterNames.get("getMediaQueries"), 5781 optionals, webSocketID, 5782 "CSS.getMediaQueries" 5783 ); 5784 5785 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSMedia[]' 5786 Function<JsonObject, CSS.CSSMedia[]> responseProcessor = (JsonObject jo) -> 5787 (jo.getJsonArray("medias") == null) 5788 ? null 5789 : RJArrIntoStream.objArr(jo.getJsonArray("medias"), null, 0, CSS.CSSMedia.class).toArray(CSS.CSSMedia[]::new); 5790 5791 return new Script<>(webSocketID, requestJSON, responseProcessor); 5792 } 5793 5794 /** 5795 * Requests information about platform fonts which we used to render child TextNodes in the given 5796 * node. 5797 * 5798 * @param nodeId - 5799 * 5800 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5801 * {@link CSS.PlatformFontUsage}[]></CODE> 5802 * 5803 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 5804 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 5805 * {@link CSS.PlatformFontUsage}[]></CODE> will be returned. 5806 * 5807 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 5808 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 5809 * may be retrieved.</I> 5810 * 5811 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 5812 * <BR /><BR /><UL CLASS=JDUL> 5813 * <LI><CODE>{@link CSS.PlatformFontUsage}[] (<B>fonts</B></CODE>) 5814 * <BR />Usage statistics for every employed platform font. 5815 * </LI> 5816 * </UL> */ 5817 public static Script<String, JsonObject, CSS.PlatformFontUsage[]> getPlatformFontsForNode 5818 (int nodeId) 5819 { 5820 final int webSocketID = 14016000 + counter++; 5821 final boolean[] optionals = { false, }; 5822 5823 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5824 String requestJSON = WriteJSON.get( 5825 parameterTypes.get("getPlatformFontsForNode"), 5826 parameterNames.get("getPlatformFontsForNode"), 5827 optionals, webSocketID, 5828 "CSS.getPlatformFontsForNode", 5829 nodeId 5830 ); 5831 5832 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.PlatformFontUsage[]' 5833 Function<JsonObject, CSS.PlatformFontUsage[]> responseProcessor = (JsonObject jo) -> 5834 (jo.getJsonArray("fonts") == null) 5835 ? null 5836 : RJArrIntoStream.objArr(jo.getJsonArray("fonts"), null, 0, CSS.PlatformFontUsage.class).toArray(CSS.PlatformFontUsage[]::new); 5837 5838 return new Script<>(webSocketID, requestJSON, responseProcessor); 5839 } 5840 5841 /** 5842 * Returns the current textual content for a stylesheet. 5843 * 5844 * @param styleSheetId - 5845 * 5846 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5847 * String></CODE> 5848 * 5849 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 5850 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 5851 * String></CODE> will be returned. 5852 * 5853 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 5854 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 5855 * may be retrieved.</I> 5856 * 5857 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 5858 * <BR /><BR /><UL CLASS=JDUL> 5859 * <LI><CODE>String (<B>text</B></CODE>) 5860 * <BR />The stylesheet text. 5861 * </LI> 5862 * </UL> */ 5863 public static Script<String, JsonObject, String> getStyleSheetText(String styleSheetId) 5864 { 5865 // Exception-Check(s) to ensure that if any parameters which are not declared as 5866 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5867 5868 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 5869 5870 final int webSocketID = 14017000 + counter++; 5871 final boolean[] optionals = { false, }; 5872 5873 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5874 String requestJSON = WriteJSON.get( 5875 parameterTypes.get("getStyleSheetText"), 5876 parameterNames.get("getStyleSheetText"), 5877 optionals, webSocketID, 5878 "CSS.getStyleSheetText", 5879 styleSheetId 5880 ); 5881 5882 // 'JSON Binding' ... Converts Browser Response-JSON to 'String' 5883 Function<JsonObject, String> responseProcessor = (JsonObject jo) -> 5884 ReadJSON.getString(jo, "text", false, true); 5885 5886 return new Script<>(webSocketID, requestJSON, responseProcessor); 5887 } 5888 5889 /** 5890 * Returns all layers parsed by the rendering engine for the tree scope of a node. 5891 * Given a DOM element identified by nodeId, getLayersForNode returns the root 5892 * layer for the nearest ancestor document or shadow root. The layer root contains 5893 * the full layer tree for the tree scope and their ordering. 5894 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 5895 * 5896 * @param nodeId - 5897 * 5898 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5899 * {@link CSS.CSSLayerData}></CODE> 5900 * 5901 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 5902 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 5903 * {@link CSS.CSSLayerData}></CODE> will be returned. 5904 * 5905 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 5906 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 5907 * may be retrieved.</I> 5908 * 5909 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 5910 * <BR /><BR /><UL CLASS=JDUL> 5911 * <LI><CODE>{@link CSS.CSSLayerData} (<B>rootLayer</B></CODE>) 5912 * <BR />- 5913 * </LI> 5914 * </UL> */ 5915 public static Script<String, JsonObject, CSS.CSSLayerData> getLayersForNode(int nodeId) 5916 { 5917 final int webSocketID = 14018000 + counter++; 5918 final boolean[] optionals = { false, }; 5919 5920 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5921 String requestJSON = WriteJSON.get( 5922 parameterTypes.get("getLayersForNode"), 5923 parameterNames.get("getLayersForNode"), 5924 optionals, webSocketID, 5925 "CSS.getLayersForNode", 5926 nodeId 5927 ); 5928 5929 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSLayerData' 5930 Function<JsonObject, CSS.CSSLayerData> responseProcessor = (JsonObject jo) -> 5931 ReadJSON.getObject(jo, "rootLayer", CSS.CSSLayerData.class, false, true); 5932 5933 return new Script<>(webSocketID, requestJSON, responseProcessor); 5934 } 5935 5936 /** 5937 * Given a CSS selector text and a style sheet ID, getLocationForSelector 5938 * returns an array of locations of the CSS selector in the style sheet. 5939 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 5940 * 5941 * @param styleSheetId - 5942 * 5943 * @param selectorText - 5944 * 5945 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 5946 * {@link CSS.SourceRange}[]></CODE> 5947 * 5948 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 5949 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 5950 * {@link CSS.SourceRange}[]></CODE> will be returned. 5951 * 5952 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 5953 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 5954 * may be retrieved.</I> 5955 * 5956 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 5957 * <BR /><BR /><UL CLASS=JDUL> 5958 * <LI><CODE>{@link CSS.SourceRange}[] (<B>ranges</B></CODE>) 5959 * <BR />- 5960 * </LI> 5961 * </UL> */ 5962 public static Script<String, JsonObject, CSS.SourceRange[]> getLocationForSelector 5963 (String styleSheetId, String selectorText) 5964 { 5965 // Exception-Check(s) to ensure that if any parameters which are not declared as 5966 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 5967 5968 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 5969 if (selectorText == null) THROWS.throwNPE("selectorText"); 5970 5971 final int webSocketID = 14019000 + counter++; 5972 final boolean[] optionals = { false, false, }; 5973 5974 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 5975 String requestJSON = WriteJSON.get( 5976 parameterTypes.get("getLocationForSelector"), 5977 parameterNames.get("getLocationForSelector"), 5978 optionals, webSocketID, 5979 "CSS.getLocationForSelector", 5980 styleSheetId, selectorText 5981 ); 5982 5983 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.SourceRange[]' 5984 Function<JsonObject, CSS.SourceRange[]> responseProcessor = (JsonObject jo) -> 5985 (jo.getJsonArray("ranges") == null) 5986 ? null 5987 : RJArrIntoStream.objArr(jo.getJsonArray("ranges"), null, 0, CSS.SourceRange.class).toArray(CSS.SourceRange[]::new); 5988 5989 return new Script<>(webSocketID, requestJSON, responseProcessor); 5990 } 5991 5992 /** 5993 * Starts tracking the given node for the computed style updates 5994 * and whenever the computed style is updated for node, it queues 5995 * a {@code computedStyleUpdated} event with throttling. 5996 * There can only be 1 node tracked for computed style updates 5997 * so passing a new node id removes tracking from the previous node. 5998 * Pass {@code undefined} to disable tracking. 5999 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 6000 * 6001 * @param nodeId - 6002 * <BR /><B CLASS=Opt>OPTIONAL</B> 6003 * 6004 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6005 * {@link Ret0}></CODE> 6006 * 6007 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6008 * browser receives the invocation-request. 6009 * 6010 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6011 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6012 * {@code >} to ensure the Browser Function has run to completion. 6013 */ 6014 public static Script<String, JsonObject, Ret0> trackComputedStyleUpdatesForNode 6015 (Integer nodeId) 6016 { 6017 final int webSocketID = 14020000 + counter++; 6018 final boolean[] optionals = { true, }; 6019 6020 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6021 String requestJSON = WriteJSON.get( 6022 parameterTypes.get("trackComputedStyleUpdatesForNode"), 6023 parameterNames.get("trackComputedStyleUpdatesForNode"), 6024 optionals, webSocketID, 6025 "CSS.trackComputedStyleUpdatesForNode", 6026 nodeId 6027 ); 6028 6029 // This Remote Command does not have a Return-Value. 6030 return new Script<> 6031 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 6032 } 6033 6034 /** 6035 * Starts tracking the given computed styles for updates. The specified array of properties 6036 * replaces the one previously specified. Pass empty array to disable tracking. 6037 * Use takeComputedStyleUpdates to retrieve the list of nodes that had properties modified. 6038 * The changes to computed style properties are only tracked for nodes pushed to the front-end 6039 * by the DOM agent. If no changes to the tracked properties occur after the node has been pushed 6040 * to the front-end, no updates will be issued for the node. 6041 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 6042 * 6043 * @param propertiesToTrack - 6044 * 6045 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6046 * {@link Ret0}></CODE> 6047 * 6048 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6049 * browser receives the invocation-request. 6050 * 6051 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6052 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6053 * {@code >} to ensure the Browser Function has run to completion. 6054 */ 6055 public static Script<String, JsonObject, Ret0> trackComputedStyleUpdates 6056 (CSS.CSSComputedStyleProperty[] propertiesToTrack) 6057 { 6058 // Exception-Check(s) to ensure that if any parameters which are not declared as 6059 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6060 6061 if (propertiesToTrack == null) THROWS.throwNPE("propertiesToTrack"); 6062 6063 final int webSocketID = 14021000 + counter++; 6064 final boolean[] optionals = { false, }; 6065 6066 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6067 String requestJSON = WriteJSON.get( 6068 parameterTypes.get("trackComputedStyleUpdates"), 6069 parameterNames.get("trackComputedStyleUpdates"), 6070 optionals, webSocketID, 6071 "CSS.trackComputedStyleUpdates", 6072 (Object) propertiesToTrack 6073 ); 6074 6075 // This Remote Command does not have a Return-Value. 6076 return new Script<> 6077 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 6078 } 6079 6080 /** 6081 * Polls the next batch of computed style updates. 6082 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 6083 * 6084 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6085 * int[]></CODE> 6086 * 6087 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6088 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6089 * int[]></CODE> will be returned. 6090 * 6091 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6092 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6093 * may be retrieved.</I> 6094 * 6095 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6096 * <BR /><BR /><UL CLASS=JDUL> 6097 * <LI><CODE>int[] (<B>nodeIds</B></CODE>) 6098 * <BR />The list of node Ids that have their tracked computed styles updated. 6099 * </LI> 6100 * </UL> */ 6101 public static Script<String, JsonObject, int[]> takeComputedStyleUpdates() 6102 { 6103 final int webSocketID = 14022000 + counter++; 6104 final boolean[] optionals = new boolean[0]; 6105 6106 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6107 String requestJSON = WriteJSON.get( 6108 parameterTypes.get("takeComputedStyleUpdates"), 6109 parameterNames.get("takeComputedStyleUpdates"), 6110 optionals, webSocketID, 6111 "CSS.takeComputedStyleUpdates" 6112 ); 6113 6114 // 'JSON Binding' ... Converts Browser Response-JSON to 'int[]' 6115 Function<JsonObject, int[]> responseProcessor = (JsonObject jo) -> 6116 (jo.getJsonArray("nodeIds") == null) 6117 ? null 6118 : RJArrIntoPrimArray.intArr(jo.getJsonArray("nodeIds"), -1, 0, null); 6119 6120 return new Script<>(webSocketID, requestJSON, responseProcessor); 6121 } 6122 6123 /** 6124 * Find a rule with the given active property for the given node and set the new value for this 6125 * property 6126 * 6127 * @param nodeId The element id for which to set property. 6128 * 6129 * @param propertyName - 6130 * 6131 * @param value - 6132 * 6133 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6134 * {@link Ret0}></CODE> 6135 * 6136 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6137 * browser receives the invocation-request. 6138 * 6139 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6140 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6141 * {@code >} to ensure the Browser Function has run to completion. 6142 */ 6143 public static Script<String, JsonObject, Ret0> setEffectivePropertyValueForNode 6144 (int nodeId, String propertyName, String value) 6145 { 6146 // Exception-Check(s) to ensure that if any parameters which are not declared as 6147 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6148 6149 if (propertyName == null) THROWS.throwNPE("propertyName"); 6150 if (value == null) THROWS.throwNPE("value"); 6151 6152 final int webSocketID = 14023000 + counter++; 6153 final boolean[] optionals = { false, false, false, }; 6154 6155 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6156 String requestJSON = WriteJSON.get( 6157 parameterTypes.get("setEffectivePropertyValueForNode"), 6158 parameterNames.get("setEffectivePropertyValueForNode"), 6159 optionals, webSocketID, 6160 "CSS.setEffectivePropertyValueForNode", 6161 nodeId, propertyName, value 6162 ); 6163 6164 // This Remote Command does not have a Return-Value. 6165 return new Script<> 6166 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 6167 } 6168 6169 /** 6170 * Modifies the property rule property name. 6171 * 6172 * @param styleSheetId - 6173 * 6174 * @param range - 6175 * 6176 * @param propertyName - 6177 * 6178 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6179 * {@link CSS.Value}></CODE> 6180 * 6181 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6182 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6183 * {@link CSS.Value}></CODE> will be returned. 6184 * 6185 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6186 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6187 * may be retrieved.</I> 6188 * 6189 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6190 * <BR /><BR /><UL CLASS=JDUL> 6191 * <LI><CODE>{@link CSS.Value} (<B>propertyName</B></CODE>) 6192 * <BR />The resulting key text after modification. 6193 * </LI> 6194 * </UL> */ 6195 public static Script<String, JsonObject, CSS.Value> setPropertyRulePropertyName 6196 (String styleSheetId, CSS.SourceRange range, String propertyName) 6197 { 6198 // Exception-Check(s) to ensure that if any parameters which are not declared as 6199 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6200 6201 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 6202 if (range == null) THROWS.throwNPE("range"); 6203 if (propertyName == null) THROWS.throwNPE("propertyName"); 6204 6205 final int webSocketID = 14024000 + counter++; 6206 final boolean[] optionals = { false, false, false, }; 6207 6208 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6209 String requestJSON = WriteJSON.get( 6210 parameterTypes.get("setPropertyRulePropertyName"), 6211 parameterNames.get("setPropertyRulePropertyName"), 6212 optionals, webSocketID, 6213 "CSS.setPropertyRulePropertyName", 6214 styleSheetId, range, propertyName 6215 ); 6216 6217 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.Value' 6218 Function<JsonObject, CSS.Value> responseProcessor = (JsonObject jo) -> 6219 ReadJSON.getObject(jo, "propertyName", CSS.Value.class, false, true); 6220 6221 return new Script<>(webSocketID, requestJSON, responseProcessor); 6222 } 6223 6224 /** 6225 * Modifies the keyframe rule key text. 6226 * 6227 * @param styleSheetId - 6228 * 6229 * @param range - 6230 * 6231 * @param keyText - 6232 * 6233 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6234 * {@link CSS.Value}></CODE> 6235 * 6236 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6237 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6238 * {@link CSS.Value}></CODE> will be returned. 6239 * 6240 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6241 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6242 * may be retrieved.</I> 6243 * 6244 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6245 * <BR /><BR /><UL CLASS=JDUL> 6246 * <LI><CODE>{@link CSS.Value} (<B>keyText</B></CODE>) 6247 * <BR />The resulting key text after modification. 6248 * </LI> 6249 * </UL> */ 6250 public static Script<String, JsonObject, CSS.Value> setKeyframeKey 6251 (String styleSheetId, CSS.SourceRange range, String keyText) 6252 { 6253 // Exception-Check(s) to ensure that if any parameters which are not declared as 6254 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6255 6256 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 6257 if (range == null) THROWS.throwNPE("range"); 6258 if (keyText == null) THROWS.throwNPE("keyText"); 6259 6260 final int webSocketID = 14025000 + counter++; 6261 final boolean[] optionals = { false, false, false, }; 6262 6263 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6264 String requestJSON = WriteJSON.get( 6265 parameterTypes.get("setKeyframeKey"), 6266 parameterNames.get("setKeyframeKey"), 6267 optionals, webSocketID, 6268 "CSS.setKeyframeKey", 6269 styleSheetId, range, keyText 6270 ); 6271 6272 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.Value' 6273 Function<JsonObject, CSS.Value> responseProcessor = (JsonObject jo) -> 6274 ReadJSON.getObject(jo, "keyText", CSS.Value.class, false, true); 6275 6276 return new Script<>(webSocketID, requestJSON, responseProcessor); 6277 } 6278 6279 /** 6280 * Modifies the rule selector. 6281 * 6282 * @param styleSheetId - 6283 * 6284 * @param range - 6285 * 6286 * @param text - 6287 * 6288 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6289 * {@link CSS.CSSMedia}></CODE> 6290 * 6291 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6292 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6293 * {@link CSS.CSSMedia}></CODE> will be returned. 6294 * 6295 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6296 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6297 * may be retrieved.</I> 6298 * 6299 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6300 * <BR /><BR /><UL CLASS=JDUL> 6301 * <LI><CODE>{@link CSS.CSSMedia} (<B>media</B></CODE>) 6302 * <BR />The resulting CSS media rule after modification. 6303 * </LI> 6304 * </UL> */ 6305 public static Script<String, JsonObject, CSS.CSSMedia> setMediaText 6306 (String styleSheetId, CSS.SourceRange range, String text) 6307 { 6308 // Exception-Check(s) to ensure that if any parameters which are not declared as 6309 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6310 6311 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 6312 if (range == null) THROWS.throwNPE("range"); 6313 if (text == null) THROWS.throwNPE("text"); 6314 6315 final int webSocketID = 14026000 + counter++; 6316 final boolean[] optionals = { false, false, false, }; 6317 6318 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6319 String requestJSON = WriteJSON.get( 6320 parameterTypes.get("setMediaText"), 6321 parameterNames.get("setMediaText"), 6322 optionals, webSocketID, 6323 "CSS.setMediaText", 6324 styleSheetId, range, text 6325 ); 6326 6327 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSMedia' 6328 Function<JsonObject, CSS.CSSMedia> responseProcessor = (JsonObject jo) -> 6329 ReadJSON.getObject(jo, "media", CSS.CSSMedia.class, false, true); 6330 6331 return new Script<>(webSocketID, requestJSON, responseProcessor); 6332 } 6333 6334 /** 6335 * Modifies the expression of a container query. 6336 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 6337 * 6338 * @param styleSheetId - 6339 * 6340 * @param range - 6341 * 6342 * @param text - 6343 * 6344 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6345 * {@link CSS.CSSContainerQuery}></CODE> 6346 * 6347 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6348 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6349 * {@link CSS.CSSContainerQuery}></CODE> will be returned. 6350 * 6351 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6352 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6353 * may be retrieved.</I> 6354 * 6355 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6356 * <BR /><BR /><UL CLASS=JDUL> 6357 * <LI><CODE>{@link CSS.CSSContainerQuery} (<B>containerQuery</B></CODE>) 6358 * <BR />The resulting CSS container query rule after modification. 6359 * </LI> 6360 * </UL> */ 6361 public static Script<String, JsonObject, CSS.CSSContainerQuery> setContainerQueryText 6362 (String styleSheetId, CSS.SourceRange range, String text) 6363 { 6364 // Exception-Check(s) to ensure that if any parameters which are not declared as 6365 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6366 6367 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 6368 if (range == null) THROWS.throwNPE("range"); 6369 if (text == null) THROWS.throwNPE("text"); 6370 6371 final int webSocketID = 14027000 + counter++; 6372 final boolean[] optionals = { false, false, false, }; 6373 6374 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6375 String requestJSON = WriteJSON.get( 6376 parameterTypes.get("setContainerQueryText"), 6377 parameterNames.get("setContainerQueryText"), 6378 optionals, webSocketID, 6379 "CSS.setContainerQueryText", 6380 styleSheetId, range, text 6381 ); 6382 6383 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSContainerQuery' 6384 Function<JsonObject, CSS.CSSContainerQuery> responseProcessor = (JsonObject jo) -> 6385 ReadJSON.getObject(jo, "containerQuery", CSS.CSSContainerQuery.class, false, true); 6386 6387 return new Script<>(webSocketID, requestJSON, responseProcessor); 6388 } 6389 6390 /** 6391 * Modifies the expression of a supports at-rule. 6392 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 6393 * 6394 * @param styleSheetId - 6395 * 6396 * @param range - 6397 * 6398 * @param text - 6399 * 6400 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6401 * {@link CSS.CSSSupports}></CODE> 6402 * 6403 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6404 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6405 * {@link CSS.CSSSupports}></CODE> will be returned. 6406 * 6407 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6408 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6409 * may be retrieved.</I> 6410 * 6411 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6412 * <BR /><BR /><UL CLASS=JDUL> 6413 * <LI><CODE>{@link CSS.CSSSupports} (<B>supports</B></CODE>) 6414 * <BR />The resulting CSS Supports rule after modification. 6415 * </LI> 6416 * </UL> */ 6417 public static Script<String, JsonObject, CSS.CSSSupports> setSupportsText 6418 (String styleSheetId, CSS.SourceRange range, String text) 6419 { 6420 // Exception-Check(s) to ensure that if any parameters which are not declared as 6421 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6422 6423 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 6424 if (range == null) THROWS.throwNPE("range"); 6425 if (text == null) THROWS.throwNPE("text"); 6426 6427 final int webSocketID = 14028000 + counter++; 6428 final boolean[] optionals = { false, false, false, }; 6429 6430 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6431 String requestJSON = WriteJSON.get( 6432 parameterTypes.get("setSupportsText"), 6433 parameterNames.get("setSupportsText"), 6434 optionals, webSocketID, 6435 "CSS.setSupportsText", 6436 styleSheetId, range, text 6437 ); 6438 6439 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSSupports' 6440 Function<JsonObject, CSS.CSSSupports> responseProcessor = (JsonObject jo) -> 6441 ReadJSON.getObject(jo, "supports", CSS.CSSSupports.class, false, true); 6442 6443 return new Script<>(webSocketID, requestJSON, responseProcessor); 6444 } 6445 6446 /** 6447 * Modifies the expression of a scope at-rule. 6448 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 6449 * 6450 * @param styleSheetId - 6451 * 6452 * @param range - 6453 * 6454 * @param text - 6455 * 6456 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6457 * {@link CSS.CSSScope}></CODE> 6458 * 6459 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6460 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6461 * {@link CSS.CSSScope}></CODE> will be returned. 6462 * 6463 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6464 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6465 * may be retrieved.</I> 6466 * 6467 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6468 * <BR /><BR /><UL CLASS=JDUL> 6469 * <LI><CODE>{@link CSS.CSSScope} (<B>scope</B></CODE>) 6470 * <BR />The resulting CSS Scope rule after modification. 6471 * </LI> 6472 * </UL> */ 6473 public static Script<String, JsonObject, CSS.CSSScope> setScopeText 6474 (String styleSheetId, CSS.SourceRange range, String text) 6475 { 6476 // Exception-Check(s) to ensure that if any parameters which are not declared as 6477 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6478 6479 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 6480 if (range == null) THROWS.throwNPE("range"); 6481 if (text == null) THROWS.throwNPE("text"); 6482 6483 final int webSocketID = 14029000 + counter++; 6484 final boolean[] optionals = { false, false, false, }; 6485 6486 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6487 String requestJSON = WriteJSON.get( 6488 parameterTypes.get("setScopeText"), 6489 parameterNames.get("setScopeText"), 6490 optionals, webSocketID, 6491 "CSS.setScopeText", 6492 styleSheetId, range, text 6493 ); 6494 6495 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSScope' 6496 Function<JsonObject, CSS.CSSScope> responseProcessor = (JsonObject jo) -> 6497 ReadJSON.getObject(jo, "scope", CSS.CSSScope.class, false, true); 6498 6499 return new Script<>(webSocketID, requestJSON, responseProcessor); 6500 } 6501 6502 /** 6503 * Modifies the rule selector. 6504 * 6505 * @param styleSheetId - 6506 * 6507 * @param range - 6508 * 6509 * @param selector - 6510 * 6511 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6512 * {@link CSS.SelectorList}></CODE> 6513 * 6514 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6515 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6516 * {@link CSS.SelectorList}></CODE> will be returned. 6517 * 6518 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6519 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6520 * may be retrieved.</I> 6521 * 6522 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6523 * <BR /><BR /><UL CLASS=JDUL> 6524 * <LI><CODE>{@link CSS.SelectorList} (<B>selectorList</B></CODE>) 6525 * <BR />The resulting selector list after modification. 6526 * </LI> 6527 * </UL> */ 6528 public static Script<String, JsonObject, CSS.SelectorList> setRuleSelector 6529 (String styleSheetId, CSS.SourceRange range, String selector) 6530 { 6531 // Exception-Check(s) to ensure that if any parameters which are not declared as 6532 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6533 6534 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 6535 if (range == null) THROWS.throwNPE("range"); 6536 if (selector == null) THROWS.throwNPE("selector"); 6537 6538 final int webSocketID = 14030000 + counter++; 6539 final boolean[] optionals = { false, false, false, }; 6540 6541 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6542 String requestJSON = WriteJSON.get( 6543 parameterTypes.get("setRuleSelector"), 6544 parameterNames.get("setRuleSelector"), 6545 optionals, webSocketID, 6546 "CSS.setRuleSelector", 6547 styleSheetId, range, selector 6548 ); 6549 6550 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.SelectorList' 6551 Function<JsonObject, CSS.SelectorList> responseProcessor = (JsonObject jo) -> 6552 ReadJSON.getObject(jo, "selectorList", CSS.SelectorList.class, false, true); 6553 6554 return new Script<>(webSocketID, requestJSON, responseProcessor); 6555 } 6556 6557 /** 6558 * Sets the new stylesheet text. 6559 * 6560 * @param styleSheetId - 6561 * 6562 * @param text - 6563 * 6564 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6565 * String></CODE> 6566 * 6567 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6568 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6569 * String></CODE> will be returned. 6570 * 6571 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6572 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6573 * may be retrieved.</I> 6574 * 6575 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6576 * <BR /><BR /><UL CLASS=JDUL> 6577 * <LI><CODE>String (<B>sourceMapURL</B></CODE>) 6578 * <BR />URL of source map associated with script (if any). 6579 * </LI> 6580 * </UL> */ 6581 public static Script<String, JsonObject, String> setStyleSheetText 6582 (String styleSheetId, String text) 6583 { 6584 // Exception-Check(s) to ensure that if any parameters which are not declared as 6585 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6586 6587 if (styleSheetId == null) THROWS.throwNPE("styleSheetId"); 6588 if (text == null) THROWS.throwNPE("text"); 6589 6590 final int webSocketID = 14031000 + counter++; 6591 final boolean[] optionals = { false, false, }; 6592 6593 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6594 String requestJSON = WriteJSON.get( 6595 parameterTypes.get("setStyleSheetText"), 6596 parameterNames.get("setStyleSheetText"), 6597 optionals, webSocketID, 6598 "CSS.setStyleSheetText", 6599 styleSheetId, text 6600 ); 6601 6602 // 'JSON Binding' ... Converts Browser Response-JSON to 'String' 6603 Function<JsonObject, String> responseProcessor = (JsonObject jo) -> 6604 ReadJSON.getString(jo, "sourceMapURL", true, false); 6605 6606 return new Script<>(webSocketID, requestJSON, responseProcessor); 6607 } 6608 6609 /** 6610 * Applies specified style edits one after another in the given order. 6611 * 6612 * @param edits - 6613 * 6614 * @param nodeForPropertySyntaxValidation 6615 * NodeId for the DOM node in whose context custom property declarations for registered properties should be 6616 * validated. If omitted, declarations in the new rule text can only be validated statically, which may produce 6617 * incorrect results if the declaration contains a var() for example. 6618 * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Exp>EXPERIMENTAL</B> 6619 * 6620 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6621 * {@link CSS.CSSStyle}[]></CODE> 6622 * 6623 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6624 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6625 * {@link CSS.CSSStyle}[]></CODE> will be returned. 6626 * 6627 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6628 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6629 * may be retrieved.</I> 6630 * 6631 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6632 * <BR /><BR /><UL CLASS=JDUL> 6633 * <LI><CODE>{@link CSS.CSSStyle}[] (<B>styles</B></CODE>) 6634 * <BR />The resulting styles after modification. 6635 * </LI> 6636 * </UL> */ 6637 public static Script<String, JsonObject, CSS.CSSStyle[]> setStyleTexts 6638 (CSS.StyleDeclarationEdit[] edits, Integer nodeForPropertySyntaxValidation) 6639 { 6640 // Exception-Check(s) to ensure that if any parameters which are not declared as 6641 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 6642 6643 if (edits == null) THROWS.throwNPE("edits"); 6644 6645 final int webSocketID = 14032000 + counter++; 6646 final boolean[] optionals = { false, true, }; 6647 6648 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6649 String requestJSON = WriteJSON.get( 6650 parameterTypes.get("setStyleTexts"), 6651 parameterNames.get("setStyleTexts"), 6652 optionals, webSocketID, 6653 "CSS.setStyleTexts", 6654 edits, nodeForPropertySyntaxValidation 6655 ); 6656 6657 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.CSSStyle[]' 6658 Function<JsonObject, CSS.CSSStyle[]> responseProcessor = (JsonObject jo) -> 6659 (jo.getJsonArray("styles") == null) 6660 ? null 6661 : RJArrIntoStream.objArr(jo.getJsonArray("styles"), null, 0, CSS.CSSStyle.class).toArray(CSS.CSSStyle[]::new); 6662 6663 return new Script<>(webSocketID, requestJSON, responseProcessor); 6664 } 6665 6666 /** 6667 * Enables the selector recording. 6668 * 6669 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6670 * {@link Ret0}></CODE> 6671 * 6672 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6673 * browser receives the invocation-request. 6674 * 6675 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6676 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6677 * {@code >} to ensure the Browser Function has run to completion. 6678 */ 6679 public static Script<String, JsonObject, Ret0> startRuleUsageTracking() 6680 { 6681 final int webSocketID = 14033000 + counter++; 6682 final boolean[] optionals = new boolean[0]; 6683 6684 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6685 String requestJSON = WriteJSON.get( 6686 parameterTypes.get("startRuleUsageTracking"), 6687 parameterNames.get("startRuleUsageTracking"), 6688 optionals, webSocketID, 6689 "CSS.startRuleUsageTracking" 6690 ); 6691 6692 // This Remote Command does not have a Return-Value. 6693 return new Script<> 6694 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 6695 } 6696 6697 /** 6698 * Stop tracking rule usage and return the list of rules that were used since last call to 6699 * {@code takeCoverageDelta} (or since start of coverage instrumentation). 6700 * 6701 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6702 * {@link CSS.RuleUsage}[]></CODE> 6703 * 6704 * <BR /><BR />This <B>script</B> may be <B STYLE='color: red'>executed</B>, using 6705 * {@link Script#exec()}, and afterwards, a {@link Promise}<CODE><JsonObject, 6706 * {@link CSS.RuleUsage}[]></CODE> will be returned. 6707 * 6708 * <BR /><BR />Finally, the <B>{@code Promise}</B> may be <B STYLE='color: red'>awaited</B>, 6709 * using {@link Promise#await()}, <I>and the returned result of this Browser Function may 6710 * may be retrieved.</I> 6711 * 6712 * <BR /><BR />This Browser Function <B STYLE='color: red'>returns</B> 6713 * <BR /><BR /><UL CLASS=JDUL> 6714 * <LI><CODE>{@link CSS.RuleUsage}[] (<B>ruleUsage</B></CODE>) 6715 * <BR />- 6716 * </LI> 6717 * </UL> */ 6718 public static Script<String, JsonObject, CSS.RuleUsage[]> stopRuleUsageTracking() 6719 { 6720 final int webSocketID = 14034000 + counter++; 6721 final boolean[] optionals = new boolean[0]; 6722 6723 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6724 String requestJSON = WriteJSON.get( 6725 parameterTypes.get("stopRuleUsageTracking"), 6726 parameterNames.get("stopRuleUsageTracking"), 6727 optionals, webSocketID, 6728 "CSS.stopRuleUsageTracking" 6729 ); 6730 6731 // 'JSON Binding' ... Converts Browser Response-JSON to 'CSS.RuleUsage[]' 6732 Function<JsonObject, CSS.RuleUsage[]> responseProcessor = (JsonObject jo) -> 6733 (jo.getJsonArray("ruleUsage") == null) 6734 ? null 6735 : RJArrIntoStream.objArr(jo.getJsonArray("ruleUsage"), null, 0, CSS.RuleUsage.class).toArray(CSS.RuleUsage[]::new); 6736 6737 return new Script<>(webSocketID, requestJSON, responseProcessor); 6738 } 6739 6740 /** 6741 * Obtain list of rules that became used since last call to this method (or since start of coverage 6742 * instrumentation). 6743 * 6744 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6745 * {@link Ret2}></CODE> 6746 * 6747 * <BR /><BR />This {@link Script} may be <B STYLE='color:red'>executed</B> (using 6748 * {@link Script#exec()}), and a {@link Promise} returned. 6749 * 6750 * <BR /><BR />When the {@code Promise} is <B STYLE='color: red'>awaited</B> 6751 * (using {@link Promise#await()}), the {@code Ret2} will subsequently 6752 * be returned from that call. 6753 * 6754 * <BR /><BR />The <B STYLE='color: red'>returned</B> values are encapsulated 6755 * in an instance of <B>{@link Ret2}</B> 6756 * 6757 * <BR /><BR /><UL CLASS=JDUL> 6758 * <LI><CODE><B>Ret2.a:</B> {@link CSS.RuleUsage}[] (<B>coverage</B>)</CODE> 6759 * <BR />- 6760 * <BR /><BR /></LI> 6761 * <LI><CODE><B>Ret2.b:</B> Number (<B>timestamp</B>)</CODE> 6762 * <BR />Monotonically increasing time, in seconds. 6763 * </LI> 6764 * </UL> 6765 */ 6766 public static Script<String, JsonObject, Ret2<CSS.RuleUsage[], Number>> takeCoverageDelta() 6767 { 6768 final int webSocketID = 14035000 + counter++; 6769 final boolean[] optionals = new boolean[0]; 6770 6771 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6772 String requestJSON = WriteJSON.get( 6773 parameterTypes.get("takeCoverageDelta"), 6774 parameterNames.get("takeCoverageDelta"), 6775 optionals, webSocketID, 6776 "CSS.takeCoverageDelta" 6777 ); 6778 6779 // 'JSON Binding' ... Converts Browser Response-JSON into Java-Type 'Ret2' 6780 Function<JsonObject, Ret2<CSS.RuleUsage[], Number>> 6781 responseProcessor = (JsonObject jo) -> new Ret2<>( 6782 (jo.getJsonArray("coverage") == null) 6783 ? null 6784 : RJArrIntoStream.objArr(jo.getJsonArray("coverage"), null, 0, CSS.RuleUsage.class).toArray(CSS.RuleUsage[]::new), 6785 ReadNumberJSON.get(jo, "timestamp", false, true) 6786 ); 6787 6788 return new Script<>(webSocketID, requestJSON, responseProcessor); 6789 } 6790 6791 /** 6792 * Enables/disables rendering of local CSS fonts (enabled by default). 6793 * <BR /><B CLASS=Exp-Top>EXPERIMENTAL</B> 6794 * 6795 * @param enabled Whether rendering of local fonts is enabled. 6796 * 6797 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 6798 * {@link Ret0}></CODE> 6799 * 6800 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 6801 * browser receives the invocation-request. 6802 * 6803 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 6804 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 6805 * {@code >} to ensure the Browser Function has run to completion. 6806 */ 6807 public static Script<String, JsonObject, Ret0> setLocalFontsEnabled(boolean enabled) 6808 { 6809 final int webSocketID = 14036000 + counter++; 6810 final boolean[] optionals = { false, }; 6811 6812 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 6813 String requestJSON = WriteJSON.get( 6814 parameterTypes.get("setLocalFontsEnabled"), 6815 parameterNames.get("setLocalFontsEnabled"), 6816 optionals, webSocketID, 6817 "CSS.setLocalFontsEnabled", 6818 enabled 6819 ); 6820 6821 // This Remote Command does not have a Return-Value. 6822 return new Script<> 6823 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 6824 } 6825 6826}