xml.make-anonymous-block-boxes.xpl Maven / Gradle / Ivy
Wrap inline boxes that have sibling block boxes in anonymous block boxes.
(http://braillespecs.github.io/braille-css/#anonymous-boxes).
The input is assumed to be a tree-of-boxes representation of a document where boxes
are represented by css:box elements. The document root and top-level elements in named
flows must be boxes or css:_ elements. The parent of a box must be another box (or a
css:_ element if it's the document root or a top-level element in a named flow). Inline
boxes must not have non-inline descendant boxes. Table-cell boxes must have a parent
table box and table boxes must have only table-cell child boxes. All other nodes must
have at least one inline box ancestor. If the input represents a named flow this must be
indicated with a css:flow attribute on the document element.
Adjacent inline boxes with one or more sibling block or table boxes are grouped and
wrapped in an anonymous block box. If all top-level boxes in the normal flow are inline
they are wrapped in an anonymous block box too. Top-level elements in a named flow that
are inline boxes are wrapped in an anonymous block box each and their css:anchor
attributes are moved to the anonymous block. Top-level elements in a named flow that are
css:_ elements are changed into anonymous block boxes.