Labs/Thunderhead/CSS

From MozillaWiki
Jump to: navigation, search

Thunderhead and CSS

Thunderhead ("Th" for short) uses CSS to style its canvas-rendered components. This requires Thunderhead to process CSS itself and define how DOM-centric CSS concepts are to be applied to its own components. This page describes the Thunderhead implementation.

Selectors

Thunderhead presently implements its own selector-parsing implementation. It is anticipated that this will be replaced with Acme or Sizzle, if possible. Current support is limited to:

  • Type selectors: Scrollbar, Button
  • ID selectors: #someId, Scrollbar#otherId
  • Class selectors: .myClass, Button#myClass
  • Ancestor selectors: Scrollbar Button (note, only TWO selectors separated by a space are presently supported)
  • Child selectors: Scrollbar > Button (note, only TWO selectors separated by one space, the "greater than" symbol, and one space are presently supported)

Assigning property values, Cascading, and Inheritance

  • Values do not pass through the specified, computed, used, and actual phases; they are simply "specified" at the moment
  • Inheritance is not yet implemented
  • @import is not yet implemented
  • Cascade is implemented, but there is no way for user sheets to be specified
    • Rule specificity is a joke at the moment
    • !important is not yet implemented

Box model

  • Thunderhead components use the CSS box model, but this is not yet fully implemented.

Visual formatting model

  • Thunderhead makes no attempt to do anything like CSS layout, so nothing in the CSS visual formatting model applies

Colors and Backgrounds

  • color: not yet supported
  • background-color: not yet supported
  • background-image: not yet supported
  • background-repeat: not yet supported
  • background-attachment: not yet supported
  • background-position: not yet supported
  • background: not yet supported

Colors

Color values are passed directly to underlying canvas without processing; Th supports whatever the browser supports.

Lengths

Pixel (px) and percentage (%) units are the only ones presently supported. More may come.