Package io.sf.carte.doc.style.css
css
package
essentially contains interface definitions (many derived from W3C) and
generic classes.
Extended W3C CSSOM and SAC interfaces
There are two flavors of extended W3C interfaces in this library (those that extend previously existing W3C types, as opposed to those that are new ones):
- Interfaces suffixed with a "2" (like
CSSPrimitiveValue2
) have new methods that -in the opinion of the author- are required to handle current CSS. - Interfaces that are prefixed with "
Extended
" offer additional functionality that you may or may not want to use.
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.Interface giving access to the computed box values.Sub-interface for tables in the simple box model.
attr()
primitive value.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 custom property value ('variable').A CSS rule that contains style declarations.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()
).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.Margin rule.CSS media Exception.Namespace rule.A node that is related to a CSSDocument.Sub-interface to be implemented by individual operands.Adds new methods and assigned units to W3C'sCSSPrimitiveValue
.The ratio value type is a number followed by optional whitespace, followed by a solidus ('/'), followed by optional whitespace, followed by a number.Shorthand value.CSS topmost generic Exception.CSS style sheet factory.CSSStyleSheetList<T extends ExtendedCSSRule>List of extended style sheets.Represents a ‘@supports’ rule.A CSS unicode range value.A CSS unicode character value.A style sheet that is able to take the responsibility to compute the styles associated to document elements.Handle CSS errors at the CSSDocument.An extended CSS font-face rule.An extended CSS @media rule.An extended CSS @page rule.Extends the CSSValue interface to provide a couple serialization methods.An extended CSS rule.ExtendedCSSRuleList<T extends ExtendedCSSRule>A rule list with additional utility methods.Extended CSS style declaration.An extended CSS style rule.ExtendedCSSStyleSheet<R extends ExtendedCSSRule>A style sheet.Extends the CSSValue interface to provide a couple serialization methods, and extendCloneable
.ExtendedCSSValueList<E extends ExtendedCSSValue>AugmentedCSSValueList
interface.Based on W3C's MediaQueryList interface.Listen to changes in media queries.This style declaration belongs to a DOM node.Adds an alpha channel to W3C'sRGBColor
interface.Enumeration of color spaces.High-level handling of SAC errors and warnings.SAC Parser Factory used by static methods.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.