public void resolve (final LayoutProcess process,
final LayoutElement currentNode,
final StyleKey key)
{
final LayoutContext layoutContext = currentNode.getLayoutContext();
final CSSValue displayModel = layoutContext.getValue(BoxStyleKeys.DISPLAY_MODEL);
if (DisplayRole.NONE.equals(displayModel))
{
// skip ... the element will not be displayed ...
layoutContext.setValue(PositioningStyleKeys.POSITION, Position.STATIC);
return;
}
final CSSValue rawValue = layoutContext.getValue(key);
if (rawValue instanceof CSSFunctionValue)
{
// OK; check for pending ..
final CSSFunctionValue function = (CSSFunctionValue) rawValue;
if ("running".equals(function.getFunctionName()))
{
// The element will be inside a block-context (same behaviour as
// for floats)
layoutContext.setValue(BoxStyleKeys.DISPLAY_MODEL, DisplayModel.BLOCK_INSIDE);
layoutContext.setValue(BoxStyleKeys.DISPLAY_ROLE, DisplayRole.BLOCK);
return;
}
layoutContext.setValue(PositioningStyleKeys.POSITION, Position.STATIC);
return;
}
final CSSConstant value = (CSSConstant) resolveValue(process, currentNode, key);
layoutContext.setValue(PositioningStyleKeys.POSITION, value);
if (Position.ABSOLUTE.equals(value) ||
Position.FIXED.equals(value))
{
// http://www.w3.org/TR/REC-CSS2/visuren.html#propdef-float
// this is specified in 9.7: Relationships between 'display',
// 'position', and 'float':
// Quote: Otherwise, 'position' has the value 'absolute' or 'fixed',
// 'display' is set to 'block' and 'float' is set to 'none'. The position
// of the box will be determined by the 'top', 'right', 'bottom' and
// 'left' properties and the box's containing block.
layoutContext.setValue(BoxStyleKeys.DISPLAY_MODEL, DisplayModel.BLOCK_INSIDE);
layoutContext.setValue(BoxStyleKeys.DISPLAY_ROLE, DisplayRole.BLOCK);
layoutContext.setValue(BoxStyleKeys.FLOAT, Floating.NONE);
}
}