private void moveAllTheWayOver(BlockBox current, int direction) { if (direction == LEFT) { current.setX(0); } else if (direction == RIGHT) { current.setX(current.getContainingBlock().getContentWidth() - current.getWidth()); } }
result.append("(" + getAbsX() + "," + getAbsY() + ")->(" + getWidth() + " x " + getHeight() + ")"); return result.toString();
result.append("(" + getAbsX() + "," + getAbsY() + ")->(" + getWidth() + " x " + getHeight() + ")"); return result.toString();
private void moveAllTheWayOver(BlockBox current, int direction) { if (direction == LEFT) { current.setX(0); } else if (direction == RIGHT) { current.setX(current.getContainingBlock().getContentWidth() - current.getWidth()); } }
private boolean fitsInContainingBlock(BlockBox current) { return current.getX() >= 0 && (current.getX() + current.getWidth()) <= current.getContainingBlock().getContentWidth(); }
private boolean fitsInContainingBlock(BlockBox current) { return current.getX() >= 0 && (current.getX() + current.getWidth()) <= current.getContainingBlock().getContentWidth(); }
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); } } }
private static int processOutOfFlowContent( LayoutContext c, LineBox current, BlockBox block, int available, List pendingFloats) { int result = 0; CalculatedStyle style = block.getStyle(); if (style.isAbsolute() || style.isFixed()) { LayoutUtil.layoutAbsolute(c, current, block); current.addNonFlowContent(block); } else if (style.isFloated()) { FloatLayoutResult layoutResult = LayoutUtil.layoutFloated( c, current, block, available, pendingFloats); if (layoutResult.isPending()) { pendingFloats.add(layoutResult); } else { result = layoutResult.getBlock().getWidth(); current.addNonFlowContent(layoutResult.getBlock()); } } else if (style.isRunning()) { block.setStaticEquivalent(current); c.getRootLayer().addRunningBlock(block); } return result; }
private static int processOutOfFlowContent( LayoutContext c, LineBox current, BlockBox block, int available, List pendingFloats) { int result = 0; CalculatedStyle style = block.getStyle(); if (style.isAbsolute() || style.isFixed()) { LayoutUtil.layoutAbsolute(c, current, block); current.addNonFlowContent(block); } else if (style.isFloated()) { FloatLayoutResult layoutResult = LayoutUtil.layoutFloated( c, current, block, available, pendingFloats); if (layoutResult.isPending()) { pendingFloats.add(layoutResult); } else { result = layoutResult.getBlock().getWidth(); current.addNonFlowContent(layoutResult.getBlock()); } } else if (style.isRunning()) { block.setStaticEquivalent(current); c.getRootLayer().addRunningBlock(block); } return result; }
(pendingFloats.size() > 0 || block.getWidth() > avail) && currentLine.isContainsContent()) { block.reset(c);
(pendingFloats.size() > 0 || block.getWidth() > avail) && currentLine.isContainsContent()) { block.reset(c);
layoutInlineBlockContent(c, box, child, initialY); if (child.getWidth() > remainingWidth && currentLine.isContainsContent()) { saveLine(currentLine, c, box, minimumLineHeight, maxAvailableWidth, pendingFloats, hasFirstLinePEs, currentLine.setContainsBlockLevelContent(true); remainingWidth -= child.getWidth(); if (child.getWidth() == 0) { zeroWidthInlineBlock = true;
layoutInlineBlockContent(c, box, child, initialY); if (child.getWidth() > remainingWidth && currentLine.isContainsContent()) { saveLine(currentLine, c, box, minimumLineHeight, maxAvailableWidth, pendingFloats, hasFirstLinePEs, currentLine.setContainsBlockLevelContent(true); remainingWidth -= child.getWidth(); if (child.getWidth() == 0) { zeroWidthInlineBlock = true;
} else if (!style.isIdent(CSSName.RIGHT, IdentValue.AUTO)) { setX(boundingBox.width - (int) style.getFloatPropertyProportionalWidth(CSSName.RIGHT, getContainingBlock().getContentWidth(), cssCtx) - getWidth());
} else if (!style.isIdent(CSSName.RIGHT, IdentValue.AUTO)) { setX(boundingBox.width - (int) style.getFloatPropertyProportionalWidth(CSSName.RIGHT, getContainingBlock().getContentWidth(), cssCtx) - getWidth());