void renderSubtreeToImage(ImageBuffer* image, RenderObject* item) { ASSERT(item); ASSERT(image); ASSERT(image->context()); // FIXME: This sets the rect to the viewable area of the current frame. This // is used to support text drawings to the ImageBuffer. See bug 30399. IntRect rect; FrameView* frameView = item->document()->view(); if (frameView) rect = IntRect(0, 0, frameView->visibleWidth(), frameView->visibleHeight()); RenderObject::PaintInfo info(image->context(), rect, PaintPhaseForeground, 0, 0, 0); // FIXME: isSVGContainer returns true for RenderSVGViewportContainer, so if this is ever // called with one of those, we will read from the wrong offset in an object due to a bad cast. RenderSVGContainer* svgContainer = 0; if (item && item->isSVGContainer()) svgContainer = toRenderSVGContainer(item); bool drawsContents = svgContainer ? svgContainer->drawsContents() : false; if (svgContainer && !drawsContents) svgContainer->setDrawsContents(true); item->layoutIfNeeded(); item->paint(info, 0, 0); if (svgContainer && !drawsContents) svgContainer->setDrawsContents(false); }
void SVGImageBufferTools::renderSubtreeToImageBuffer(ImageBuffer* image, RenderObject* item, const AffineTransform& subtreeContentTransformation) { ASSERT(item); ASSERT(image); ASSERT(image->context()); PaintInfo info(image->context(), PaintInfo::infiniteRect(), PaintPhaseForeground, 0, 0, 0); RenderSVGContainer* svgContainer = 0; if (item && item->isSVGContainer() && !item->isSVGViewportContainer()) svgContainer = toRenderSVGContainer(item); bool drawsContents = svgContainer ? svgContainer->drawsContents() : false; if (svgContainer && !drawsContents) svgContainer->setDrawsContents(true); AffineTransform& contentTransformation = currentContentTransformation(); AffineTransform savedContentTransformation = contentTransformation; contentTransformation.multiply(subtreeContentTransformation); item->layoutIfNeeded(); item->paint(info, 0, 0); contentTransformation = savedContentTransformation; if (svgContainer && !drawsContents) svgContainer->setDrawsContents(false); }
RenderObject* SVGSVGElement::createRenderer(RenderArena* arena, RenderStyle*) { RenderSVGContainer* rootContainer = new (arena) RenderSVGContainer(this); // FIXME: All this setup should be done after attributesChanged, not here. rootContainer->setViewBox(viewBox()); rootContainer->setAlign(KCAlign(preserveAspectRatio()->align() - 1)); rootContainer->setSlice(preserveAspectRatio()->meetOrSlice() == SVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE); return rootContainer; }
void write(TextStream &ts, const RenderSVGContainer &container, int indent) { writeIndent(ts, indent); ts << container.renderName(); if (container.element()) { DeprecatedString tagName = getTagName(container.element()); if (!tagName.isEmpty()) ts << " {" << tagName << "}"; } ts << container << endl; for (RenderObject *child = container.firstChild(); child != NULL; child = child->nextSibling()) write(ts, *child, indent + 1); }
void write(TextStream& ts, const RenderSVGContainer& container, int indent) { writeIndent(ts, indent); ts << container.renderName(); if (container.element()) { String tagName = getTagName(static_cast<SVGStyledElement*>(container.element())); if (!tagName.isEmpty()) ts << " {" << tagName << "}"; } ts << container << "\n"; for (RenderObject* child = container.firstChild(); child; child = child->nextSibling()) write(ts, *child, indent + 1); }
RenderObject* SVGSVGElement::createRenderer(RenderArena* arena, RenderStyle*) { RenderSVGContainer *rootContainer = new (arena) RenderSVGContainer(this); // FIXME: all this setup should be done after attributesChanged, not here. float _x = x()->baseVal()->value(); float _y = y()->baseVal()->value(); float _width = width()->baseVal()->value(); float _height = height()->baseVal()->value(); rootContainer->setViewport(FloatRect(_x, _y, _width, _height)); rootContainer->setViewBox(FloatRect(viewBox()->baseVal()->x(), viewBox()->baseVal()->y(), viewBox()->baseVal()->width(), viewBox()->baseVal()->height())); rootContainer->setAlign(KCAlign(preserveAspectRatio()->baseVal()->align() - 1)); rootContainer->setSlice(preserveAspectRatio()->baseVal()->meetOrSlice() == SVG_MEETORSLICE_SLICE); return rootContainer; }
void renderSubtreeToImage(ImageBuffer* image, RenderObject* item) { ASSERT(item); ASSERT(image); ASSERT(image->context()); RenderObject::PaintInfo info(image->context(), IntRect(), PaintPhaseForeground, 0, 0, 0); RenderSVGContainer* svgContainer = 0; if (item && item->isSVGContainer()) svgContainer = static_cast<RenderSVGContainer*>(item); bool drawsContents = svgContainer ? svgContainer->drawsContents() : false; if (svgContainer && !drawsContents) svgContainer->setDrawsContents(true); item->layoutIfNeeded(); item->paint(info, 0, 0); if (svgContainer && !drawsContents) svgContainer->setDrawsContents(false); }
void renderSubtreeToImage(ImageBuffer* image, RenderObject* item) { ASSERT(item); ASSERT(image); ASSERT(image->context()); RenderObject::PaintInfo info(image->context(), IntRect(), PaintPhaseForeground, 0, 0, 0); // FIXME: isSVGContainer returns true for RenderSVGViewportContainer, so if this is ever // called with one of those, we will read from the wrong offset in an object due to a bad cast. RenderSVGContainer* svgContainer = 0; if (item && item->isSVGContainer()) svgContainer = toRenderSVGContainer(item); bool drawsContents = svgContainer ? svgContainer->drawsContents() : false; if (svgContainer && !drawsContents) svgContainer->setDrawsContents(true); item->layoutIfNeeded(); item->paint(info, 0, 0); if (svgContainer && !drawsContents) svgContainer->setDrawsContents(false); }
RenderObject* SVGMarkerElement::createRenderer(RenderArena* arena, RenderStyle* style) { RenderSVGContainer *markerContainer = new (arena) RenderSVGContainer(this); markerContainer->setDrawsContents(false); // Marker contents will be explicitly drawn. return markerContainer; }
RenderObject* SVGMaskElement::createRenderer(RenderArena* arena, RenderStyle*) { RenderSVGContainer* maskContainer = new (arena) RenderSVGContainer(this); maskContainer->setDrawsContents(false); return maskContainer; }
RenderObject* SVGPatternElement::createRenderer(RenderArena* arena, RenderStyle*) { RenderSVGContainer* patternContainer = new (arena) RenderSVGContainer(this); patternContainer->setDrawsContents(false); return patternContainer; }