Пример #1
0
void RenderView::layout()
{
    if (printing())
        m_minPrefWidth = m_maxPrefWidth = width();

    // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account.
    bool relayoutChildren = !printing() && (!m_frameView || width() != viewWidth() || height() != viewHeight());
    if (relayoutChildren) {
        setChildNeedsLayout(true, false);
        for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
            if (child->style()->height().isPercent() || child->style()->minHeight().isPercent() || child->style()->maxHeight().isPercent())
                child->setChildNeedsLayout(true, false);
        }
    }

    ASSERT(!m_layoutState);
    LayoutState state;
    // FIXME: May be better to push a clip and avoid issuing offscreen repaints.
    state.m_clipped = false;
    m_layoutState = &state;

    if (needsLayout())
        RenderBlock::layout();

    // Reset overflow and then replace it with docWidth and docHeight.
    m_overflow.clear();
    addLayoutOverflow(IntRect(0, 0, docWidth(), docHeight()));


    ASSERT(layoutDelta() == IntSize());
    ASSERT(m_layoutStateDisableCount == 0);
    ASSERT(m_layoutState == &state);
    m_layoutState = 0;
    setNeedsLayout(false);
}
Пример #2
0
void RenderView::layout()
{
    if (!document()->paginated())
        setPageHeight(0);
    m_absoluteOverflow.clear();

    if (printing())
        m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = width();

    // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account.
    bool relayoutChildren = !printing() && (!m_frameView || width() != viewWidth() || height() != viewHeight());
    if (relayoutChildren) {
        setChildNeedsLayout(true, false);
        for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
            if (child->style()->logicalHeight().isPercent() || child->style()->logicalMinHeight().isPercent() || child->style()->logicalMaxHeight().isPercent())
                child->setChildNeedsLayout(true, false);
        }
    }

    ASSERT(!m_layoutState);
    LayoutState state;
    // FIXME: May be better to push a clip and avoid issuing offscreen repaints.
    state.m_clipped = false;
    state.m_pageHeight = m_pageHeight;
    state.m_pageHeightChanged = m_pageHeightChanged;
    m_pageHeightChanged = false;
    m_layoutState = &state;

    if (needsLayout())
        RenderBlock::layout();

#if ENABLE(VIEWPORT_REFLOW)
    calcReflowWidth();
#endif

    // Reset overflow and then replace it with docWidth and docHeight.
    m_overflow.clear();
    int leftOverflow = docLeft();
    addLayoutOverflow(IntRect(leftOverflow, 0, docWidth(leftOverflow), docHeight()));

    ASSERT(layoutDelta() == IntSize());
    ASSERT(m_layoutStateDisableCount == 0);
    ASSERT(m_layoutState == &state);
    m_layoutState = 0;
    setNeedsLayout(false);
}
Пример #3
0
void RenderView::layout()
{
    layoutCounter.startCounting();
    if (printing())
        m_minPrefWidth = m_maxPrefWidth = m_width;

    // Use calcWidth/Height to get the new width/height, since this will take the full page zoom factor into account.
    bool relayoutChildren = !printing() && (!m_frameView || m_width != viewWidth() || m_height != viewHeight());
    if (relayoutChildren) {
        setChildNeedsLayout(true, false);
        for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
            if (child->style()->height().isPercent() || child->style()->minHeight().isPercent() || child->style()->maxHeight().isPercent())
                child->setChildNeedsLayout(true, false);
        }
    }

    ASSERT(!m_layoutState);
    LayoutState state;
    IntRect viewRectangle = viewRect();
    // An empty rect is not valid viewRect.
    state.m_clipped = !viewRectangle.isEmpty();

    if (state.m_clipped) {
        state.m_clipRect = IntRect(IntPoint(0, 0), viewRectangle.size());
        state.m_offset = IntSize(viewRectangle.x(), viewRectangle.y());
    }
    m_layoutState = &state;

    if (needsLayout())
        RenderBlock::layout();

    // Ensure that docWidth() >= width() and docHeight() >= height().
    setOverflowWidth(m_width);
    setOverflowHeight(m_height);

    setOverflowWidth(docWidth());
    setOverflowHeight(docHeight());

    ASSERT(m_layoutStateDisableCount == 0);
    ASSERT(m_layoutState == &state);
    m_layoutState = 0;
    setNeedsLayout(false);
    layoutCounter.stopCounting();
}
Пример #4
0
void RenderView::layout()
{
    if (m_printingMode)
        m_minWidth = m_width;

    // FIXME: This is all just a terrible workaround for bugs in layout when the view height changes.  
    // Find a better way to detect view height changes.  We're guessing that if we don't need layout that the reason
    // we were called is because of a FrameView bounds change.
    if (!needsLayout()) {
        setChildNeedsLayout(true, false);
        setMinMaxKnown(false);
        for (RenderObject *c = firstChild(); c; c = c->nextSibling())
            c->setChildNeedsLayout(true, false);
    }

    if (recalcMinMax())
        recalcMinMaxWidths();

    RenderBlock::layout();

    int docw = docWidth();
    int doch = docHeight();

    if (!m_printingMode) {
        setWidth(m_frameView->visibleWidth());
        setHeight(m_frameView->visibleHeight());
    }

    // ### we could maybe do the call below better and only pass true if the docsize changed.
    layoutPositionedObjects( true );

    layer()->setHeight(max(doch, m_height));
    layer()->setWidth(max(docw, m_width));
    
    setNeedsLayout(false);
}