private int getContainingBlockCSSHeight(CssContext c) { if (! getContainingBlock().isStyled() || getContainingBlock().getStyle().isAutoHeight()) { return 0; } else { if (getContainingBlock().getStyle().hasAbsoluteUnit(CSSName.HEIGHT)) { return (int) getContainingBlock().getStyle().getFloatPropertyProportionalTo( CSSName.HEIGHT, 0, c); } else { return 0; } } }
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 int getContainingBlockCSSHeight(CssContext c) { if (! getContainingBlock().isStyled() || getContainingBlock().getStyle().isAutoHeight()) { return 0; } else { if (getContainingBlock().getStyle().hasAbsoluteUnit(CSSName.HEIGHT)) { return (int) getContainingBlock().getStyle().getFloatPropertyProportionalTo( CSSName.HEIGHT, 0, c); } else { return 0; } } }
private int calcPinnedContentWidth(CssContext c) { if (! getStyle().isIdent(CSSName.LEFT, IdentValue.AUTO) && ! getStyle().isIdent(CSSName.RIGHT, IdentValue.AUTO)) { int left = (int) getStyle().getFloatPropertyProportionalTo( CSSName.LEFT, getContainingBlockWidth(), c); int right = (int) getStyle().getFloatPropertyProportionalTo( CSSName.RIGHT, getContainingBlockWidth(), c); int result = getContainingBlock().getPaddingWidth(c) - left - right - getLeftMBP() - getRightMBP(); return result < 0 ? 0 : result; } return -1; }
private void moveAllTheWayOver(BlockBox current, int direction) { if (direction == LEFT) { current.setX(0); } else if (direction == RIGHT) { current.setX(current.getContainingBlock().getContentWidth() - current.getWidth()); } }
protected int getAvailableWidth(LayoutContext c) { if (! getStyle().isAbsolute()) { return getContainingBlockWidth(); } else { int left = 0; int right = 0; if (! getStyle().isIdent(CSSName.LEFT, IdentValue.AUTO)) { left = (int) getStyle().getFloatPropertyProportionalTo(CSSName.LEFT, getContainingBlock().getContentWidth(), c); } if (! getStyle().isIdent(CSSName.RIGHT, IdentValue.AUTO)) { right = (int) getStyle().getFloatPropertyProportionalTo(CSSName.RIGHT, getContainingBlock().getContentWidth(), c); } return getContainingBlock().getPaddingWidth(c) - left - right; } }
private boolean fitsInContainingBlock(BlockBox current) { return current.getX() >= 0 && (current.getX() + current.getWidth()) <= current.getContainingBlock().getContentWidth(); }
protected int getAvailableWidth(LayoutContext c) { if (! getStyle().isAbsolute()) { return getContainingBlockWidth(); } else { int left = 0; int right = 0; if (! getStyle().isIdent(CSSName.LEFT, IdentValue.AUTO)) { left = (int) getStyle().getFloatPropertyProportionalTo(CSSName.LEFT, getContainingBlock().getContentWidth(), c); } if (! getStyle().isIdent(CSSName.RIGHT, IdentValue.AUTO)) { right = (int) getStyle().getFloatPropertyProportionalTo(CSSName.RIGHT, getContainingBlock().getContentWidth(), c); } return getContainingBlock().getPaddingWidth(c) - left - right; } }
private boolean fitsInContainingBlock(BlockBox current) { return current.getX() >= 0 && (current.getX() + current.getWidth()) <= current.getContainingBlock().getContentWidth(); }
private void moveAllTheWayOver(BlockBox current, int direction) { if (direction == LEFT) { current.setX(0); } else if (direction == RIGHT) { current.setX(current.getContainingBlock().getContentWidth() - current.getWidth()); } }
protected int getCSSWidth(CssContext c) { if (! isAnonymous()) { if (! getStyle().isAutoWidth()) { int result = (int) getStyle().getFloatPropertyProportionalWidth( CSSName.WIDTH, getContainingBlock().getContentWidth(), c); return result >= 0 ? result : -1; } } return -1; }
public boolean isAutoHeight() { if (getStyle().isAutoHeight()) { return true; } else if (getStyle().hasAbsoluteUnit(CSSName.HEIGHT)) { return false; } else { // We have a percentage height, defer to our block parent (if applicable) Box cb = getContainingBlock(); if (cb.isStyled() && (cb instanceof BlockBox)) { return ((BlockBox)cb).isAutoHeight(); } else if (cb instanceof BlockBox && ((BlockBox)cb).isInitialContainingBlock()) { return false; } else { return true; } } }
protected int getCSSWidth(CssContext c, boolean shrinkingToFit) { if (! isAnonymous()) { if (! getStyle().isAutoWidth()) { if (shrinkingToFit && ! getStyle().isAbsoluteWidth()) { return -1; } else { int result = (int) getStyle().getFloatPropertyProportionalWidth( CSSName.WIDTH, getContainingBlock().getContentWidth(), c); return result >= 0 ? result : -1; } } } return -1; }
public boolean isAutoHeight() { if (getStyle().isAutoHeight()) { return true; } else if (getStyle().hasAbsoluteUnit(CSSName.HEIGHT)) { return false; } else { // We have a percentage height, defer to our block parent (if applicable) Box cb = (Box)getContainingBlock(); if (cb.isStyled() && (cb instanceof BlockBox)) { return ((BlockBox)cb).isAutoHeight(); } else if (cb instanceof BlockBox && ((BlockBox)cb).isInitialContainingBlock()) { return false; } else { return true; } } }
private int calcPinnedHeight(CssContext c) { if (! getStyle().isIdent(CSSName.TOP, IdentValue.AUTO) && ! getStyle().isIdent(CSSName.BOTTOM, IdentValue.AUTO)) { Rectangle paddingEdge = getContainingBlock().getPaddingEdge(0, 0, c); int top = (int) getStyle().getFloatPropertyProportionalTo( CSSName.TOP, paddingEdge.height, c); int bottom = (int) getStyle().getFloatPropertyProportionalTo( CSSName.BOTTOM, paddingEdge.height, c); int result = paddingEdge.height - top - bottom; return result < 0 ? 0 : result; } return -1; }
protected int getCSSHeight(CssContext c) { if (! isAnonymous()) { if (! isAutoHeight()) { if (getStyle().hasAbsoluteUnit(CSSName.HEIGHT)) { return (int)getStyle().getFloatPropertyProportionalHeight(CSSName.HEIGHT, 0, c); } else { return (int)getStyle().getFloatPropertyProportionalHeight( CSSName.HEIGHT, ((BlockBox)getContainingBlock()).getCSSHeight(c), c); } } } return -1; }
protected int getCSSHeight(CssContext c) { if (! isAnonymous()) { if (! isAutoHeight()) { if (getStyle().hasAbsoluteUnit(CSSName.HEIGHT)) { return (int)getStyle().getFloatPropertyProportionalHeight(CSSName.HEIGHT, 0, c); } else { return (int)getStyle().getFloatPropertyProportionalHeight( CSSName.HEIGHT, ((BlockBox)getContainingBlock()).getCSSHeight(c), c); } } } return -1; }
private int calcPinnedContentWidth(CssContext c) { if (! getStyle().isIdent(CSSName.LEFT, IdentValue.AUTO) && ! getStyle().isIdent(CSSName.RIGHT, IdentValue.AUTO)) { Rectangle paddingEdge = getContainingBlock().getPaddingEdge(0, 0, c); int left = (int) getStyle().getFloatPropertyProportionalTo( CSSName.LEFT, paddingEdge.width, c); int right = (int) getStyle().getFloatPropertyProportionalTo( CSSName.RIGHT, paddingEdge.width, c); int result = paddingEdge.width - left - right - getLeftMBP() - getRightMBP(); return result < 0 ? 0 : result; } return -1; }
setAbsY(parent.getAbsY() + parent.getTy() + getY()); } else if (isStyled() && getStyle().isAbsFixedOrInlineBlockEquiv()) { Box cb = getContainingBlock(); if (cb != null) { setAbsX(cb.getAbsX() + getX());
setAbsY(parent.getAbsY() + parent.getTy() + getY()); } else if (isStyled() && getStyle().isAbsFixedOrInlineBlockEquiv()) { Box cb = getContainingBlock(); if (cb != null) { setAbsX(cb.getAbsX() + getX());