public void removeRunningBlock(BlockBox block) { if (_runningBlocks == null) { return; } String identifier = block.getStyle().getRunningName(); List blocks = (List)_runningBlocks.get(identifier); if (blocks == null) { return; } blocks.remove(block); }
public Rectangle getPaintingClipEdge(CssContext cssCtx) { Rectangle result = super.getPaintingClipEdge(cssCtx); // HACK Don't know how wide the list marker is (or even where it is) // so extend the bounding box all the way over to the left edge of // the canvas if (getStyle().isListItem()) { int delta = result.x; result.x = 0; result.width += delta; } return result; }
private int calcPinnedHeight(CssContext c) { if (! getStyle().isIdent(CSSName.TOP, IdentValue.AUTO) && ! getStyle().isIdent(CSSName.BOTTOM, IdentValue.AUTO)) { int top = (int) getStyle().getFloatPropertyProportionalTo( CSSName.TOP, getContainingBlockWidth(), c); int bottom = (int) getStyle().getFloatPropertyProportionalTo( CSSName.BOTTOM, getContainingBlockWidth(), c); int result = getContainingBlock().getPaddingEdge(0, 0, c).height - top - bottom; return result < 0 ? 0 : result; } return -1; }
private void setCellWidths(LayoutContext c) { for (Iterator i = getChildIterator(); i.hasNext(); ) { BlockBox box = (BlockBox)i.next(); if (box.getStyle().isTableSection()) { ((TableSectionBox)box).setCellWidths(c); } } }
private void setCellWidths(LayoutContext c) { for (Iterator i = getChildIterator(); i.hasNext(); ) { BlockBox box = (BlockBox)i.next(); if (box.getStyle().isTableSection()) { ((TableSectionBox)box).setCellWidths(c); } } }
public void floatBox(LayoutContext c, Layer layer, BlockFormattingContext bfc, BlockBox box) { if (box.getStyle().isFloatedLeft()) { position(c, bfc, box, LEFT); save(box, layer, bfc, LEFT); } else if (box.getStyle().isFloatedRight()) { position(c, bfc, box, RIGHT); save(box, layer, bfc, RIGHT); } }
public BlockBox copyOf() { BlockBox result = new BlockBox(); result.setStyle(getStyle()); result.setElement(getElement()); return result; }
public TextFormField(LayoutContext c, BlockBox box, int cssWidth, int cssHeight) { initDimensions(c, box, cssWidth, cssHeight); float fontSize = box.getStyle().getFSFont(c).getSize2D(); // FIXME: findbugs possible loss of precision, cf. int / (float)2 _baseline = (int) (getHeight() / 2 + (fontSize * 0.3f)); }
public Point getOffset(BlockBox floater) { // FIXME inefficient (but probably doesn't matter) return getOffset(floater, floater.getStyle().isFloatedLeft() ? getFloats(LEFT) : getFloats(RIGHT)); }
public Point getOffset(BlockBox floater) { // FIXME inefficient (but probably doesn't matter) return getOffset(floater, floater.getStyle().isFloatedLeft() ? getFloats(LEFT) : getFloats(RIGHT)); }
public SelectFormField(LayoutContext c, BlockBox box, int cssWidth, int cssHeight) { _options = readOptions(box.getElement()); initDimensions(c, box, cssWidth, cssHeight); float fontSize = box.getStyle().getFSFont(c).getSize2D(); // FIXME: findbugs possible loss of precision, cf. int / (float)2 _baseline = (int)(getHeight() / 2 + (fontSize * 0.3f)); }
public SelectFormField(LayoutContext c, BlockBox box, int cssWidth, int cssHeight) { _options = readOptions(box.getElement()); initDimensions(c, box, cssWidth, cssHeight); float fontSize = box.getStyle().getFSFont(c).getSize2D(); _baseline = (int)(getHeight() / 2 + (fontSize * 0.3f)); }
protected void initDimensions(LayoutContext c, BlockBox box, int cssWidth, int cssHeight) { if (cssWidth != -1) { setWidth(cssWidth); } else { setWidth(calcDefaultWidth(c, box)); } if (cssHeight != -1) { setHeight(cssHeight); } else { setHeight((int) (box.getStyle().getLineHeight(c) * getSize(box.getElement()))); } }
private void calcExtraPageClearance(LayoutContext c) { if (c.isPageBreaksAllowed() && c.getExtraSpaceTop() > 0 && (getStyle().isSpecifiedAsBlock() || getStyle().isListItem())) { PageBox first = c.getRootLayer().getFirstPage(c, this); if (first != null && first.getTop() + c.getExtraSpaceTop() > getAbsY()) { int diff = first.getTop() + c.getExtraSpaceTop() - getAbsY(); setY(getY() + diff); c.translate(0, diff); calcCanvasLocation(); } } }
protected void initDimensions(LayoutContext c, BlockBox box, int cssWidth, int cssHeight) { if (cssWidth != -1) { setWidth(cssWidth); } else { setWidth(calcDefaultWidth(c, box)); } if (cssHeight != -1) { setHeight(cssHeight); } else { setHeight((int) (box.getStyle().getLineHeight(c) * getSize(box.getElement()))); } }
public boolean isNeedsKeepWithInline(LayoutContext c) { if (c.isPrint() && getStyle().isKeepWithInline()) { LineBox line = findFirstLineBox(); if (line != null) { PageBox linePage = c.getRootLayer().getFirstPage(c, line); PageBox ourPage = c.getRootLayer().getFirstPage(c, this); return linePage != null && ourPage != null && linePage.getPageNo() == ourPage.getPageNo()+1; } } return false; }
public boolean isNeedsKeepWithInline(LayoutContext c) { if (c.isPrint() && getStyle().isKeepWithInline()) { LineBox line = findFirstLineBox(); if (line != null) { PageBox linePage = c.getRootLayer().getFirstPage(c, line); PageBox ourPage = c.getRootLayer().getFirstPage(c, this); return linePage != null && ourPage != null && linePage.getPageNo() == ourPage.getPageNo()+1; } } return false; }