public String toString() { StringBuffer sb = new StringBuffer(); sb.append("Box: "); sb.append(" (" + getAbsX() + "," + getAbsY() + ")->(" + getWidth() + " x " + getHeight() + ")"); return sb.toString(); }
public Rectangle getMarginEdge(int left, int top, CssContext cssCtx, int tx, int ty) { // Note that negative margins can mean this rectangle is inside the border // edge, but that's the way it's supposed to work... Rectangle result = new Rectangle(left, top, getWidth(), getHeight()); result.translate(tx, ty); return result; }
public String toString() { StringBuffer sb = new StringBuffer(); sb.append("Box: "); sb.append(" (" + getAbsX() + "," + getAbsY() + ")->(" + getWidth() + " x " + getHeight() + ")"); return sb.toString(); }
public Rectangle getMarginEdge(int left, int top, CssContext cssCtx, int tx, int ty) { // Note that negative margins can mean this rectangle is inside the border // edge, but that's the way it's supposed to work... Rectangle result = new Rectangle(left, top, getWidth(), getHeight()); result.translate(tx, ty); return result; }
private void applyLineHeightHack(CssContext cssCtx, Box line, Rectangle bounds) { // this is a hack to deal with lines w/o width or height. is this valid? // possibly, since the line doesn't know how long it should be until it's already // done float adjustments if (line.getHeight() == 0) { bounds.height = (int)line.getStyle().getLineHeight(cssCtx); } }
private void applyLineHeightHack(CssContext cssCtx, Box line, Rectangle bounds) { // this is a hack to deal with lines w/o width or height. is this valid? // possibly, since the line doesn't know how long it should be until it's already // done float adjustments if (line.getHeight() == 0) { bounds.height = (int)line.getStyle().getLineHeight(cssCtx); } }
public void analyzePageBreaks(LayoutContext c, ContentLimitContainer container) { container.updateTop(c, getAbsY()); for (Iterator i = getChildIterator(); i.hasNext(); ) { Box b = (Box)i.next(); b.analyzePageBreaks(c, container); } container.updateBottom(c, getAbsY() + getHeight()); }
public void analyzePageBreaks(LayoutContext c, ContentLimitContainer container) { container.updateTop(c, getAbsY()); for (Iterator i = getChildIterator(); i.hasNext(); ) { Box b = (Box)i.next(); b.analyzePageBreaks(c, container); } container.updateBottom(c, getAbsY() + getHeight()); }
public boolean isContainsVisibleContent() { for (int i = 0; i < getChildCount(); i++) { Box b = getChild(i); if (b instanceof BlockBox) { if (b.getWidth() > 0 || b.getHeight() > 0) { return true; } } else { boolean maybeResult = ((InlineLayoutBox)b).isContainsVisibleContent(); if (maybeResult) { return true; } } } return false; }
public Rectangle getBorderEdge(int left, int top, CssContext cssCtx) { RectPropertySet margin = getMargin(cssCtx); Rectangle result = new Rectangle(left + (int) margin.left(), top + (int) margin.top(), getWidth() - (int) margin.left() - (int) margin.right(), getHeight() - (int) margin.top() - (int) margin.bottom()); return result; }
public Rectangle getBorderEdge(int left, int top, CssContext cssCtx) { RectPropertySet margin = getMargin(cssCtx); Rectangle result = new Rectangle(left + (int) margin.left(), top + (int) margin.top(), getWidth() - (int) margin.left() - (int) margin.right(), getHeight() - (int) margin.top() - (int) margin.bottom()); return result; }
public boolean crossesPageBreak(LayoutContext c) { if (! c.isPageBreaksAllowed()) { return false; } PageBox pageBox = c.getRootLayer().getFirstPage(c, this); if (pageBox == null) { return false; } else { return getAbsY() + getHeight() >= pageBox.getBottom() - c.getExtraSpaceBottom(); } }
public boolean crossesPageBreak(LayoutContext c) { if (! c.isPageBreaksAllowed()) { return false; } PageBox pageBox = c.getRootLayer().getFirstPage(c, this); if (pageBox == null) { return false; } else { return getAbsY() + getHeight() >= pageBox.getBottom() - c.getExtraSpaceBottom(); } }
public BoxDimensions getBoxDimensions() { BoxDimensions result = new BoxDimensions(); result.setLeftMBP(getLeftMBP()); result.setRightMBP(getRightMBP()); result.setContentWidth(getContentWidth()); result.setHeight(getHeight()); return result; }
private ElementBox createElementBox(Styleable styleable, Element element) { if (styleable instanceof InlineLayoutBox) { final InlineLayoutBox box = (InlineLayoutBox) styleable; final int width = Math.max(box.getInlineWidth(), box.getWidth()); return new ElementBox(element, box.getAbsX(), box.getAbsY(), width, box.getHeight()); } if (styleable instanceof Box) { final Box box = (Box) styleable; return new ElementBox(element, box.getAbsX(), box.getAbsY(), box.getWidth(), box.getHeight()); } return null; }
public Rectangle getPaddingEdge(int left, int top, CssContext cssCtx) { RectPropertySet margin = getMargin(cssCtx); RectPropertySet border = getBorder(cssCtx); Rectangle result = new Rectangle(left + (int) margin.left() + (int) border.left(), top + (int) margin.top() + (int) border.top(), getWidth() - (int) margin.width() - (int) border.width(), getHeight() - (int) margin.height() - (int) border.height()); return result; }
public Rectangle getPaddingEdge(int left, int top, CssContext cssCtx) { RectPropertySet margin = getMargin(cssCtx); RectPropertySet border = getBorder(cssCtx); Rectangle result = new Rectangle(left + (int) margin.left() + (int) border.left(), top + (int) margin.top() + (int) border.top(), getWidth() - (int) margin.width() - (int) border.width(), getHeight() - (int) margin.height() - (int) border.height()); return result; }
public BoxDimensions getBoxDimensions() { BoxDimensions result = new BoxDimensions(); result.setLeftMBP(getLeftMBP()); result.setRightMBP(getRightMBP()); result.setContentWidth(getContentWidth()); result.setHeight(getHeight()); return result; }
public Rectangle getContentAreaEdge(int left, int top, CssContext cssCtx) { RectPropertySet margin = getMargin(cssCtx); RectPropertySet border = getBorder(cssCtx); RectPropertySet padding = getPadding(cssCtx); Rectangle result = new Rectangle( left + (int)margin.left() + (int)border.left() + (int)padding.left(), top + (int)margin.top() + (int)border.top() + (int)padding.top(), getWidth() - (int)margin.width() - (int)border.width() - (int)padding.width(), getHeight() - (int) margin.height() - (int) border.height() - (int) padding.height()); return result; }
public Rectangle getContentAreaEdge(int left, int top, CssContext cssCtx) { RectPropertySet margin = getMargin(cssCtx); RectPropertySet border = getBorder(cssCtx); RectPropertySet padding = getPadding(cssCtx); Rectangle result = new Rectangle( left + (int)margin.left() + (int)border.left() + (int)padding.left(), top + (int)margin.top() + (int)border.top() + (int)padding.top(), getWidth() - (int)margin.width() - (int)border.width() - (int)padding.width(), getHeight() - (int) margin.height() - (int) border.height() - (int) padding.height()); return result; }