bool SVGRenderSupport::parentTransformDidChange(RenderObject* object) { // When a parent container is transformed in SVG, all children will be painted automatically // so we are able to skip redundant repaint checks. RenderObject* parent = object->parent(); return !(parent && parent->isSVGContainer() && toRenderSVGContainer(parent)->didTransformToRootUpdate()); }
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); }
bool SVGRenderSupport::checkForSVGRepaintDuringLayout(RenderObject* object) { if (!object->checkForRepaintDuringLayout()) return false; // When a parent container is transformed in SVG, all children will be painted automatically // so we are able to skip redundant repaint checks. RenderObject* parent = object->parent(); return !(parent && parent->isSVGContainer() && toRenderSVGContainer(parent)->didTransformToRootUpdate()); }
bool SVGRenderSupport::checkForSVGRepaintDuringLayout(const RenderElement& renderer) { if (!renderer.checkForRepaintDuringLayout()) return false; // When a parent container is transformed in SVG, all children will be painted automatically // so we are able to skip redundant repaint checks. auto parent = renderer.parent(); return !(parent && parent->isSVGContainer() && toRenderSVGContainer(parent)->didTransformToRootUpdate()); }
bool SVGRenderSupport::transformToRootChanged(RenderObject* ancestor) { while (ancestor && !ancestor->isSVGRoot()) { if (ancestor->isSVGTransformableContainer()) return toRenderSVGContainer(ancestor)->didTransformToRootUpdate(); if (ancestor->isSVGViewportContainer()) return toRenderSVGViewportContainer(ancestor)->didTransformToRootUpdate(); ancestor = ancestor->parent(); } return false; }
// Update a bounding box taking into account the validity of the other bounding box. inline void SVGRenderSupport::updateObjectBoundingBox(FloatRect& objectBoundingBox, bool& objectBoundingBoxValid, RenderObject* other, FloatRect otherBoundingBox) { bool otherValid = other->isSVGContainer() ? toRenderSVGContainer(other)->isObjectBoundingBoxValid() : true; if (!otherValid) return; if (!objectBoundingBoxValid) { objectBoundingBox = otherBoundingBox; objectBoundingBoxValid = true; return; } objectBoundingBox.uniteEvenIfEmpty(otherBoundingBox); }
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); }