void RenderFrameSet::layout()
{
    StackStats::LayoutCheckPoint layoutCheckPoint;
    ASSERT(needsLayout());

    bool doFullRepaint = selfNeedsLayout() && checkForRepaintDuringLayout();
    LayoutRect oldBounds;
    RenderLayerModelObject* repaintContainer = 0;
    if (doFullRepaint) {
        repaintContainer = containerForRepaint();
        oldBounds = clippedOverflowRectForRepaint(repaintContainer);
    }

    if (!parent()->isFrameSet() && !document().printing()) {
        setWidth(view().viewWidth());
        setHeight(view().viewHeight());
    }

    unsigned cols = frameSetElement().totalCols();
    unsigned rows = frameSetElement().totalRows();

    if (m_rows.m_sizes.size() != rows || m_cols.m_sizes.size() != cols) {
        m_rows.resize(rows);
        m_cols.resize(cols);
    }

    LayoutUnit borderThickness = frameSetElement().border();
    layOutAxis(m_rows, frameSetElement().rowLengths(), height() - (rows - 1) * borderThickness);
    layOutAxis(m_cols, frameSetElement().colLengths(), width() - (cols - 1) * borderThickness);

    if (flattenFrameSet())
        positionFramesWithFlattening();
    else
        positionFrames();

    RenderBox::layout();

    computeEdgeInfo();

    updateLayerTransform();

    if (doFullRepaint) {
        repaintUsingContainer(repaintContainer, pixelSnappedIntRect(oldBounds));
        LayoutRect newBounds = clippedOverflowRectForRepaint(repaintContainer);
        if (newBounds != oldBounds)
            repaintUsingContainer(repaintContainer, pixelSnappedIntRect(newBounds));
    }

    clearNeedsLayout();
}
void RenderSVGModelObject::repaintTreeAfterLayout()
{
    // Note: This is a reduced version of RenderBox::repaintTreeAfterLayout().
    // FIXME: Should share code with RenderBox::repaintTreeAfterLayout().
    ASSERT(RuntimeEnabledFeatures::repaintAfterLayoutEnabled());
    ASSERT(!needsLayout());

    if (!shouldCheckForInvalidationAfterLayout())
        return;

    LayoutStateDisabler layoutStateDisabler(*this);

    const LayoutRect oldRepaintRect = previousRepaintRect();
    const LayoutPoint oldPositionFromRepaintContainer = previousPositionFromRepaintContainer();
    const RenderLayerModelObject* repaintContainer = containerForRepaint();
    setPreviousRepaintRect(clippedOverflowRectForRepaint(repaintContainer));
    setPreviousPositionFromRepaintContainer(positionFromRepaintContainer(repaintContainer));

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

    const LayoutRect& newRepaintRect = previousRepaintRect();
    const LayoutPoint& newPositionFromRepaintContainer = previousPositionFromRepaintContainer();
    repaintAfterLayoutIfNeeded(containerForRepaint(),
        shouldDoFullRepaintAfterLayout(), oldRepaintRect, oldPositionFromRepaintContainer, &newRepaintRect, &newPositionFromRepaintContainer);

    RenderObject::repaintTreeAfterLayout();
}