private void addToBlockLevelBox(final LayoutContext context)
throws NormalizationException
{
final FlowContext fc = (FlowContext) flowContexts.peek();
final CSSValue displayRole = context.getValue(BoxStyleKeys.DISPLAY_ROLE);
if (DisplayRole.INLINE.equals(displayRole))
{
// special treatment for a inline box that is added to a block-parent
// Generate the paragraph box ..
if (reactivateSuspendedInlines(fc) == false)
{
// todo: check for possibly suspended inlines and reactivate them
final StyleResolver styleResolver = layoutProcess.getStyleResolver();
final ContextId id = new ContextId(ContextId.SOURCE_DISPLAY_MODEL, -1, 0);
final LayoutContext paragraphContext =
styleResolver.createAnonymousContext(id, context);
fc.addElement(MODEL_INLINE_INSIDE, FLAG_AUTOGENERATED | TYPE_PARAGRAPH, paragraphContext);
contentGenerator.startedRootInline(paragraphContext);
}
// now add the element ..
final CSSValue displayModel = context.getValue(BoxStyleKeys.DISPLAY_MODEL);
if (DisplayModel.TABLE.equals(displayModel))
{
fc.addElement(MODEL_TABLE, TYPE_INLINE, context);
contentGenerator.startedTable(context);
}
else if (DisplayModel.INLINE_INSIDE.equals(displayModel))
{
fc.addElement(MODEL_INLINE_INSIDE, TYPE_INLINE, context);
contentGenerator.startedInline(context);
}
else
{
fc.addElement(MODEL_BLOCK_INSIDE, TYPE_BLOCK, context);
contentGenerator.startedBlock(context);
}
return;
}
// Todo: need to check for run-in and compact as well..
// Everything else is considered a block-level element and treated as such..
final CSSValue displayModel = context.getValue(BoxStyleKeys.DISPLAY_MODEL);
if (DisplayModel.TABLE.equals(displayModel))
{
fc.addElement(MODEL_TABLE, TYPE_TABLE, context);
contentGenerator.startedTable(context);
}