CSS style declaration bytecode ============================== Format ------ [] is 32 bits wide: bits 18-31: value bits 10-17 : flags bits 0-9 : opcode The 8 bits of flag data are defined as follows: bits 2-7: MBZ bit 1 : value is inherit bit 0 : value is important The 14 bits of value are opcode-specific. Parameters are opcode-specific. Each parameter must begin on a 4 byte boundary. Datatype storage ---------------- All numeric values are stored in a 32bit wide field. This field contains a fixed point value with 22 bits assigned to the integer part and 10 bits assigned to the fractional part. Strings are stored as a pointer to an interned string. The pointer's width is the native width of a pointer on the platform. CSS dimensions are stored as two 32bit values: . Length is a 32bit numeric value (as described above) and unit is as follows: bit 8 clear => length unit bits 9-31: MBZ bits 0-7 : 00000000 => px 00000001 => ex 00000010 => em 00000011 => in 00000100 => cm 00000101 => mm 00000110 => pt 00000111 => pc bit 8 set => percentage unit bits 9-31: MBZ bits 0-7 : MBZ bit 9 set => angle unit bits 10-31: MBZ bit 8 : MBZ bits 0-7 : 00000000 => deg 00000001 => grad 00000010 => rad bit 10 set => time unit bits 11-31: MBZ bits 8-9 : MBZ bits 0-7 : 00000000 => ms 00000001 => s bit 11 set => frequency unit bits 12-31: MBZ bits 8-10 : MBZ bits 0-7 : 00000000 => Hz 00000001 => kHz CSS colours are stored as one 32bit value: bits 24-31: Red component bits 16-23: Green component bits 8-15 : Blue component bits 0-7 : Alpha component Shorthand properties -------------------- The CSS shorthand properties are handled by decomposing them to their component parts, and then creating bytecode for these. For example, "background: red none no-repeat scroll left top !important;" would be decomposed to: background-color: red !important; background-image: none !important; background-repeat: no-repeat !important; background-attachment: scroll !important; background-position: left top !important; and bytecode generated for each of these properties. The full list of CSS 2.1 shorthand properties is: background border-color border-style border-{top,right,bottom,left} border-width border cue font list-style margin outline padding pause Opcodes ------- 00 - azimuth (14bits) : bits 8-13: MBZ bit 7 set => angle follows. bits 0-6: MBZ bit 6 set => relative movement: bit 7 : MBZ bits 1-5: MBZ bit 0 : set => rightwards, clear => leftwards bits 6 & 7 clear => keyword position: bit 5 : set => behind, clear => in front bits 0-4: 00000 => left-side 00001 => far-left 00010 => left 00011 => center-left 00100 => center 00101 => center-right 00110 => right 00111 => far-right 01000 => right-side other => Reserved for future expansion. 01 - background-attachment (14bits) : 0 => fixed 1 => scroll other => Reserved for future expansion. 02 - background-color (14bits) : bit 8-13: MBZ bit 7 set => colour follows. bits 0-6: MBZ bit 7 clear => keyword colour: bits 1-6: MBZ bit 0 : clear => transparent, set => rffe. 03 - background-image (14bits) : bits 8-13: MBZ bit 7 set => uri string follows. bits 0-6: MBZ bit 7 clear => keyword: bits 1-6: MBZ bit 0 : clear => none, set => rffe. 04 - background-position (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => percentage or length unit follows bits 4-6: MBZ clear => keywords: bits 4-6: 000 => center 001 => right 010 => left other => rffe bit 3: set => percentage or length unit follows bits 0-2: MBZ clear => keywords: bits 0-2: 000 => center 001 => bottom 010 => top other => rffe 05 - background-repeat (14bits) : 0 => no-repeat 1 => repeat-x 2 => repeat-y 3 => repeat other => Reserved for future expansion. 06 - border-collapse (14bits) : 0 => separate 1 => collapse other => Reserved for future expansion. 07 - border-spacing (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => two lengths follow bits 0-6: MBZ clear => Reserved for future expansion. bits 0-6: MBZ 08 - border-top-color 09 - border-right-color 0a - border-bottom-color 0b - border-left-color (14bits) : bits 8-13: MBZ bit 7 set => colour follows. bits 0-6: MBZ bit 7 clear => keyword colour: bits 1-6: MBZ bit 0 : clear => transparent, set => rffe. 0c - border-top-style 0d - border-right-style 0e - border-bottom-style 0f - border-left-style (14bits) : bits 8-13: MBZ bits 0-7 : 00000000 => none, 00000001 => hidden, 00000010 => dotted, 00000011 => dashed, 00000100 => solid, 00000101 => double, 00000110 => groove, 00000111 => ridge, 00001000 => inset, 00001001 => outset, other => Reserved for future expansion. 10 - border-top-width 11 - border-right-width 12 - border-bottom-width 13 - border-left-width (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => thin, 0000001 => medium, 0000010 => thick, other => rffe. 14 - bottom (14bits) : bits 8-13: MBZ bits 0-7: bit 7 set => length/percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 15 - caption-side (14bits) : 0 => top 1 => bottom other => Reserved for future expansion. 16 - clear (14bits) : 0 => none 1 => left 2 => right 3 => both other => Reserved for future expansion. 17 - clip (14bits) : bits 8-13: MBZ bits 0-7: bit 7 set => shape follows bits 0-2: 000 => rect, bit 3 => top auto bit 4 => right auto bit 5 => bottom auto bit 6 => left auto other => rffe. bits 3-6: MBZ. bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. If the value is rect(top, right, bottom, left), then bits 3-6 encode which of , , , is set to auto. The subsequent parameter list is then 4 - entries long. Each entry is a dimension. Entries are always ordered top, right, bottom, left. For example, clip: rect(10px, auto, auto, 10px) would produce the following bytecode: <02c00017> <00002800> <00000000> <00002800> <00000000> 18 - color (14bits) : bits 8-13: MBZ bits 0-7: bit 7: set => colour follows. bits 0-6: MBZ. clear => Reserved for future expansion. bits 0-6: MBZ. 19 - content (14bits) : bits 8-13: MBZ (except counter & counters, see below) bits 0-7 : bit 7 set => string follows bits 0-6: 0000000 => string, 0000001 => uri, 0000010 => counter, bits 12-13: MBZ bits 8-11 : list-style-type 0000011 => counters, bits 12-13: MBZ bits 8-11 : list-style-type 0000100 => attr, other => rffe. bit 7 clear => keywords: bits 0-6: 0000000 => normal, 0000001 => none, 0000010 => open-quote, 0000011 => close-quote, 0000100 => no-open-quote, 0000101 => no-close-quote, other => rffe. If the value is not "normal", "none", or "inherit", then there is a parameter list. Each item is preceded by a word which declares the type of the next item. The list is terminated by a word with all bits set to zero (the encoding for "normal"). For example, content: open-quote url('http://example.com/') " : " attr(name) " " counter(x) "." counters(y, ".") close-quote;" would result in the following bytecode: <00080019> <00000081> <00000080> <00000084> <00000080> <00000382> <00000080> <00000383> <00000003> <00000000> 1a - counter-increment (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => pair follows bits 0-6: 0000000 => pair other => rffe. bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. If the value is not "none", or "inherit", then there is a parameter list. Each item is preceded by a word which declares the type of the next item. The list is terminated by a word with all bits set to zero (the encoding for "none"). 1b - counter-reset (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => pair follows bits 0-6: 0000000 => pair, other => rffe. bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. If the value is not "none", or "inherit", then there is a parameter list. Each item is preceded by a word which declares the type of the next item. The list is terminated by a word with all bits set to zero (the encoding for "none"). 1c - cue-after (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => uri follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. 1d - cue-before (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => uri follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. 1e - cursor (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => uri follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, 0000001 => crosshair, 0000010 => default, 0000011 => pointer, 0000100 => move, 0000101 => e-resize, 0000110 => ne-resize, 0000111 => nw-resize, 0001000 => n-resize, 0001001 => se-resize, 0001010 => sw-resize, 0001011 => s-resize, 0001100 => w-resize, 0001101 => text, 0001110 => wait, 0001111 => help, 0010000 => progress, other => rffe. If the value indicates that a uri is present, then there is a parameter list. Each item is preceded by a word which declares the type of the next item. The list is terminated by a word with bit 7 clear. 1f - direction (14bits) : 0 => ltr, 1 => rtl, other => Reserved for future expansion. 20 - display (14bits) : 0 => inline, 1 => block, 2 => list-item, 3 => run-in, 4 => inline-block, 5 => table, 6 => inline-table, 7 => table-row-group, 8 => table-header-group, 9 => table-footer-group, a => table-row, b => table-column-group, c => table-column, d => table-cell, e => table-caption, f => none, other => Reserved for future expansion. 21 - elevation (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => angle follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => below, 0000001 => level, 0000010 => above, 0000011 => higher, 0000100 => lower, other => rffe. 22 - empty-cells (14bits) : 0 => show, 1 => hide, other => Reserved for future expansion. 23 - float (14bits) : 0 => left, 1 => right, 2 => none, other => Reserved for future expansion. 24 - font-family (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => data follows bits 1-6: MBZ bit 0 : clear => string, set => ident list (as string) bit 7 clear => keywords: bits 0-6: 0000000 => Reserved. 0000001 => serif, 0000010 => sans-serif, 0000011 => cursive, 0000100 => fantasy, 0000101 => monospace, other => rffe. In all cases, there is a parameter list. Each item is preceded by a word which declares the type of the next item. The list is terminated by a word with all bits clear. 25 - font-size (14bits) : bits 8-13: MBZ bits 0-7: bit 7 set => dimension follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => xx-small, 0000001 => x-small, 0000010 => small, 0000011 => medium, 0000100 => large, 0000101 => x-large, 0000110 => xx-large, 0000111 => larger, 0001000 => smaller, other => rffe. 26 - font-style (14bits) : 0 => normal, 1 => italic, 2 => oblique, other => Reserved for future expansion. 27 - font-variant (14bits) : 0 => normal, 1 => small-caps, other => Reserved for future expansion. 28 - font-weight (14bits) : 0 => normal, 1 => bold, 2 => bolder, 3 => lighter, 4 => 100, 5 => 200, 6 => 300, 7 => 400, 8 => 500, 9 => 600, a => 700, b => 800, c => 900, other => Reserved for future expansion. 29 - height (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 2a - left (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 2b - letter-spacing (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => normal, other => rffe. 2c - line-height (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length/number/percentage follows bits 0-6: 0000000 => number, 0000001 => dimension, other => rffe. bit 7 clear => keywords: bits 0-6: 0000000 => normal, other => rffe. 2d - list-style-image (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => string follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. 2e - list-style-position (14bits) : 0 => inside, 1 => outside, other => Reserved for future expansion. 2f - list-style-type (14bits) : 0 => disc, 1 => circle, 2 => square, 3 => decimal, 4 => decimal-leading-zero, 5 => lower-roman, 6 => upper-roman, 7 => lower-greek, 8 => lower-latin, 9 => upper-latin, a => armenian, b => georgian, c => lower-alpha, d => upper-alpha, e => none, other => Reserved for future expansion. 30 - margin-top 31 - margin-right 32 - margin-bottom 33 - margin-left (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 34 - max-height (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. 35 - max-width (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. 36 - min-height (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => length or percentage follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 37 - min-width (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => length or percentage follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 38 - orphans (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => integer follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 39 - outline-color (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => colour follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => invert, other => rffe. 3a - outline-style (14bits) : bits 8-13: MBZ bits 0-7 : 00000000 => none, 00000001 => hidden, 00000010 => dotted, 00000011 => dashed, 00000100 => solid, 00000101 => double, 00000110 => groove, 00000111 => ridge, 00001000 => inset, 00001001 => outset, other => Reserved for future expansion. 3b - outline-width (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => thin, 0000001 => medium, 0000010 => thick, other => rffe. 3c - overflow (14bits) : 0 => visible, 1 => hidden, 2 => scroll, 3 => auto, other => Reserved for future expansion. 3d - padding-top 3e - padding-right 3f - padding-bottom 40 - padding-left (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => length or percentage follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 41 - page-break-after (14bits) : 0 => auto, 1 => always, 2 => avoid, 3 => left, 4 => right, other => Reserved for future expansion. 42 - page-break-before (14bits) : 0 => auto, 1 => always, 2 => avoid, 3 => left, 4 => right, other => Reserved for future expansion. 43 - page-break-inside (14bits) : 0 => auto, 1 => avoid, other => Reserved for future expansion. 44 - pause-after (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => time or percentage follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 45 - pause-before (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => time or percentage follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 46 - pitch-range (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => number follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 47 - pitch (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => frequency follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => x-low, 0000001 => low, 0000010 => medium, 0000011 => high, 0000100 => x-high, other => rffe. 48 - play-during (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => string follows bit 6: set => mix, clear => don't mix bit 5: set => repeat, clear => no repeat bits 0-4: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, 0000001 => none, other => rffe. 49 - position (14bits) : 0 => static, 1 => relative, 2 => absolute, 3 => fixed, other => Reserved for future expansion. 4a - quotes (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => two strings follow bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. If the value indicates that strings are present, then there is a parameter list. Each item is preceded by a word which declares the type of the next item. The list is terminated by a word with all bits clear (the encoding for "none"). 4b - richness (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => number follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 4c - right (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 4d - speak-header (14bits) : 0 => once, 1 => always, other => Reserved for future expansion. 4e - speak-numeral (14bits) : 0 => digits, 1 => continuous, other => Reserved for future expansion. 4f - speak-punctuation (14bits) : 0 => code, 1 => none, other => Reserved for future expansion. 50 - speak (14bits) : 0 => normal, 1 => none, 2 => spell-out, other => Reserved for future expansion. 51 - speech-rate (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => number follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => x-slow, 0000001 => slow, 0000010 => medium, 0000011 => fast, 0000100 => x-fast, 0000101 => faster, 0000110 => slower, other => rffe. 52 - stress (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => number follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 53 - table-layout (14bits) : 0 => auto, 1 => fixed, other => Reserved for future expansion. 54 - text-align (14bits) : 0 => left, 1 => right, 2 => center, 3 => justify, other => Reserved for future expansion. 55 - text-decoration (14bits) : bits 8-13: MBZ bits 0-7 : 00000000 => none otherwise: bits 4-7: MBZ bit 3: set => blink, clear => no blink bit 2: set => line-through, clear => no line-through bit 1: set => overline, clear => no overline bit 0: set => underline, clear => no underline 56 - text-indent (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => length or percentage follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 57 - text-transform (14bits) : 0 => capitalize, 1 => uppercase, 2 => lowercase, 3 => none, other => Reserved for future expansion. 58 - top (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 59 - unicode-bidi (14bits) : 0 => normal, 1 => embed, 2 => bidi-override, other => Reserved for future expansion. 5a - vertical-align (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => baseline, 0000001 => sub, 0000010 => super, 0000011 => top, 0000100 => text-top, 0000101 => middle, 0000110 => bottom, 0000111 => text-bottom, other => rffe. 5b - visibility (14bits) : 0 => visible, 1 => hidden, 2 => collapse, other => Reserved for future expansion. 5c - voice-family (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => data follows bits 1-6: MBZ bit 0 : clear => string, set => ident list (as string) bit 7 clear => keywords: bits 0-6: 0000000 => Reserved. 0000001 => male, 0000010 => female, 0000011 => child, other => rffe. In all cases, there is a parameter list. Each item is preceded by a word which declares the type of the next item. The list is terminated by a word with all bits clear. 5d - volume (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => number/percentage follows bits 0-6: 0000000 => number, 0000001 => dimension, other => rffe. bit 7 clear => keywords: bits 0-6: 0000000 => silent, 0000001 => x-soft, 0000010 => soft, 0000011 => medium, 0000100 => loud, 0000101 => x-loud, other => rffe. 5e - white-space (14bits) : 0 => normal, 1 => pre, 2 => nowrap, 3 => pre-wrap, 4 => pre-line, other => Reserved for future expansion. 5f - widows (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => integer follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 60 - width (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 61 - word-spacing (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => normal, other => rffe. 62 - z-index (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => integer follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 63-3ff - Reserved for future expansion.