void RenderPartObject::layout() { ASSERT(needsLayout()); calcWidth(); calcHeight(); #ifdef FLATTEN_IFRAME // Some IFrames have a width and/or height of 1 when they are meant to be // hidden. If that is the case, don't try to expand. if (m_widget && m_widget->isFrameView() && m_width > 1 && m_height > 1) { FrameView* view = static_cast<FrameView*>(m_widget); RenderView* root = NULL; if (view->frame() && view->frame()->document() && view->frame()->document()->renderer() && view->frame()->document()->renderer()->isRenderView()) root = static_cast<RenderView*>(view->frame()->document()->renderer()); if (root) { // Update the dimensions to get the correct minimum preferred width updateWidgetPosition(); // Use the preferred width if it is larger. m_width = max(m_width, root->minPrefWidth()); int extraWidth = paddingLeft() + paddingRight() + borderLeft() + borderRight(); int extraHeight = paddingTop() + paddingBottom() + borderTop() + borderBottom(); // Resize the view to recalc the height. int height = m_height - extraHeight; int width = m_width - extraWidth; if (width > view->width()) height = 0; if (width != view->width() || height != view->height()) { view->resize(width, height); root->setNeedsLayout(true, false); } // Layout the view. if (view->needsLayout()) view->layout(); int contentHeight = view->contentsHeight(); int contentWidth = view->contentsWidth(); // Do not shrink iframes with specified sizes if (contentHeight > m_height || style()->height().isAuto()) m_height = contentHeight; m_width = std::min(contentWidth, 800); } } #endif adjustOverflowForBoxShadow(); RenderPart::layout(); if (!m_widget && m_view) m_view->addWidgetToUpdate(this); setNeedsLayout(false); }
void FrameView::setNeedsLayout() { RenderView* root = m_frame->contentRenderer(); if (root) root->setNeedsLayout(true); }