public class CascadedStyle extends Object
PropertyDeclarations for
each unique CSS property name. What properties belong in the set is not
determined, except that multiple entries are resolved into a single set using
cascading rules. The set is cascaded during instantiation, so once you have a
CascadedStyle, the PropertyDeclarations you retrieve from it will have been
resolved following the CSS cascading rules. Note that this class knows
nothing about CSS selector-matching rules. Before creating a CascadedStyle,
you will need to determine which PropertyDeclarations belong in the set--for
example, by matching Rulesets to Document Elements via their selectors. You
can get individual properties by using propertyByName(CSSName) or an
Iterator of properties with getCascadedPropertyDeclarations(). Check for individual property assignments
using hasProperty(CSSName). A CascadedStyle is immutable, as
properties can not be added or removed from it once instantiated.| Modifier and Type | Field and Description |
|---|---|
static CascadedStyle |
emptyCascadedStyle
Get an empty singleton, used to negate inheritance of properties
|
| Modifier and Type | Method and Description |
|---|---|
int |
countAssigned() |
static CascadedStyle |
createAnonymousStyle(IdentValue display)
Creates an otherwise empty
CascadedStyle, setting the display property
to the value of the display parameter. |
static PropertyDeclaration |
createLayoutPropertyDeclaration(CSSName cssName,
IdentValue display)
Creates a
PropertyDeclaration suitable for passing to
createLayoutStyle(PropertyDeclaration[]) or
createLayoutStyle(CascadedStyle, PropertyDeclaration[]) |
static CascadedStyle |
createLayoutStyle(CascadedStyle startingPoint,
PropertyDeclaration[] decls)
Creates a
CascadedStyle using style information from
startingPoint and then adding the property declarations
from decls. |
static CascadedStyle |
createLayoutStyle(List<PropertyDeclaration> decls) |
static CascadedStyle |
createLayoutStyle(PropertyDeclaration[] decls)
Creates a
CascadedStyle using the provided property
declarations. |
Collection<PropertyDeclaration> |
getCascadedPropertyDeclarations()
Returns an
Iterator over the set of PropertyDeclarations already matched in this
CascadedStyle. |
Map<String,CustomPropertyDeclaration> |
getCustomProperties()
The cascaded custom property (
--*) declarations for this style,
keyed by name. |
String |
getFingerprint() |
IdentValue |
getIdent(CSSName cssName)
Gets the ident attribute of the CascadedStyle object
|
int |
getMatchSequence(CSSName cssName)
Cascade-priority rank of
cssName's winning declaration (higher
wins); Integer.MIN_VALUE if unknown. |
boolean |
hasPendingVarProperties()
Whether this style carries a declaration whose value contains
var()
and therefore has to be derived in cascade order. |
boolean |
hasProperty(CSSName cssName)
Returns true if property has been defined in this style.
|
PropertyDeclaration |
propertyByName(CSSName cssName)
Returns a
PropertyDeclaration by CSS
property name, e.g. |
public static final CascadedStyle emptyCascadedStyle
public static CascadedStyle createLayoutStyle(PropertyDeclaration[] decls)
CascadedStyle using the provided property
declarations. It is used when a box requires a style that does not
correspond to anything in the parsed stylesheets.decls - An array of PropertyDeclaration objects created with
createLayoutPropertyDeclaration(CSSName, IdentValue)createLayoutPropertyDeclaration(CSSName, IdentValue)public static CascadedStyle createLayoutStyle(List<PropertyDeclaration> decls)
public static CascadedStyle createLayoutStyle(CascadedStyle startingPoint, PropertyDeclaration[] decls)
CascadedStyle using style information from
startingPoint and then adding the property declarations
from decls.decls - An array of PropertyDeclaration objects created with
createLayoutPropertyDeclaration(CSSName, IdentValue)createLayoutPropertyDeclaration(CSSName, IdentValue)public static PropertyDeclaration createLayoutPropertyDeclaration(CSSName cssName, IdentValue display)
PropertyDeclaration suitable for passing to
createLayoutStyle(PropertyDeclaration[]) or
createLayoutStyle(CascadedStyle, PropertyDeclaration[])public static CascadedStyle createAnonymousStyle(IdentValue display)
CascadedStyle, setting the display property
to the value of the display parameter.public Map<String,CustomPropertyDeclaration> getCustomProperties()
--*) declarations for this style,
keyed by name. The values may still contain var() references; they
are resolved per element at computed-value time.public boolean hasProperty(CSSName cssName)
cssName - The CSS property name, e.g. "font-family".public PropertyDeclaration propertyByName(CSSName cssName)
PropertyDeclaration by CSS
property name, e.g. "font-family". Properties are already cascaded during
instantiation, so this will return the actual property (and corresponding
value) to use for CSS-based layout and rendering.cssName - The CSS property name, e.g. "font-family".public IdentValue getIdent(CSSName cssName)
cssName - PARAMpublic Collection<PropertyDeclaration> getCascadedPropertyDeclarations()
Iterator over the set of PropertyDeclarations already matched in this
CascadedStyle. For a given property name, there may be no match, in which
case there will be no PropertyDeclaration for that property
name in the Iterator.public int getMatchSequence(CSSName cssName)
cssName's winning declaration (higher
wins); Integer.MIN_VALUE if unknown. Used to derive declarations in
priority order.matchSequencepublic boolean hasPendingVarProperties()
var()
and therefore has to be derived in cascade order.hasPendingVarPropertiespublic int countAssigned()
public String getFingerprint()
Copyright © 2004–2026. All rights reserved.