Package io.sf.carte.doc.style.css
css
package
essentially contains interface definitions (many derived from W3C) and
generic classes.
Compliance with CSS specification(s)
Although this implementation attempts to follow the various CSS specifications, there are known deviations from what was specified by the W3C. Most of those differences arise from the fact that the W3C specifications are intended to be implemented by user agents, and not by tools like this library. One example is serialization.
Serialization and getCssText()
The CSSOM specification requires
getCssText()
to return the serialization of property declarations, following
an algorithm that -whenever possible- builds shorthand properties from the
longhands. However, this is inconvenient for most use cases of this library,
so the getCssText()
method returns the properties in a form that
is close to what was specified with setCssText()
, either
longhands or shorthands.
The reason should be obvious: this library is generally not the final recipient for those declarations, but just middleware. If a CSS author specifies style in a certain way, he/she may be targeting more that one browser, but if this library produced its own shorthand constructions (and it has the logic to do that), that could break what was intended by the author. The library does remove obviously wrong declarations (and also redundant ones), however. The final result may not exactly reflect what was specified by the author, but is a good compromise.
Another deviation from the specification comes with the computed styles.
Instead of returning the empty string (as the Working Group recommends), or a
serialization of all the property name/value pairs known to the library (like
some browser does), only those values that come from the cascade or are
inherited from another element are included in both the item
collection and getCssText()
. Note that
getPropertyCSSValue(String)
and
getPropertyValue(String)
both return values for properties that are not
included in the item
collection, although this may seem
counter-intuitive.
This approach has better flexibility for the different use cases of this
library, and prevents potential problems (for example a downstream
application not understanding all the properties in the declaration text, or
re-parsing texts that are too large). Also, downstream users can check
whether declared styles ended up in an element's computed style by just
checking
CSSStyleDeclaration.getLength()
.
-
ClassDescriptionExpression sub-interface to be implemented by operations like sum or product.Boolean conditions.The types of condition.Factory interface for boolean conditions.Interface giving access to the computed box values.Sub-interface for tables in the simple box model.Color spaces predefined by CSS.CSS static methods.
attr()
primitive value.CSS canvas interface.A color.color-mix()
function.Represents a color value (not including color identifiers).Enumeration of color models.Interface that allows the retrieval of the primitive, "computed" values of CSS properties.Represents all the "conditional" at-rules, which consist of a condition and a statement block.Counter-style rule.A CSScounters()
function.A CSScounter()
function.A CSS rule that contains style declarations (of properties and/or descriptors).A CSS-enabled Document.The style computations operate under a compliance mode.Essentially adds CSS-related methods to the DOM'sElement
interface.A CSS environment variable value.Implemented by CSS expressions.Enumeration of expression parts (operations, operands).A primitive value containing an expression (likecalc()
).A CSS font-face rule.Based on W3C's CSSFontFeatureValuesMap interface.@font-feature-values rule.A function value.A gradient value.Enumeration of gradient types.Represents an at-rule that contains other rules nested inside itself.The CSSKeyframeRule interface represents the style rule for a single key.CSSKeyframesRule
represents a complete set of keyframes for a single animation.A value that contains avar
value as part of its declaration.Margin rule.A mathematical function value.Enumeration of mathematical functions.Values involving mathematical computations.CSS media Exception.A CSS @media rule.Namespace rule.A node that is related to a CSSDocument.A value that is a number with an optional unit.Sub-interface to be implemented by individual operands.A CSS @page rule.A CSS primitive value.This interface provides information about the processing of one (or more) CSS lexical unit(s) in order to produce aCSSPrimitiveValue
, that can be recovered withCSSPrimitiveValueItem.getCSSValue()
.A property definition.@property
rule.The ratio value type is a number followed by optional whitespace, followed by a solidus ('/'), followed by optional whitespace, followed by a number.Interface representing arect()
function.A CSS rule.CSSRuleList<T extends CSSRule>A rule list with additional utility methods.Shorthand value.CSS style declaration.CSS topmost generic Exception.A CSS style rule.CSSStyleSheet<R extends CSSRule>A style sheet.CSS style sheet factory.CSSStyleSheetList<T extends CSSRule>List of extended style sheets.Represents a ‘@supports’ rule.A typed value.A CSS unicode range value.A CSS unicode character value.CSS numeric units.A CSS style value.The main categories of values.The type of value.Factory of CSS values.This interface provides information about the processing of one (or more) CSS lexical unit(s) in order to produce aCSSValue
, that can be recovered withCSSValueItem.getCSSValue()
.CSSValueList<E extends CSSValue>Based on W3C'sCSSValueList
interface.Represents a CSS value syntax component.The syntax category.The syntax multiplier.A reference to a CSS custom property value ('variable').Define methods for formatting properties or descriptors in a declaration, generally for a computed style.A style sheet that is able to take the responsibility to compute the styles associated to document elements.Handle CSS errors at the CSSDocument.Represents a hsl color.Represents a HSL color value.Represents a hwb color.Represents a HWB color value.Represents a color in the LAB color model (lab()
oroklab()
).Deprecated.Represents a color in the LCh color model (lch()
oroklch()
).Deprecated.Instead of using this interface, just cast the result ofCSSColorValue.getColor()
to the appropriate interface (likeLCHColor
) according to the givenCSSColorValue.getColorModel()
.Media Feature predicate.Obtain information on an individual media query.Contains factory methods related to media queries.Interface to be implemented by handlers that are used insideParser.parseMediaQueryList(String,Node)
.Based on W3C's MediaQueryList interface.Deprecated.A predicate in a boolean expression from a Media Query.This style declaration belongs to a DOM node.Based on W3C'sRGBColor
interface.High-level handling of SAC errors and warnings.CSS Selector matcher.Handle CSS errors at the style sheet level.CSS Style database.Thrown when a requested operation requires aStyleDatabase
to complete.Handles the errors found in style declarations.Define methods for style text formatting.Create formatting context objects for use with a style sheet factory.Contains factory methods related to@supports
conditions.Obtain the numeric unit from the unit string.Represents a viewport defined as per the CSS specifications.Represents a (color()
) value in a XYZ color model.
CSSColorValue.getColor()
to the appropriate interface (likeLABColor
) according to the givenCSSColorValue.getColorModel()
.