/** * Creation-Date: 01.12.2005, 19:15:04 * * @author Thomas Morgner */ public class ListStyleKeys { public static final StyleKey LIST_STYLE_IMAGE = StyleKeyRegistry.getRegistry() .createKey( "list-style-image", false, false, StyleKey.DOM_ELEMENTS | StyleKey.PSEUDO_MARKER); public static final StyleKey LIST_STYLE_TYPE = StyleKeyRegistry.getRegistry() .createKey( "list-style-type", false, false, StyleKey.DOM_ELEMENTS | StyleKey.PSEUDO_MARKER); public static final StyleKey LIST_STYLE_POSITION = StyleKeyRegistry.getRegistry() .createKey( "list-style-position", false, false, StyleKey.DOM_ELEMENTS | StyleKey.PSEUDO_MARKER); private ListStyleKeys() {} }
public void testParseStyleRule() throws Exception { final ResourceManager resourceManager = new ResourceManager(); resourceManager.registerDefaults(); StyleSheetParserUtil.getInstance() .parseStyleRule( null, "* { width: 10% }", null, null, resourceManager, StyleKeyRegistry.getRegistry()); }
/** * Tests the style resolution to make sure the <code>StyleResolver</code> class is initialized * correctly */ public void testStyleResolver() throws ResourceException { final StyleKey fontFamily = StyleKeyRegistry.getRegistry().findKeyByName("font-family"); final StyleKey fontSize = StyleKeyRegistry.getRegistry().findKeyByName("font-size"); final StyleKey fontWeight = StyleKeyRegistry.getRegistry().findKeyByName("font-weight"); final StyleKey fontStyle = StyleKeyRegistry.getRegistry().findKeyByName("font-style"); final StyleKey textAlign = StyleKeyRegistry.getRegistry().findKeyByName("text-align"); final StyleKey color = StyleKeyRegistry.getRegistry().findKeyByName("color"); final StyleKey backgroundColor = StyleKeyRegistry.getRegistry().findKeyByName("background-color"); assertNotNull("Could not retrieve the StyleKey for [font-family]", fontFamily); assertNotNull("Could not retrieve the StyleKey for [font-size]", fontSize); assertNotNull("Could not retrieve the StyleKey for [font-weight]", fontWeight); assertNotNull("Could not retrieve the StyleKey for [font-style]", fontStyle); assertNotNull("Could not retrieve the StyleKey for [text-align]", textAlign); assertNotNull("Could not retrieve the StyleKey for [color]", color); assertNotNull("Could not retrieve the StyleKey for [background-color]", backgroundColor); }
/** * Drop-Initials are left out for now. * * @author Thomas Morgner * @see http://www.w3.org/TR/css3-linebox/ */ public class LineStyleKeys { /** * The 'text-height' property determine the block-progression dimension of the text content area * of an inline box. */ public static final StyleKey TEXT_HEIGHT = StyleKeyRegistry.getRegistry().createKey("text-height", false, true, StyleKey.DOM_ELEMENTS); /** * Either one of the constants 'normal' or 'none' or a length, percentage or number. The computed * value is a result of a computation based on the current line-box and therefore is only valid * for that particluar linebox. */ public static final StyleKey LINE_HEIGHT = StyleKeyRegistry.getRegistry().createKey("line-height", false, true, StyleKey.All_ELEMENTS); /** * This property determines the line stacking strategy for stacked line boxes within a containing * block element. The term 'stack-height' is used in the context of this property description to * indicate the block-progression advance for the line boxes. */ public static final StyleKey LINE_STACKING_STRATEGY = StyleKeyRegistry.getRegistry() .createKey("line-stacking-strategy", false, true, StyleKey.All_ELEMENTS); /** Ruby is not implemented. */ public static final StyleKey LINE_STACKING_RUBY = StyleKeyRegistry.getRegistry() .createKey("line-stacking-ruby", false, true, StyleKey.All_ELEMENTS); /** This is a character level computation, we ignore that for now. */ public static final StyleKey LINE_STACKING_SHIFT = StyleKeyRegistry.getRegistry() .createKey("line-stacking-shift", false, true, StyleKey.All_ELEMENTS); public static final StyleKey BASELINE_SHIFT = StyleKeyRegistry.getRegistry() .createKey("baseline-shift", false, true, StyleKey.All_ELEMENTS); /** * This is a shorthand property for the 'dominant-baseline', 'alignment-baseline' and * 'alignment-adjust' properties. It has a different meaning in the context of table cells. */ public static final StyleKey VERTICAL_ALIGN = StyleKeyRegistry.getRegistry() .createKey("vertical-align", false, true, StyleKey.All_ELEMENTS); public static final StyleKey INLINE_BOX_ALIGN = StyleKeyRegistry.getRegistry() .createKey("inline-box-align", false, false, StyleKey.All_ELEMENTS); /** DominantBaseLine is not implemented. */ public static final StyleKey DOMINANT_BASELINE = StyleKeyRegistry.getRegistry() .createKey("dominant-baseline", false, true, StyleKey.All_ELEMENTS); public static final StyleKey ALIGNMENT_BASELINE = StyleKeyRegistry.getRegistry() .createKey("alignment-baseline", false, true, StyleKey.All_ELEMENTS); public static final StyleKey ALIGNMENT_ADJUST = StyleKeyRegistry.getRegistry() .createKey("alignment-adjust", false, true, StyleKey.All_ELEMENTS); public static final StyleKey DROP_INITIAL_AFTER_ADJUST = StyleKeyRegistry.getRegistry() .createKey("drop-initial-after-adjust", false, false, StyleKey.PSEUDO_FIRST_LETTER); public static final StyleKey DROP_INITIAL_AFTER_ALIGN = StyleKeyRegistry.getRegistry() .createKey("drop-initial-after-align", false, false, StyleKey.PSEUDO_FIRST_LETTER); public static final StyleKey DROP_INITIAL_BEFORE_ADJUST = StyleKeyRegistry.getRegistry() .createKey("drop-initial-before-adjust", false, false, StyleKey.PSEUDO_FIRST_LETTER); public static final StyleKey DROP_INITIAL_BEFORE_ALIGN = StyleKeyRegistry.getRegistry() .createKey("drop-initial-before-align", false, false, StyleKey.PSEUDO_FIRST_LETTER); public static final StyleKey DROP_INITIAL_SIZE = StyleKeyRegistry.getRegistry() .createKey("drop-initial-size", false, false, StyleKey.PSEUDO_FIRST_LETTER); public static final StyleKey DROP_INITIAL_VALUE = StyleKeyRegistry.getRegistry() .createKey("drop-initial-value", false, false, StyleKey.PSEUDO_FIRST_LETTER); private LineStyleKeys() {} }