/*! \property QWebFrame::contentsSize \brief the size of the contents in this frame */ QSize QWebFrame::contentsSize() const { FrameView *view = d->frame->view(); if (!view) return QSize(); return QSize(view->contentsWidth(), view->contentsHeight()); }
void RenderPartObject::calcHeight() { RenderPart::calcHeight(); if (!node()->hasTagName(iframeTag) || !widget() || !widget()->isFrameView()) return; FrameView* view = static_cast<FrameView*>(widget()); RenderView* root = static_cast<RenderView*>(view->frame()->contentRenderer()); if (!root) return; // Do not expand if the scrollbars are suppressed and the height is fixed. bool scrolling = static_cast<HTMLIFrameElement*>(node())->scrollingMode() != ScrollbarAlwaysOff; if (!scrolling && style()->height().isFixed()) return; // Update the widget updateWidgetPosition(); //SAMSUNG CHANGE >> // Browser freeze issue in http://www.enuri.com/ /* do { view->layout(); } while (view->layoutPending() || root->needsLayout()); */ node()->document()->page()->mainFrame()->view()->layoutIfNeededRecursive(); //SAMSUNG CHANGE << int extraHeight = paddingTop() + paddingBottom() + borderTop() + borderBottom(); setHeight(max(width(), view->contentsHeight() + extraHeight)); // Update one last time to ensure the dimensions. updateWidgetPosition(); }
void RenderFrame::layout() { FrameView* view = static_cast<FrameView*>(widget()); RenderView* root = view ? view->frame()->contentRenderer() : 0; // Do not expand frames which has zero width or height if (!width() || !height() || !root) { updateWidgetPosition(); if (view) view->layout(); setNeedsLayout(false); return; } HTMLFrameElementBase* element = static_cast<HTMLFrameElementBase*>(node()); if (element->scrollingMode() == ScrollbarAlwaysOff && !root->isFrameSet()) { setNeedsLayout(false); return; } // Update the dimensions to get the correct width and height updateWidgetPosition(); if (root->preferredLogicalWidthsDirty()) root->computePreferredLogicalWidths(); // Expand the frame by setting frame height = content height setWidth(max(view->contentsWidth() + borderAndPaddingWidth(), width())); setHeight(max(view->contentsHeight() + borderAndPaddingHeight(), height())); // Update one more time updateWidgetPosition(); setNeedsLayout(false); }
int HTMLBodyElement::scrollHeight() const { // Update the document's layout. Document* document = this->document(); document->updateLayoutIgnorePendingStylesheets(); FrameView* view = document->view(); return view ? adjustForZoom(view->contentsHeight(), document) : 0; }
int HTMLBodyElement::scrollHeight() const { // Update the document's layout. Document* doc = document(); doc->updateLayoutIgnorePendingStylesheets(); FrameView* view = doc->view(); return view ? view->contentsHeight() : 0; }
InRegionScrollableArea::InRegionScrollableArea(WebPagePrivate* webPage, RenderLayer* layer) : m_webPage(webPage) , m_layer(layer) { ASSERT(webPage); ASSERT(layer); m_isNull = false; // FIXME: Add an ASSERT here as the 'layer' must be scrollable. RenderObject* layerRenderer = layer->renderer(); ASSERT(layerRenderer); if (layerRenderer->isRenderView()) { // #document case FrameView* view = toRenderView(layerRenderer)->frameView(); ASSERT(view); Frame* frame = view->frame(); ASSERT_UNUSED(frame, frame); m_scrollPosition = m_webPage->mapToTransformed(view->scrollPosition()); m_contentsSize = m_webPage->mapToTransformed(view->contentsSize()); m_viewportSize = m_webPage->mapToTransformed(view->visibleContentRect(false /*includeScrollbars*/)).size(); m_visibleWindowRect = m_webPage->mapToTransformed(m_webPage->getRecursiveVisibleWindowRect(view)); IntRect transformedWindowRect = IntRect(IntPoint::zero(), m_webPage->transformedViewportSize()); m_visibleWindowRect.intersect(transformedWindowRect); m_scrollsHorizontally = view->contentsWidth() > view->visibleWidth(); m_scrollsVertically = view->contentsHeight() > view->visibleHeight(); m_overscrollLimitFactor = 0.0; // FIXME eventually support overscroll } else { // RenderBox-based elements case (scrollable boxes (div's, p's, textarea's, etc)). RenderBox* box = m_layer->renderBox(); ASSERT(box); ASSERT(box->canBeScrolledAndHasScrollableArea()); ScrollableArea* scrollableArea = static_cast<ScrollableArea*>(m_layer); m_scrollPosition = m_webPage->mapToTransformed(scrollableArea->scrollPosition()); m_contentsSize = m_webPage->mapToTransformed(scrollableArea->contentsSize()); m_viewportSize = m_webPage->mapToTransformed(scrollableArea->visibleContentRect(false /*includeScrollbars*/)).size(); m_visibleWindowRect = m_layer->renderer()->absoluteClippedOverflowRect(); m_visibleWindowRect = m_layer->renderer()->frame()->view()->contentsToWindow(m_visibleWindowRect); IntRect visibleFrameWindowRect = m_webPage->getRecursiveVisibleWindowRect(m_layer->renderer()->frame()->view()); m_visibleWindowRect.intersect(visibleFrameWindowRect); m_visibleWindowRect = m_webPage->mapToTransformed(m_visibleWindowRect); IntRect transformedWindowRect = IntRect(IntPoint::zero(), m_webPage->transformedViewportSize()); m_visibleWindowRect.intersect(transformedWindowRect); m_scrollsHorizontally = box->scrollWidth() != box->clientWidth() && box->scrollsOverflowX(); m_scrollsVertically = box->scrollHeight() != box->clientHeight() && box->scrollsOverflowY(); m_overscrollLimitFactor = 0.0; // FIXME eventually support overscroll } }
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); }
IntRect WebFrame::contentBounds() const { if (!m_coreFrame) return IntRect(); FrameView* view = m_coreFrame->view(); if (!view) return IntRect(); return IntRect(0, 0, view->contentsWidth(), view->contentsHeight()); }
IntRect WebFrame::contentBounds() { Frame* coreFrame = core(this); if (!coreFrame) return IntRect(); FrameView* view = coreFrame->view(); if (!view) return IntRect(); return IntRect(0, 0, view->contentsWidth(), view->contentsHeight()); }
int HTMLBodyElement::scrollHeight() { // Update the document's layout. document().updateLayoutIgnorePendingStylesheets(); Frame* frame = document().frame(); if (!frame) return 0; FrameView* view = frame->view(); if (!view) return 0; return adjustForZoom(view->contentsHeight(), *frame); }
void RenderFrameBase::layoutWithFlattening(bool fixedWidth, bool fixedHeight) { FrameView* childFrameView = static_cast<FrameView*>(widget()); RenderView* childRoot = childFrameView ? static_cast<RenderView*>(childFrameView->frame()->contentRenderer()) : 0; // Do not expand frames which has zero width or height if (!width() || !height() || !childRoot) { updateWidgetPosition(); if (childFrameView) childFrameView->layout(); setNeedsLayout(false); return; } // need to update to calculate min/max correctly updateWidgetPosition(); if (childRoot->preferredLogicalWidthsDirty()) childRoot->computePreferredLogicalWidths(); // if scrollbars are off, and the width or height are fixed // we obey them and do not expand. With frame flattening // no subframe much ever become scrollable. HTMLFrameElementBase* element = static_cast<HTMLFrameElementBase*>(node()); bool isScrollable = element->scrollingMode() != ScrollbarAlwaysOff; // consider iframe inset border int hBorder = borderLeft() + borderRight(); int vBorder = borderTop() + borderBottom(); // make sure minimum preferred width is enforced if (isScrollable || !fixedWidth) { setWidth(max(width(), childRoot->minPreferredLogicalWidth() + hBorder)); // update again to pass the new width to the child frame updateWidgetPosition(); childFrameView->layout(); } // expand the frame by setting frame height = content height if (isScrollable || !fixedHeight || childRoot->isFrameSet()) setHeight(max(height(), childFrameView->contentsHeight() + vBorder)); if (isScrollable || !fixedWidth || childRoot->isFrameSet()) setWidth(max(width(), childFrameView->contentsWidth() + hBorder)); updateWidgetPosition(); ASSERT(!childFrameView->layoutPending()); ASSERT(!childRoot->needsLayout()); ASSERT(!childRoot->firstChild() || !childRoot->firstChild()->firstChild() || !childRoot->firstChild()->firstChild()->needsLayout()); setNeedsLayout(false); }
bool WebFrame::hasScrollBars() { Frame* coreFrame = core(this); if (!coreFrame) return false; FrameView* view = coreFrame->view(); if (!view) return false; if (view->vScrollbarMode() == ScrollbarAlwaysOn || view->visibleHeight() < view->contentsHeight() || view->hScrollbarMode() == ScrollbarAlwaysOn || view->visibleWidth() < view->contentsWidth()) return true; return false; }
void RenderPartObject::calcHeight() { RenderPart::calcHeight(); if (!flattenFrame()) return; HTMLIFrameElement* frame = static_cast<HTMLIFrameElement*>(node()); bool isScrollable = frame->scrollingMode() != ScrollbarAlwaysOff; if (isScrollable || !style()->height().isFixed()) { FrameView* view = static_cast<FrameView*>(widget()); int border = borderTop() + borderBottom(); setHeight(max(height(), view->contentsHeight() + border)); } }
void RenderPartObject::layout() { ASSERT(needsLayout()); ASSERT(minMaxKnown()); FrameView* childFrameView = static_cast<FrameView*>(m_widget); RenderView* childRoot = 0; bool flatten = m_widget && element()->hasTagName(iframeTag) && element() && element()->document()->frame() && element()->document()->frame()->settings()->flatFrameSetLayoutEnabled() && (static_cast<HTMLIFrameElement*>(element())->scrollingMode() != ScrollBarAlwaysOff || !style()->width().isFixed() || !style()->height().isFixed()) && (childRoot = childFrameView ? static_cast<RenderView*>(childFrameView->frame()->renderer()) : 0); if (flatten) { if (!childRoot->minMaxKnown()) childRoot->calcMinMaxWidth(); calcWidth(); calcHeight(); bool scrolling = static_cast<HTMLIFrameElement*>(element())->scrollingMode() != ScrollBarAlwaysOff; if (scrolling || !style()->width().isFixed()) m_width = max(m_width, childRoot->minWidth()); updateWidgetPosition(); do childFrameView->layout(); while (childFrameView->layoutPending() || childRoot->needsLayout()); if (scrolling || !style()->height().isFixed()) m_height = max(m_height, childFrameView->contentsHeight()); if (scrolling || !style()->width().isFixed()) m_width = max(m_width, childFrameView->contentsWidth()); updateWidgetPosition(); ASSERT(!childFrameView->layoutPending()); ASSERT(!childRoot->needsLayout()); ASSERT(!childRoot->firstChild() || !childRoot->firstChild()->firstChild() || !childRoot->firstChild()->firstChild()->needsLayout()); } else { calcWidth(); calcHeight(); RenderPart::layout(); } setNeedsLayout(false); }
void RenderFrameBase::layoutWithFlattening(bool hasFixedWidth, bool hasFixedHeight) { FrameView* childFrameView = toFrameView(widget()); RenderView* childRoot = childFrameView ? childFrameView->frame().contentRenderer() : 0; if (!childRoot || !shouldExpandFrame(width(), height(), hasFixedWidth, hasFixedHeight)) { updateWidgetPosition(); if (childFrameView) childFrameView->layout(); clearNeedsLayout(); return; } // need to update to calculate min/max correctly updateWidgetPosition(); // if scrollbars are off, and the width or height are fixed // we obey them and do not expand. With frame flattening // no subframe much ever become scrollable. bool isScrollable = frameOwnerElement().scrollingMode() != ScrollbarAlwaysOff; // consider iframe inset border int hBorder = borderLeft() + borderRight(); int vBorder = borderTop() + borderBottom(); // make sure minimum preferred width is enforced if (isScrollable || !hasFixedWidth) { setWidth(std::max(width(), childRoot->minPreferredLogicalWidth() + hBorder)); // update again to pass the new width to the child frame updateWidgetPosition(); childFrameView->layout(); } // expand the frame by setting frame height = content height if (isScrollable || !hasFixedHeight || childRoot->isFrameSet()) setHeight(std::max<LayoutUnit>(height(), childFrameView->contentsHeight() + vBorder)); if (isScrollable || !hasFixedWidth || childRoot->isFrameSet()) setWidth(std::max<LayoutUnit>(width(), childFrameView->contentsWidth() + hBorder)); updateWidgetPosition(); ASSERT(!childFrameView->layoutPending()); ASSERT(!childRoot->needsLayout()); ASSERT(!childRoot->firstChild() || !childRoot->firstChild()->firstChildSlow() || !childRoot->firstChild()->firstChildSlow()->needsLayout()); clearNeedsLayout(); }
void RenderIFrame::layoutSeamlessly() { updateLogicalWidth(); // FIXME: Containers set their height to 0 before laying out their kids (as we're doing here) // however, this causes FrameView::layout() to add vertical scrollbars, incorrectly inflating // the resulting contentHeight(). We'll need to make FrameView::layout() smarter. setLogicalHeight(0); updateWidgetPosition(); // Tell the Widget about our new width/height (it will also layout the child document). // Laying out our kids is normally responsible for adjusting our height, so we set it here. // Replaced elements normally do not respect padding, but seamless elements should: we'll add // both padding and border to the child's logical height here. FrameView* childFrameView = toFrameView(widget()); if (childFrameView) // Widget should never be null during layout(), but just in case. setLogicalHeight(childFrameView->contentsHeight() + borderTop() + borderBottom() + paddingTop() + paddingBottom()); updateLogicalHeight(); updateWidgetPosition(); // Notify the Widget of our final height. // Assert that the child document did a complete layout. RenderView* childRoot = childFrameView ? childFrameView->frame()->contentRenderer() : 0; ASSERT(!childFrameView || !childFrameView->layoutPending()); ASSERT_UNUSED(childRoot, !childRoot || !childRoot->needsLayout()); }
InRegionScrollableArea::InRegionScrollableArea(WebPagePrivate* webPage, RenderLayer* layer) : m_webPage(webPage) , m_layer(layer) , m_document(0) , m_hasWindowVisibleRectCalculated(false) { ASSERT(webPage); ASSERT(layer); m_isNull = false; // Add a pointer to the enclosing document as the pointer to layer or node along the way may become invalid. if (m_layer->enclosingElement()) m_document = m_layer->enclosingElement()->document(); // FIXME: Add an ASSERT here as the 'layer' must be scrollable. RenderObject* layerRenderer = layer->renderer(); ASSERT(layerRenderer); if (layerRenderer->isRenderView()) { // #document case RenderView* renderView = toRenderView(layerRenderer); ASSERT(renderView); FrameView* view = toRenderView(layerRenderer)->frameView(); ASSERT(view); Frame* frame = view->frame(); ASSERT_UNUSED(frame, frame); m_scrollPosition = m_webPage->mapToTransformed(view->scrollPosition()); m_contentsSize = m_webPage->mapToTransformed(view->contentsSize()); m_viewportSize = m_webPage->mapToTransformed(view->visibleContentRect(ScrollableArea::ExcludeScrollbars)).size(); m_documentViewportRect = view->frameRect(); m_scrollsHorizontally = view->contentsWidth() > view->visibleWidth(); m_scrollsVertically = view->contentsHeight() > view->visibleHeight(); m_supportsCompositedScrolling = true; m_scrollTarget = InnerFrame; ASSERT(!m_cachedNonCompositedScrollableNode); m_camouflagedCompositedScrollableLayer = reinterpret_cast<unsigned>(renderView->compositor()->scrollLayer()->platformLayer()); m_cachedCompositedScrollableLayer = renderView->compositor()->scrollLayer()->platformLayer(); } else { // RenderBox-based elements case (scrollable boxes (div's, p's, textarea's, etc)). RenderBox* box = m_layer->renderBox(); ASSERT(box); ASSERT(InRegionScrollerPrivate::canScrollRenderBox(box)); ScrollableArea* scrollableArea = static_cast<ScrollableArea*>(m_layer); m_scrollPosition = m_webPage->mapToTransformed(scrollableArea->scrollPosition()); m_contentsSize = m_webPage->mapToTransformed(scrollableArea->contentsSize()); m_viewportSize = m_webPage->mapToTransformed(scrollableArea->visibleContentRect(ScrollableArea::ExcludeScrollbars)).size(); m_documentViewportRect = enclosingIntRect(box->absoluteClippedOverflowRect()); m_scrollsHorizontally = box->scrollWidth() != box->clientWidth(); m_scrollsVertically = box->scrollHeight() != box->clientHeight(); // Check the overflow if its not an input field because overflow can be set to hidden etc. by the content. if (!box->node() || !box->node()->rendererIsEditable()) { m_scrollsHorizontally = m_scrollsHorizontally && box->scrollsOverflowX(); m_scrollsVertically = m_scrollsVertically && box->scrollsOverflowY(); } m_scrollTarget = BlockElement; // Both caches below are self-exclusive. if (m_layer->usesCompositedScrolling()) { m_forceContentToBeVerticallyScrollable = true; m_supportsCompositedScrolling = true; ASSERT(m_layer->backing()->hasScrollingLayer()); m_camouflagedCompositedScrollableLayer = reinterpret_cast<unsigned>(m_layer->backing()->scrollingContentsLayer()->platformLayer()); m_cachedCompositedScrollableLayer = m_layer->backing()->scrollingContentsLayer()->platformLayer(); ASSERT(!m_cachedNonCompositedScrollableNode); } else { m_camouflagedCompositedScrollableLayer = reinterpret_cast<unsigned>(m_layer->enclosingElement()); m_cachedNonCompositedScrollableNode = m_layer->enclosingElement(); ASSERT(!m_cachedCompositedScrollableLayer); } } }
int HTMLDocument::height() { updateLayoutIgnorePendingStylesheets(); FrameView* frameView = view(); return frameView ? frameView->contentsHeight() : 0; }
InRegionScrollableArea::InRegionScrollableArea(WebPagePrivate* webPage, RenderLayer* layer) : m_webPage(webPage) , m_layer(layer) , m_document(0) , m_hasWindowVisibleRectCalculated(false) { ASSERT(webPage); ASSERT(layer); m_isNull = false; // Add a pointer to the enclosing document as the pointer to layer or node along the way may become invalid. if (m_layer->enclosingElement()) m_document = m_layer->enclosingElement()->document(); // FIXME: Add an ASSERT here as the 'layer' must be scrollable. RenderObject* layerRenderer = layer->renderer(); ASSERT(layerRenderer); if (layerRenderer->isRenderView()) { // #document case RenderView* renderView = toRenderView(layerRenderer); ASSERT(renderView); FrameView* view = toRenderView(layerRenderer)->frameView(); ASSERT(view); Frame* frame = view->frame(); ASSERT_UNUSED(frame, frame); const Platform::ViewportAccessor* viewportAccessor = m_webPage->m_webkitThreadViewportAccessor; m_scrollPosition = viewportAccessor->roundToPixelFromDocumentContents(WebCore::FloatPoint(view->scrollPosition())); m_contentsSize = viewportAccessor->roundToPixelFromDocumentContents(Platform::FloatRect(Platform::FloatPoint::zero(), WebCore::FloatSize(view->contentsSize()))).size(); m_viewportSize = viewportAccessor->roundToPixelFromDocumentContents(WebCore::FloatRect(view->visibleContentRect(ScrollableArea::ExcludeScrollbars))).size(); m_documentViewportRect = view->frameRect(); m_scrollsHorizontally = view->contentsWidth() > view->visibleWidth(); m_scrollsVertically = view->contentsHeight() > view->visibleHeight(); m_supportsCompositedScrolling = true; m_scrollTarget = InnerFrame; ASSERT(!m_cachedNonCompositedScrollableNode); m_camouflagedCompositedScrollableLayer = reinterpret_cast<unsigned>(renderView->compositor()->scrollLayer()->platformLayer()); m_cachedCompositedScrollableLayer = renderView->compositor()->scrollLayer()->platformLayer(); } else { // RenderBox-based elements case (scrollable boxes (div's, p's, textarea's, etc)). RenderBox* box = m_layer->renderBox(); ASSERT(box); ASSERT(InRegionScrollerPrivate::canScrollRenderBox(box)); const Platform::ViewportAccessor* viewportAccessor = m_webPage->m_webkitThreadViewportAccessor; ScrollableArea* scrollableArea = static_cast<ScrollableArea*>(m_layer); m_scrollPosition = viewportAccessor->roundToPixelFromDocumentContents(WebCore::FloatPoint(scrollableArea->scrollPosition())); m_contentsSize = viewportAccessor->roundToPixelFromDocumentContents(Platform::FloatRect(Platform::FloatPoint::zero(), WebCore::FloatSize(scrollableArea->contentsSize()))).size(); m_viewportSize = viewportAccessor->roundToPixelFromDocumentContents(WebCore::FloatRect(scrollableArea->visibleContentRect(ScrollableArea::ExcludeScrollbars))).size(); m_documentViewportRect = enclosingIntRect(box->absoluteClippedOverflowRect()); m_scrollsHorizontally = box->scrollWidth() != box->clientWidth(); m_scrollsVertically = box->scrollHeight() != box->clientHeight(); // Check the overflow if its not an input field because overflow can be set to hidden etc. by the content. if (!DOMSupport::isShadowHostTextInputElement(box->node())) { m_scrollsHorizontally = m_scrollsHorizontally && box->scrollsOverflowX(); m_scrollsVertically = m_scrollsVertically && box->scrollsOverflowY(); } m_scrollTarget = BlockElement; // Both caches below are self-exclusive. if (m_layer->usesCompositedScrolling()) { m_forceContentToBeHorizontallyScrollable = m_scrollsHorizontally; m_forceContentToBeVerticallyScrollable = m_scrollsVertically; // Force content to be scrollable even if it doesn't need to scroll in either direction. if (!m_scrollsHorizontally && !m_scrollsVertically) { if (box->scrollsOverflowY()) m_forceContentToBeVerticallyScrollable = true; else if (box->scrollsOverflowX()) // If it's already forced scrollable vertically, don't force it to scroll horizontally m_forceContentToBeHorizontallyScrollable = true; } m_supportsCompositedScrolling = true; ASSERT(m_layer->backing()->hasScrollingLayer()); m_camouflagedCompositedScrollableLayer = reinterpret_cast<unsigned>(m_layer->backing()->scrollingContentsLayer()->platformLayer()); m_cachedCompositedScrollableLayer = m_layer->backing()->scrollingContentsLayer()->platformLayer(); ASSERT(!m_cachedNonCompositedScrollableNode); } else { m_camouflagedCompositedScrollableLayer = reinterpret_cast<unsigned>(m_layer->enclosingElement()); m_cachedNonCompositedScrollableNode = m_layer->enclosingElement(); ASSERT(!m_cachedCompositedScrollableLayer); } } }
void RenderPartObject::layout() { ASSERT(needsLayout()); #ifdef FLATTEN_IFRAME RenderPart::calcWidth(); RenderPart::calcHeight(); // Calculate the styled dimensions by subtracting the border and padding. int extraWidth = paddingLeft() + paddingRight() + borderLeft() + borderRight(); int extraHeight = paddingTop() + paddingBottom() + borderTop() + borderBottom(); int styleWidth = width() - extraWidth; int styleHeight = height() - extraHeight; // Some IFrames have a width and/or height of 1 when they are meant to be // hidden. If that is the case, do not try to expand. if (node()->hasTagName(iframeTag) && widget() && widget()->isFrameView() && styleWidth > 1 && styleHeight > 1) { HTMLIFrameElement* element = static_cast<HTMLIFrameElement*>(node()); bool scrolling = element->scrollingMode() != ScrollbarAlwaysOff; bool widthIsFixed = style()->width().isFixed(); bool heightIsFixed = style()->height().isFixed(); // If an iframe has a fixed dimension and suppresses scrollbars, it // will disrupt layout if we force it to expand. Plus on a desktop, // the extra content is not accessible. if (scrolling || !widthIsFixed || !heightIsFixed) { FrameView* view = static_cast<FrameView*>(widget()); RenderView* root = view ? view->frame()->contentRenderer() : NULL; if (root && style()->visibility() != HIDDEN) { // Update the dimensions to get the correct minimum preferred // width updateWidgetPosition(); // Use the preferred width if it is larger and only if // scrollbars are visible or the width style is not fixed. if (scrolling || !widthIsFixed) setWidth(max(width(), root->minPrefWidth()) + extraWidth); // Resize the view to recalc the height. int h = height() - extraHeight; int w = width() - extraWidth; if (w > view->width()) h = 0; if (w != view->width() || h != view->height()) { view->resize(w, h); } // Layout the view. //SAMSUNG CHANGE >> // Browser freeze issue in http://www.enuri.com/ /* do { view->layout(); } while (view->layoutPending() || root->needsLayout()); */ node()->document()->page()->mainFrame()->view()->layoutIfNeededRecursive(); //SAMSUNG CHANGE << int contentHeight = view->contentsHeight(); int contentWidth = view->contentsWidth(); // Only change the width or height if scrollbars are visible or // if the style is not a fixed value. Use the maximum value so // that iframes never shrink. if (scrolling || !heightIsFixed) setHeight(max(height(), contentHeight + extraHeight)); if (scrolling || !widthIsFixed) setWidth(max(width(), contentWidth + extraWidth)); // Update one last time updateWidgetPosition(); // Layout one more time to ensure all objects have the correct // height. view->layout(); #if !ASSERT_DISABLED ASSERT(!view->layoutPending()); ASSERT(!root->needsLayout()); // Sanity check when assertions are enabled. RenderObject* c = root->nextInPreOrder(); while (c) { ASSERT(!c->needsLayout()); c = c->nextInPreOrder(); } #endif } } } #else calcWidth(); calcHeight(); #endif RenderPart::layout(); m_overflow.clear(); addShadowOverflow(); setNeedsLayout(false); }