public void initStaticPos(LayoutContext c, BlockBox parent, int childOffset) { setX(0); setY(childOffset); }
public void initStaticPos(LayoutContext c, BlockBox parent, int childOffset) { setX(0); setY(childOffset); }
private void alignToLastFloat(CssContext cssCtx, BlockFormattingContext bfc, BlockBox current, int direction) { List floats = getFloats(direction); if (floats.size() > 0) { Point offset = bfc.getOffset(); BoxOffset lastOffset = (BoxOffset) floats.get(floats.size() - 1); BlockBox last = (BlockBox) lastOffset.getBox(); Rectangle currentBounds = current.getMarginEdge(cssCtx, -offset.x, -offset.y); Rectangle lastBounds = last.getMarginEdge(cssCtx, -lastOffset.getX(), -lastOffset.getY()); boolean moveOver = false; if (currentBounds.y < lastBounds.y) { currentBounds.translate(0, lastBounds.y - currentBounds.y); moveOver = true; } if (currentBounds.y >= lastBounds.y && currentBounds.y < lastBounds.y + lastBounds.height) { moveOver = true; } if (moveOver) { if (direction == LEFT) { currentBounds.x = lastBounds.x + last.getWidth(); } else if (direction == RIGHT) { currentBounds.x = lastBounds.x - current.getWidth(); } currentBounds.translate(offset.x, offset.y); current.setX(currentBounds.x); current.setY(currentBounds.y); } } }
private void alignToLastFloat(CssContext cssCtx, BlockFormattingContext bfc, BlockBox current, int direction) { List floats = getFloats(direction); if (floats.size() > 0) { Point offset = bfc.getOffset(); BoxOffset lastOffset = (BoxOffset) floats.get(floats.size() - 1); BlockBox last = lastOffset.getBox(); Rectangle currentBounds = current.getMarginEdge(cssCtx, -offset.x, -offset.y); Rectangle lastBounds = last.getMarginEdge(cssCtx, -lastOffset.getX(), -lastOffset.getY()); boolean moveOver = false; if (currentBounds.y < lastBounds.y) { currentBounds.translate(0, lastBounds.y - currentBounds.y); moveOver = true; } if (currentBounds.y >= lastBounds.y && currentBounds.y < lastBounds.y + lastBounds.height) { moveOver = true; } if (moveOver) { if (direction == LEFT) { currentBounds.x = lastBounds.x + last.getWidth(); } else if (direction == RIGHT) { currentBounds.x = lastBounds.x - current.getWidth(); } currentBounds.translate(offset.x, offset.y); current.setX(currentBounds.x); current.setY(currentBounds.y); } } }
setX(0); if (!style.isIdent(CSSName.LEFT, IdentValue.AUTO)) { setX((int) style.getFloatPropertyProportionalWidth(CSSName.LEFT, getContainingBlock().getContentWidth(), cssCtx)); } else if (!style.isIdent(CSSName.RIGHT, IdentValue.AUTO)) { setX(boundingBox.width - (int) style.getFloatPropertyProportionalWidth(CSSName.RIGHT, getContainingBlock().getContentWidth(), cssCtx) - getWidth()); setX(getX() + boundingBox.x);
setX(0); if (!style.isIdent(CSSName.LEFT, IdentValue.AUTO)) { setX((int) style.getFloatPropertyProportionalWidth(CSSName.LEFT, getContainingBlock().getContentWidth(), cssCtx)); } else if (!style.isIdent(CSSName.RIGHT, IdentValue.AUTO)) { setX(boundingBox.width - (int) style.getFloatPropertyProportionalWidth(CSSName.RIGHT, getContainingBlock().getContentWidth(), cssCtx) - getWidth()); setX(getX() + boundingBox.x);