@Deprecated private void paintReplacedElement(RenderingContext c, BlockBox replaced) { Rectangle contentBounds = replaced.getContentAreaEdge( replaced.getAbsX(), replaced.getAbsY(), c); // Minor hack: It's inconvenient to adjust for margins, border, padding during // layout so just do it here. Point loc = replaced.getReplacedElement().getLocation(); if (contentBounds.x != loc.x || contentBounds.y != loc.y) { replaced.getReplacedElement().setLocation(contentBounds.x, contentBounds.y); } if (! c.isInteractive() || replaced.getReplacedElement().isRequiresInteractivePaint()) { c.getOutputDevice().paintReplacedElement(c, replaced); } }
private ReplacedElement fitReplacedElement(LayoutContext c, ReplacedElement re) { int maxImageWidth = getCSSFitToWidth(c); if (maxImageWidth > -1 && re.getIntrinsicWidth() > maxImageWidth) { double oldWidth = (double)re.getIntrinsicWidth(); double scale = ((double)maxImageWidth)/oldWidth; re = c.getReplacedElementFactory().createReplacedElement( c, this, c.getUac(), maxImageWidth, (int)Math.rint(scale * (double)re.getIntrinsicHeight())); } return re; }
private void paintReplacedElement(RenderingContext c, BlockBox replaced) { Rectangle contentBounds = replaced.getContentAreaEdge( replaced.getAbsX(), replaced.getAbsY(), c); // Minor hack: It's inconvenient to adjust for margins, border, padding during // layout so just do it here. Point loc = replaced.getReplacedElement().getLocation(); if (contentBounds.x != loc.x || contentBounds.y != loc.y) { replaced.getReplacedElement().setLocation(contentBounds.x, contentBounds.y); } c.getOutputDevice().paintReplacedElement(c, replaced); }
@Override public void paintReplacedElement(RenderingContext c, BlockBox box) { ReplacedElement replaced = box.getReplacedElement(); if (replaced instanceof ImageReplacedElement) { Image image = ((ImageReplacedElement)replaced).getImage(); Point location = replaced.getLocation(); _graphics.drawImage( image, (int)location.getX(), (int)location.getY(), null); } else if (replaced instanceof Java2DRendererBuilder.Graphics2DPaintingReplacedElement) { Rectangle contentBounds = box.getContentAreaEdge(box.getAbsX(), box.getAbsY(), c); ((Java2DRendererBuilder.Graphics2DPaintingReplacedElement) replaced).paint(this, c, contentBounds.x, contentBounds.y, contentBounds.width, contentBounds.height); } }
public int calcInlineBaseline(CssContext c) { if (isReplaced() && getReplacedElement().hasBaseline()) { Rectangle bounds = getContentAreaEdge(getAbsX(), getAbsY(), c); return bounds.y + getReplacedElement().getBaseline() - getAbsY(); } else { LineBox lastLine = findLastLineBox(); if (lastLine == null) { return getHeight(); } else { return lastLine.getAbsY() + lastLine.getBaseline() - getAbsY(); } } }
@Override public void reset(LayoutContext c) { super.reset(c); setTopMarginCalculated(false); setBottomMarginCalculated(false); setDimensionsCalculated(false); setMinMaxCalculated(false); setChildrenHeight(0); if (isReplaced()) { getReplacedElement().detach(c); setReplacedElement(null); } if (getChildrenContentType() == BlockBox.CONTENT_INLINE) { removeAllChildren(); } if (isFloated()) { _floatedBoxData.getManager().removeFloat(this); _floatedBoxData.getDrawingLayer().removeFloat(this); } if (getStyle().isRunning()) { c.getRootLayer().removeRunningBlock(this); } }
width = getReplacedElement().getIntrinsicWidth(); } else { int height = getCSSHeight(c); re = fitReplacedElement(c, re); setReplacedElement(re); width = getReplacedElement().getIntrinsicWidth();
private void paintReplacedElement(RenderingContext c, BlockBox replaced) { Rectangle contentBounds = replaced.getContentAreaEdge( replaced.getAbsX(), replaced.getAbsY(), c); // Minor hack: It's inconvenient to adjust for margins, border, padding during // layout so just do it here. Point loc = replaced.getReplacedElement().getLocation(); if (contentBounds.x != loc.x || contentBounds.y != loc.y) { replaced.getReplacedElement().setLocation(contentBounds.x, contentBounds.y); } c.getOutputDevice().paintReplacedElement(c, replaced); }
Point location = getReplacedElement().getLocation(); if (location.x != getAbsX() || location.y != getAbsY()) { getReplacedElement().setLocation(getAbsX(), getAbsY());
setContentWidth(re.getIntrinsicWidth()); setHeight(re.getIntrinsicHeight()); setReplacedElement(re); } else if (cssWidth == -1 && pinnedContentWidth == -1 &&