1404 lines · 30.7 KB · Text
RawDownload
CSS style declaration bytecode============================== Format------ <opcode+flags+value> [<parameters>] <opcode+flags+value> 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 4-7: Must Be Zero (MBZ)	bits 1-3: Generic value		000 => no generic value		001 => inherit		010 => initial		011 => revert		100 => unset	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 containsa fixed point value with 22 bits assigned to the integer part and 10 bitsassigned to the fractional part. Strings are stored as a 32bit index into a table of interned string pointers.The table is found in the stylesheet object. CSS dimensions are stored as two 32bit values: <length, units>.Length is a 32bit numeric value (as described above) and unit is as follows: 	bit 8 set => 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			00001000 => ch			00001001 => rem			00001010 => lh			00001011 => vh			00001100 => vw			00001101 => vi			00001110 => vb			00001111 => vmin			00010000 => vmax			00010001 => q 	bit 9 set => percentage unit		bits 9-31: MBZ		bits 0-7 : MBZ 	bit 10 set => angle unit		bits 10-31: MBZ		bit 8     : MBZ		bits 0-7  :			00000000 => deg			00000001 => grad			00000010 => rad			00000011 => turn 	bit 11 set => time unit		bits 11-31: MBZ		bits 8-9  : MBZ		bits 0-7  :			00000000 => ms			00000001 => s 	bit 12 set => frequency unit		bits 12-31: MBZ		bits 8-10 : MBZ		bits 0-7  :			00000000 => Hz			00000001 => kHz 	bit 13 set => resolution unit		bits 13-31: MBZ		bits 8-11 : MBZ		bits 0-7  :			00000000 => dpi			00000001 => dpcm			00000010 => dppx CSS colours are stored as one 32bit value. See "Colour" for their format. Shorthand properties-------------------- The CSS shorthand properties are handled by decomposing them to theircomponent parts, and then creating bytecode for these. For example, "background: red none no-repeat scroll left top !important;" wouldbe 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	<value> (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	<value> (14bits) :		0     => fixed		1     => scroll		other => Reserved for future expansion. 02 - background-color	<value> (14bits) :		bit 8-13: MBZ		bit 7 set => colour follows.			bits 0-6: MBZ		bit 7 clear => keyword colour:			bits 0-6: 0000000 => transparent,				  0000001 => currentColor,				  other   => rffe. 03 - background-image	<value> (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	<value> (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	<value> (14bits) :		0     => no-repeat		1     => repeat-x		2     => repeat-y		3     => repeat		other => Reserved for future expansion. 06 - border-collapse	<value> (14bits) :		0     => separate		1     => collapse		other => Reserved for future expansion. 07 - border-spacing	<value> (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-color09 - border-right-color0a - border-bottom-color0b - border-left-color	<value> (14bits) :		bits 8-13: MBZ		bit 7 set => colour follows.			bits 0-6: MBZ		bit 7 clear => keyword colour:			bits 0-6: 0000000 => transparent,				  0000001 => currentColor,				  other   => rffe. 0c - border-top-style0d - border-right-style0e - border-bottom-style0f - border-left-style	<value> (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-width11 - border-right-width12 - border-bottom-width13 - border-left-width	<value> (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	<value> (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	<value> (14bits) :		0     => top		1     => bottom		other => Reserved for future expansion. 16 - clear	<value> (14bits) :		0     => none		1     => left		2     => right		3     => both		other => Reserved for future expansion. 17 - clip	<value> (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 <top>, <right>, <bottom>, <left> is set to auto. The	subsequent parameter list is then 4 - <auto_side> 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	<value> (14bits) :		bits 8-13: MBZ		bits 0-7:			bit 7: set => colour follows.					bits 0-6: MBZ.			       clear => keywords:			       		bits 0-6: 0000000 => transparent,						  0000001 => currentColor,						  other   => rffe. 19 - content	<value> (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 8-13 : list-style-type					  0000011 => counters,						     bits 8-13 : 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 a generic value ("inherit",	"initial", "unset", or "revert"), then there is a parameter list.	Each item is preceded by a <value> 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> <ptr to "http://example.com">	<00000080> <ptr to " : ">	<00000084> <ptr to "name">	<00000080> <ptr to " ">	<00000382> <ptr to "x">	<00000080> <ptr to ".">	<00000383> <ptr to "y"> <ptr to ".">	<00000003> <00000000> 1a - counter-increment	<value> (14bits) :		bits 8-13: MBZ		bits 0-7 :			bit 7 set => <string, integer> pair follows				bits 0-6: 0000000 => <string, integer> pair					  other   => rffe.			bit 7 clear => keywords:				bits 0-6: 0000000 => none,					  other   => rffe. 	If the value is not "none", or a generic value ("inherit",	"initial", "unset", or "revert"), then there is a parameter	list. Each item is preceded by a <value> 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	<value> (14bits) :		bits 8-13: MBZ		bits 0-7 :			bit 7 set => <string, integer> pair follows				bits 0-6: 0000000 => <string, integer> pair,					  other   => rffe.			bit 7 clear => keywords:				bits 0-6: 0000000 => none,					  other   => rffe. 	If the value is not "none", or a generic value ("inherit",	"initial", "unset", or "revert"), then there is a parameter	list. Each item is preceded by a <value> 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	<value> (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	<value> (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	<value> (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 <value> word which declares	the type of the next item. The list is terminated by a word with	bit 7 clear. 1f - direction	<value> (14bits) :		0     => ltr,		1     => rtl,		other => Reserved for future expansion. 20 - display	<value> (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,		10    => flex,		11    => inline-flex,		12    => grid,		13    => inline-grid		other => Reserved for future expansion. 21 - elevation	<value> (14bits) :		bits 8-13: MBZ

Lines 1–500 of 1404.