All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openqa.selenium.devtools.v88.css.model.InheritedStyleEntry Maven / Gradle / Ivy

package org.openqa.selenium.devtools.v88.css.model;

import org.openqa.selenium.Beta;
import org.openqa.selenium.json.JsonInput;

/**
 * Inherited CSS rule collection from ancestor node.
 */
public class InheritedStyleEntry {

    private final java.util.Optional inlineStyle;

    private final java.util.List matchedCSSRules;

    public InheritedStyleEntry(java.util.Optional inlineStyle, java.util.List matchedCSSRules) {
        this.inlineStyle = inlineStyle;
        this.matchedCSSRules = java.util.Objects.requireNonNull(matchedCSSRules, "matchedCSSRules is required");
    }

    /**
     * The ancestor node's inline style, if any, in the style inheritance chain.
     */
    public java.util.Optional getInlineStyle() {
        return inlineStyle;
    }

    /**
     * Matches of CSS rules matching the ancestor node in the style inheritance chain.
     */
    public java.util.List getMatchedCSSRules() {
        return matchedCSSRules;
    }

    private static InheritedStyleEntry fromJson(JsonInput input) {
        java.util.Optional inlineStyle = java.util.Optional.empty();
        java.util.List matchedCSSRules = null;
        input.beginObject();
        while (input.hasNext()) {
            switch(input.nextName()) {
                case "inlineStyle":
                    inlineStyle = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v88.css.model.CSSStyle.class));
                    break;
                case "matchedCSSRules":
                    matchedCSSRules = input.read(new com.google.common.reflect.TypeToken>() {
                    }.getType());
                    break;
                default:
                    input.skipValue();
                    break;
            }
        }
        input.endObject();
        return new InheritedStyleEntry(inlineStyle, matchedCSSRules);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy