Top Description Inners Fields Constructors Methods
com.openhtmltopdf.layout

public Class BlockBoxing

extends Object
Class Inheritance
Imports
java.awt.Dimension, java.util.List, .TreeSet, com.openhtmltopdf.css.constants.CSSName, .IdentValue, com.openhtmltopdf.layout.LayoutContext.BlockBoxingState, com.openhtmltopdf.render.BlockBox, .Box, .LineBox, .PageBox, .BlockBox.ContentType

Utility class for laying block content. It is called when a block box contains block level content. BoxBuilder will have made sure that the block we're working on will either contain only inline or block content. If we're in a paged media environment, the various page break related properties are also handled here. If a rule is violated, the affected run of boxes will be layed out again. If the rule still cannot be satisfied, the rule will be dropped.

Important Note

This is quite hard to get right without causing an explosion of layouts caused by re-attempts to satisfy page-break-inside: avoid in deeply nested content. Please be careful when editing these functions.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract static class
private static class

Field Summary

Modifier and TypeField and Description
private static final int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static boolean
avoidPageBreakBetween(BlockBox previous, BlockBox current)

If we should try to avoid a page break between two block boxes.

private static LineBox
private static boolean
isPageBreakBetweenChildBoxes(BlockBoxing.AbstractRelayoutDataList relayoutDataList, int runStart, int runEnd, LayoutContext c, BlockBox block)

private static void
layoutBlockChild(LayoutContext c, BlockBox parent, BlockBox child, boolean needPageClear, int childOffset, int trimmedPageCount, LayoutState layoutState)

private static void
layoutBlockChild0(LayoutContext c, BlockBox parent, BlockBox child, boolean needPageClear, int childOffset, int trimmedPageCount)

public static void
private static Integer
processPageBreakAvoidRun(LayoutContext c, BlockBox block, List<Box> localChildren, int offset, BlockBoxing.AbstractRelayoutDataList relayoutDataList, BlockBox childBox)

private static int
relayoutRun(LayoutContext c, List<Box> localChildren, BlockBox block, BlockBoxing.AbstractRelayoutDataList relayoutDataList, int start, int end, boolean onNewPage)

private static void
repositionBox(LayoutContext c, BlockBox child, int trimmedPageCount)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

NO_PAGE_TRIMback to summary
private static final int NO_PAGE_TRIM

Constructor Detail

BlockBoxingback to summary
private BlockBoxing()

Method Detail

avoidPageBreakBetweenback to summary
public static boolean avoidPageBreakBetween(BlockBox previous, BlockBox current)

If we should try to avoid a page break between two block boxes.

getFirstLineback to summary
private static LineBox getFirstLine(Box box)
isPageBreakBetweenChildBoxesback to summary
private static boolean isPageBreakBetweenChildBoxes(BlockBoxing.AbstractRelayoutDataList relayoutDataList, int runStart, int runEnd, LayoutContext c, BlockBox block)
layoutBlockChildback to summary
private static void layoutBlockChild(LayoutContext c, BlockBox parent, BlockBox child, boolean needPageClear, int childOffset, int trimmedPageCount, LayoutState layoutState)
layoutBlockChild0back to summary
private static void layoutBlockChild0(LayoutContext c, BlockBox parent, BlockBox child, boolean needPageClear, int childOffset, int trimmedPageCount)
layoutContentback to summary
public static void layoutContent(LayoutContext c, BlockBox block, int contentStart)

Lays out a BlockBox where BlockBox#getChildrenContentType() is ContentType#BLOCK.

processPageBreakAvoidRunback to summary
private static Integer processPageBreakAvoidRun(LayoutContext c, BlockBox block, List<Box> localChildren, int offset, BlockBoxing.AbstractRelayoutDataList relayoutDataList, BlockBox childBox)
relayoutRunback to summary
private static int relayoutRun(LayoutContext c, List<Box> localChildren, BlockBox block, BlockBoxing.AbstractRelayoutDataList relayoutDataList, int start, int end, boolean onNewPage)
repositionBoxback to summary
private static void repositionBox(LayoutContext c, BlockBox child, int trimmedPageCount)
com.openhtmltopdf.layout back to summary

private abstract Class BlockBoxing.AbstractRelayoutDataList

extends Object
Class Inheritance
  • java.lang.Object
  • com.openhtmltopdf.layout.BlockBoxing.AbstractRelayoutDataList
Known Direct Subclasses
com.openhtmltopdf.layout.BlockBoxing.LiteRelayoutDataList

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract void
configureRun(int boxIndex, BlockBox previous, BlockBox current)

pack-priv abstract int
getChildOffset(int boxIndex)

pack-priv abstract LayoutState
getLayoutState(int boxIndex)

pack-priv abstract int
getRunStart(int endRunIndex)

pack-priv abstract boolean
isEndsRun(int boxIndex)

pack-priv abstract void
setChildOffset(int boxIndex, int childOffset)

pack-priv abstract void
setLayoutState(int boxIndex, LayoutState state)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AbstractRelayoutDataListback to summary
private AbstractRelayoutDataList()

Method Detail

configureRunback to summary
pack-priv abstract void configureRun(int boxIndex, BlockBox previous, BlockBox current)
getChildOffsetback to summary
pack-priv abstract int getChildOffset(int boxIndex)
getLayoutStateback to summary
pack-priv abstract LayoutState getLayoutState(int boxIndex)
getRunStartback to summary
pack-priv abstract int getRunStart(int endRunIndex)
isEndsRunback to summary
pack-priv abstract boolean isEndsRun(int boxIndex)
setChildOffsetback to summary
pack-priv abstract void setChildOffset(int boxIndex, int childOffset)
setLayoutStateback to summary
pack-priv abstract void setLayoutState(int boxIndex, LayoutState state)
com.openhtmltopdf.layout back to summary

private Class BlockBoxing.LiteRelayoutDataList

extends AbstractRelayoutDataList
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final int[]
pack-priv final LayoutState[]
pack-priv TreeSet<Integer>
pack-priv TreeSet<Integer>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addRunEnd(int boxIndex)

pack-priv void
addRunStart(int boxIndex)

public void
configureRun(int offset, BlockBox previous, BlockBox current)

Implements abstract com.openhtmltopdf.layout.BlockBoxing.AbstractRelayoutDataList.configureRun.

Marks two consecutive block boxes as being in a run of boxes where a page break should not occur between them as set in the page-break-after and page-break-before CSS properties.

pack-priv int
pack-priv LayoutState
pack-priv int
pack-priv boolean
pack-priv boolean
isInRun(int boxIndex)

pack-priv void
pack-priv void

Field Detail

childOffsetsback to summary
pack-priv final int[] childOffsets
layoutStatesback to summary
pack-priv final LayoutState[] layoutStates
runEndsback to summary
pack-priv TreeSet<Integer> runEnds
runStartsback to summary
pack-priv TreeSet<Integer> runStarts

Constructor Detail

LiteRelayoutDataListback to summary
pack-priv LiteRelayoutDataList(int size)

Method Detail

addRunEndback to summary
pack-priv void addRunEnd(int boxIndex)
addRunStartback to summary
pack-priv void addRunStart(int boxIndex)
configureRunback to summary
public void configureRun(int offset, BlockBox previous, BlockBox current)

Implements abstract com.openhtmltopdf.layout.BlockBoxing.AbstractRelayoutDataList.configureRun.

Marks two consecutive block boxes as being in a run of boxes where a page break should not occur between them as set in the page-break-after and page-break-before CSS properties.

Annotations
@Override
getChildOffsetback to summary
pack-priv int getChildOffset(int boxIndex)

Implements abstract com.openhtmltopdf.layout.BlockBoxing.AbstractRelayoutDataList.getChildOffset.

Annotations
@Override
getLayoutStateback to summary
pack-priv LayoutState getLayoutState(int boxIndex)

Implements abstract com.openhtmltopdf.layout.BlockBoxing.AbstractRelayoutDataList.getLayoutState.

Annotations
@Override
getRunStartback to summary
pack-priv int getRunStart(int endRunIndex)

Implements abstract com.openhtmltopdf.layout.BlockBoxing.AbstractRelayoutDataList.getRunStart.

Annotations
@Override
isEndsRunback to summary
pack-priv boolean isEndsRun(int boxIndex)

Implements abstract com.openhtmltopdf.layout.BlockBoxing.AbstractRelayoutDataList.isEndsRun.

Annotations
@Override
isInRunback to summary
pack-priv boolean isInRun(int boxIndex)
setChildOffsetback to summary
pack-priv void setChildOffset(int boxIndex, int childOffset)

Implements abstract com.openhtmltopdf.layout.BlockBoxing.AbstractRelayoutDataList.setChildOffset.

Annotations
@Override
setLayoutStateback to summary
pack-priv void setLayoutState(int boxIndex, LayoutState state)

Implements abstract com.openhtmltopdf.layout.BlockBoxing.AbstractRelayoutDataList.setLayoutState.

Annotations
@Override