void LayoutSVGBlock::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidationState)
{
    if (!shouldCheckForPaintInvalidation(paintInvalidationState))
        return;

    ForceHorriblySlowRectMapping slowRectMapping(&paintInvalidationState);
    LayoutBlockFlow::invalidateTreeIfNeeded(paintInvalidationState);
}
void RenderSVGBlock::invalidateTreeAfterLayout(const RenderLayerModelObject& paintInvalidationContainer)
{
    if (!shouldCheckForPaintInvalidationAfterLayout())
        return;

    ForceHorriblySlowRectMapping slowRectMapping(*this);
    RenderBlockFlow::invalidateTreeAfterLayout(paintInvalidationContainer);
}
void RenderFlowThread::repaintRectangleInRegions(const LayoutRect& repaintRect) const
{
    if (!shouldRepaint(repaintRect) || !hasValidRegionInfo())
        return;

    ForceHorriblySlowRectMapping slowRectMapping(*this); // We can't use layout state to repaint, since the regions are somewhere else.

    // We can't use currentFlowThread as it is possible to have interleaved flow threads and the wrong one could be used.
    // Let each columnSet figure out the proper enclosing flow thread.
    CurrentRenderFlowThreadDisabler disabler(view());

    for (RenderMultiColumnSetList::const_iterator iter = m_multiColumnSetList.begin(); iter != m_multiColumnSetList.end(); ++iter) {
        RenderMultiColumnSet* columnSet = *iter;

        columnSet->repaintFlowThreadContent(repaintRect);
    }
}
void RenderSVGRoot::layout()
{
    ASSERT(needsLayout());

    // Arbitrary affine transforms are incompatible with LayoutState.
    ForceHorriblySlowRectMapping slowRectMapping(*this);

    bool needsLayout = selfNeedsLayout();

    LayoutSize oldSize = size();
    updateLogicalWidth();
    updateLogicalHeight();
    buildLocalToBorderBoxTransform();

    SVGRenderSupport::layoutResourcesIfNeeded(this);

    SVGSVGElement* svg = toSVGSVGElement(node());
    ASSERT(svg);
    m_isLayoutSizeChanged = needsLayout || (svg->hasRelativeLengths() && oldSize != size());
    SVGRenderSupport::layoutChildren(this, needsLayout || SVGRenderSupport::filtersForceContainerLayout(this));

    if (m_needsBoundariesOrTransformUpdate) {
        updateCachedBoundaries();
        m_needsBoundariesOrTransformUpdate = false;
    }

    m_overflow.clear();
    addVisualEffectOverflow();

    if (!shouldApplyViewportClip()) {
        FloatRect contentRepaintRect = paintInvalidationRectInLocalCoordinates();
        contentRepaintRect = m_localToBorderBoxTransform.mapRect(contentRepaintRect);
        addVisualOverflow(enclosingLayoutRect(contentRepaintRect));
    }

    updateLayerTransformAfterLayout();
    m_hasBoxDecorationBackground = isDocumentElement() ? calculateHasBoxDecorations() : hasBoxDecorationBackground();
    invalidateBackgroundObscurationStatus();

    clearNeedsLayout();
}
void RenderSVGModelObject::invalidateTreeAfterLayout(const RenderLayerModelObject& paintInvalidationContainer)
{
    // Note: This is a reduced version of RenderBox::invalidateTreeAfterLayout().
    // FIXME: Should share code with RenderBox::invalidateTreeAfterLayout().
    ASSERT(!needsLayout());

    if (!shouldCheckForPaintInvalidationAfterLayout())
        return;

    ForceHorriblySlowRectMapping slowRectMapping(*this);

    const LayoutRect oldPaintInvalidationRect = previousPaintInvalidationRect();
    const LayoutPoint oldPositionFromPaintInvalidationContainer = previousPositionFromPaintInvalidationContainer();
    ASSERT(&paintInvalidationContainer == containerForPaintInvalidation());
    setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(&paintInvalidationContainer));
    setPreviousPositionFromPaintInvalidationContainer(RenderLayer::positionFromPaintInvalidationContainer(this, &paintInvalidationContainer));

    // If an ancestor container had its transform changed, then we just
    // need to update the RenderSVGModelObject's repaint rect above. The invalidation
    // will be handled by the container where the transform changed. This essentially
    // means that we prune the entire branch for performance.
    if (!SVGRenderSupport::parentTransformDidChange(this))
        return;

    // If we are set to do a full paint invalidation that means the RenderView will be
    // issue paint invalidations. We can then skip issuing of paint invalidations for the child
    // renderers as they'll be covered by the RenderView.
    if (view()->doingFullRepaint()) {
        RenderObject::invalidateTreeAfterLayout(paintInvalidationContainer);
        return;
    }

    invalidatePaintIfNeeded(containerForPaintInvalidation(), oldPaintInvalidationRect, oldPositionFromPaintInvalidationContainer);

    RenderObject::invalidateTreeAfterLayout(paintInvalidationContainer);
}