private void addBoxID(LayoutContext c) { if (! isAnonymous()) { String name = c.getNamespaceHandler().getAnchorName(getElement()); if (name != null) { c.addBoxId(name, this); } String id = c.getNamespaceHandler().getID(getElement()); if (id != null) { c.addBoxId(id, this); } } }
public FSFontMetrics getFSFontMetrics(FSFont font) { return getTextRenderer().getFSFontMetrics(getFontContext(), font, ""); }
public void detach(LayoutContext c) { c.removeBoxId(getAnchorName()); }
private int getTextWidth(LayoutContext c, CalculatedStyle cs, String s) { return c.getTextRenderer().getWidth(c.getFontContext(), c.getFont(cs.getFont(c)), s); }
private LayoutContext newLayoutContext() { LayoutContext result = _sharedContext.newLayoutContextInstance(); result.setFontContext(new ITextFontContext()); _sharedContext.getTextRenderer().setup(result.getFontContext()); return result; }
remainingWidth -= c.getBlockFormattingContext().getFloatDistance(c, currentLine, remainingWidth); MarkerData markerData = c.getCurrentMarkerData(); if (markerData != null && box.getStyle().isListMarkerInside()) { remainingWidth -= markerData.getLayoutWidth(); contentStart += markerData.getLayoutWidth(); c.setCurrentMarkerData(null); if (c.getFirstLinesTracker().hasStyles()) { box.styleText(c, c.getFirstLinesTracker().deriveAll(box.getStyle())); hasFirstLinePEs = true; boolean needFirstLetter = c.getFirstLettersTracker().hasStyles(); boolean zeroWidthInlineBlock = false; String name = c.getNamespaceHandler().getAnchorName(currentIB.getElement()); if (name != null) { c.addBoxId(name, currentIB); String id = c.getNamespaceHandler().getID(currentIB.getElement()); if (id != null) { c.addBoxId(id, currentIB); c, iB.getStyle(), remainingWidth - fit, lbContext, false); if (lbContext.isUnbreakable() && ! currentLine.isContainsContent()) { int delta = c.getBlockFormattingContext().getNextLineBoxDelta(c, currentLine, maxAvailableWidth); if (delta > 0) { currentLine.setY(currentLine.getY() + delta);
pushedLayer = true; if (getLayer() == null) { c.pushLayer(this); } else { c.pushLayer(getLayer()); c.getRootLayer().setFixedBackground(true); c.pushBFC(bfc); if (c.isPrint() && getStyle().isIdent(CSSName.FS_PAGE_SEQUENCE, IdentValue.START)) { c.getRootLayer().addPageSequence(this); if (c.isPrint()) { PageBox firstPage = c.getRootLayer().getFirstPage(c, this); if (firstPage != null && firstPage.getTop() == getAbsY() - getPageClearance()) { resetTopMargin(c); if (getStyle().isListItem()) { createMarkerData(c); c.setCurrentMarkerData(getMarkerData()); didSetMarkerData = true; setTx(tx); setTy(ty); c.translate(getTx(), getTy()); if (! isReplaced()) layoutChildren(c, contentStart);
if (c.isPrint() && ! (localChildren instanceof RandomAccess)) { localChildren = new ArrayList(localChildren); if (c.isPrint()) { relayoutDataList = new RelayoutDataList(localChildren.size()); if (c.isPrint()) { relayoutData = relayoutDataList.get(offset); relayoutData.setLayoutState(c.copyStateForRelayout()); relayoutData.setChildOffset(childOffset); pageCount = c.getRootLayer().getPages().size(); && c.isMayCheckKeepTogether()) { mayCheckKeepTogether = true; c.setMayCheckKeepTogether(false); if (c.isPrint()) { if (mayCheckKeepTogether) { c.setMayCheckKeepTogether(true); boolean tryToAvoidPageBreak = child.getStyle().isAvoidPageBreakInside() && child.crossesPageBreak(c); boolean keepWithInline = child.isNeedsKeepWithInline(c); if (tryToAvoidPageBreak || needPageClear || keepWithInline) { c.restoreStateForRelayout(relayoutData.getLayoutState()); child.reset(c); layoutBlockChild( c.restoreStateForRelayout(relayoutData.getLayoutState());
FloatLayoutResult result = new FloatLayoutResult(); MarkerData markerData = c.getCurrentMarkerData(); c.setCurrentMarkerData(null); c.getBlockFormattingContext().floatBox(c, block); result.setPending(true); } else { if (c.isPrint()) { positionFloatOnPage(c, currentLine, block, initialY != block.getY()); c.getRootLayer().ensureHasPage(c, block); c.setCurrentMarkerData(markerData);
if (e.hasAttribute("name")) { String name = e.getAttribute("name"); c.addBoxId(name, box); result.setAnchorName(name);
public void reset(LayoutContext c) { resetChildren(c); if (_layer != null) { _layer.detach(); _layer = null; } setContainingLayer(null); setLayer(null); setPaintingInfo(null); setContentWidth(0); _workingMargin = null; String anchorName = c.getNamespaceHandler().getAnchorName(getElement()); if (anchorName != null) { c.removeBoxId(anchorName); } Element e = getElement(); if (e != null) { String id = c.getNamespaceHandler().getID(e); if (id != null) { c.removeBoxId(id); } } }
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) {
public float getXHeight(FontSpecification parentFont) { return _sharedContext.getXHeight(getFontContext(), parentFont); }
public int getRightFloatDistance() { return c.getBlockFormattingContext().getRightFloatDistance(c, current, maxAvailableWidth); } });
private void calcClearance(LayoutContext c) { if (getStyle().isCleared() && ! getStyle().isFloated()) { c.translate(0, -getY()); c.getBlockFormattingContext().clear(c, this); c.translate(0, getY()); calcCanvasLocation(); } }
public boolean isCurrentBreakAtLineContext(LayoutContext c) { BreakAtLineContext bContext = c.getBreakAtLineContext(); return bContext != null && bContext.getBlock() == this; }
public LayoutContext newLayoutContextInstance() { LayoutContext c = new LayoutContext(this); return c; }
private LayoutContext newLayoutContext() { LayoutContext result = _sharedContext.newLayoutContextInstance(); result.setFontContext(new ITextFontContext()); _sharedContext.getTextRenderer().setup(result.getFontContext()); return result; }
remainingWidth -= c.getBlockFormattingContext().getFloatDistance(c, currentLine, remainingWidth); MarkerData markerData = c.getCurrentMarkerData(); if (markerData != null && box.getStyle().isListMarkerInside()) { remainingWidth -= markerData.getLayoutWidth(); contentStart += markerData.getLayoutWidth(); c.setCurrentMarkerData(null); if (c.getFirstLinesTracker().hasStyles()) { box.styleText(c, c.getFirstLinesTracker().deriveAll(box.getStyle())); hasFirstLinePEs = true; boolean needFirstLetter = c.getFirstLettersTracker().hasStyles(); boolean zeroWidthInlineBlock = false; String name = c.getNamespaceHandler().getAnchorName(currentIB.getElement()); if (name != null) { c.addBoxId(name, currentIB); String id = c.getNamespaceHandler().getID(currentIB.getElement()); if (id != null) { c.addBoxId(id, currentIB); null : (InlineLayoutBox) currentIB.getParent(); remainingWidth = maxAvailableWidth; remainingWidth -= c.getBlockFormattingContext().getFloatDistance(c, currentLine, remainingWidth); currentIB.getElement() != c.getLayer().getMaster().getElement())) {
pushedLayer = true; if (getLayer() == null) { c.pushLayer(this); } else { c.pushLayer(getLayer()); c.getRootLayer().setFixedBackground(true); c.pushBFC(bfc); if (c.isPrint() && getStyle().isIdent(CSSName.FS_PAGE_SEQUENCE, IdentValue.START)) { c.getRootLayer().addPageSequence(this); if (c.isPrint()) { PageBox firstPage = c.getRootLayer().getFirstPage(c, this); if (firstPage != null && firstPage.getTop() == getAbsY() - getPageClearance()) { resetTopMargin(c); if (getStyle().isListItem()) { createMarkerData(c); c.setCurrentMarkerData(getMarkerData()); didSetMarkerData = true; setTx(tx); setTy(ty); c.translate(getTx(), getTy()); if (! isReplaced()) layoutChildren(c, contentStart);