RelayoutResult result = new RelayoutResult(); result.setFits(! c.getRootLayer().crossesPageBreak(c, startAbsY, endAbsY)); return result;
    private static RelayoutResult relayoutOnNewPage(            LayoutContext c, List contentList, BlockBox block,             StyleSetListener styleSetListener, RelayoutDataList relayoutDataList,             int start, int end) {                if (checkForPendingInlines(relayoutDataList, start, end)) {            RelayoutResult result = new RelayoutResult();            result.setCanceled(true);            return result;        }                block.height = relayoutDataList.get(start).getInitialParentHeight();        block.expandToPageBottom(c);                int startAbsY = block.getAbsY() + block.ty + block.height;        int endAbsY = 0;                for (int i = start; i <= end; i++) {            Content currentContent = (Content)contentList.get(i);                        RelayoutData relayoutData = relayoutDataList.get(i);            BlockBox childBox = null;            //TODO:handle run-ins. For now, treat them as blocks                        c.restoreStateForRelayout(relayoutData.getLayoutState());            childBox = layoutBlockChild(                    c, block, styleSetListener, relayoutData.getListIndex(),                   relayoutData.isResetMargins(), false, currentContent);                        if (childBox.getStyle().isAvoidPageBreakInside() &&                     childBox.crossesPageBreak(c)) {                c.restoreStateForRelayout(relayoutData.getLayoutState());                BlockBox secondTry = layoutBlockChild(                        c, block, styleSetListener, relayoutData.getListIndex(),                        relayoutData.isResetMargins(), true, currentContent);                                if (secondTry.crossesPageBreak(c)) {                    secondTry.detach();                } else {                    childBox.detach();                    childBox = secondTry;                }            }                        c.getRootLayer().ensureHasPage(c, childBox);                        block.adjustWidthForChild(childBox.getWidth());            block.height = childBox.y + childBox.height;                        if ((i == end && end == contentList.size()-1) ||                    (i == end - 1)) {                endAbsY = childBox.getAbsY() + childBox.getHeight();            }                        if (childBox.getStyle().isForcePageBreakAfter()) {                block.expandToPageBottom(c);            }        }                RelayoutResult result = new RelayoutResult();        result.setFits(! c.getRootLayer().crossesPageBreak(c, startAbsY, endAbsY));        return result;    }