private static void layoutBlockChild0(LayoutContext c, BlockBox parent, BlockBox child, boolean needPageClear, int childOffset, int trimmedPageCount) { child.setNeedPageClear(needPageClear); child.initStaticPos(c, parent, childOffset); child.initContainingLayer(c); child.calcCanvasLocation(); c.translate(0, childOffset); repositionBox(c, child, trimmedPageCount); child.layout(c); c.translate(-child.getX(), -child.getY()); }
public void positionAbsoluteOnPage(LayoutContext c) { if (c.isPrint() && (getStyle().isForcePageBreakBefore() || isNeedPageClear())) { forcePageBreakBefore(c, getStyle().getIdent(CSSName.PAGE_BREAK_BEFORE), false); calcCanvasLocation(); calcChildLocations(); setNeedPageClear(false); } }
public void positionAbsoluteOnPage(LayoutContext c) { if (c.isPrint() && (getStyle().isForcePageBreakBefore() || isNeedPageClear())) { forcePageBreakBefore(c, getStyle().getIdent(CSSName.PAGE_BREAK_BEFORE), false); calcCanvasLocation(); calcChildLocations(); setNeedPageClear(false); } }
private static void layoutBlockChild0(LayoutContext c, BlockBox parent, BlockBox child, boolean needPageClear, int childOffset, int trimmedPageCount) { child.setNeedPageClear(needPageClear); child.initStaticPos(c, parent, childOffset); child.initContainingLayer(c); child.calcCanvasLocation(); c.translate(0, childOffset); repositionBox(c, child, trimmedPageCount); child.layout(c); c.translate(-child.getX(), -child.getY()); }
private void layoutAbsoluteChildren(LayoutContext c) { List children = getChildren(); if (children.size() > 0) { LayoutState state = c.captureLayoutState(); for (int i = 0; i < children.size(); i++) { Layer child = (Layer)children.get(i); if (child.isRequiresLayout()) { layoutAbsoluteChild(c, child); if (child.getMaster().getStyle().isAvoidPageBreakInside() && child.getMaster().crossesPageBreak(c)) { child.getMaster().reset(c); ((BlockBox)child.getMaster()).setNeedPageClear(true); layoutAbsoluteChild(c, child); if (child.getMaster().crossesPageBreak(c)) { child.getMaster().reset(c); layoutAbsoluteChild(c, child); } } child.setRequiresLayout(false); child.finish(c); c.getRootLayer().ensureHasPage(c, child.getMaster()); } } c.restoreLayoutState(state); } }
List children = getChildren(); if (children.size() > 0) { LayoutState state = c.captureLayoutState(); for (int i = 0; i < children.size(); i++) { Layer child = (Layer)children.get(i); if (child.isRequiresLayout()) { layoutAbsoluteChild(c, child); if (child.getMaster().getStyle().isAvoidPageBreakInside() && child.getMaster().crossesPageBreak(c)) { child.getMaster().reset(c); ((BlockBox)child.getMaster()).setNeedPageClear(true); layoutAbsoluteChild(c, child); if (child.getMaster().crossesPageBreak(c)) { child.getMaster().reset(c); layoutAbsoluteChild(c, child); } } child.setRequiresLayout(false); child.finish(c); c.getRootLayer().ensureHasPage(c, child.getMaster()); } } c.restoreLayoutState(state); } } private void layoutAbsoluteChild(LayoutContext c, Layer child) {
int orphans = (int)getStyle().asFloat(CSSName.ORPHANS); if (i - noContentLBs < orphans) { setNeedPageClear(true); } else { LineBox lastLineBox = (LineBox)getChild(cCount-1); if (cCount - 1 - i - noContentLBs < widows) { if (cCount - 1 - widows < orphans) { setNeedPageClear(true); } else if (tryAgain) { int breakAtLine = cCount - 1 - widows;
int orphans = (int)getStyle().asFloat(CSSName.ORPHANS); if (i - noContentLBs < orphans) { setNeedPageClear(true); } else { LineBox lastLineBox = (LineBox)getChild(cCount-1); if (cCount - 1 - i - noContentLBs < widows) { if (cCount - 1 - widows < orphans) { setNeedPageClear(true); } else if (tryAgain) { int breakAtLine = cCount - 1 - widows;
private static void repositionBox(LayoutContext c, BlockBox child, int trimmedPageCount) { boolean moved = false; if (child.getStyle().isRelative()) { Dimension delta = child.positionRelative(c); c.translate(delta.width, delta.height); moved = true; } if (c.isPrint()) { boolean pageClear = child.isNeedPageClear() || child.getStyle().isForcePageBreakBefore(); boolean needNewPageContext = child.checkPageContext(c); if (needNewPageContext && trimmedPageCount != NO_PAGE_TRIM) { c.getRootLayer().trimPageCount(trimmedPageCount); } if (pageClear || needNewPageContext) { int delta = child.forcePageBreakBefore( c, child.getStyle().getIdent(CSSName.PAGE_BREAK_BEFORE), needNewPageContext); c.translate(0, delta); moved = true; child.setNeedPageClear(false); } } if (moved) { child.calcCanvasLocation(); } }
private static void repositionBox(LayoutContext c, BlockBox child, int trimmedPageCount) { boolean moved = false; if (child.getStyle().isRelative()) { Dimension delta = child.positionRelative(c); c.translate(delta.width, delta.height); moved = true; } if (c.isPrint()) { boolean pageClear = child.isNeedPageClear() || child.getStyle().isForcePageBreakBefore(); boolean needNewPageContext = child.checkPageContext(c); if (needNewPageContext && trimmedPageCount != NO_PAGE_TRIM) { c.getRootLayer().trimPageCount(trimmedPageCount); } if (pageClear || needNewPageContext) { int delta = child.forcePageBreakBefore( c, child.getStyle().getIdent(CSSName.PAGE_BREAK_BEFORE), needNewPageContext); c.translate(0, delta); moved = true; child.setNeedPageClear(false); } } if (moved) { child.calcCanvasLocation(); } }
pageCount = c.getRootLayer().getPages().size(); child.setNeedPageClear(false);
pageCount = c.getRootLayer().getPages().size(); child.setNeedPageClear(false);