From a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 25 May 2012 15:09:11 +0200 Subject: Imported WebKit commit eb5c1b8fe4d4b1b90b5137433fc58a91da0e6878 (http://svn.webkit.org/repository/webkit/trunk@118516) --- Source/WebCore/rendering/RenderView.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'Source/WebCore/rendering/RenderView.cpp') diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp index 43ac53039..8633104e3 100644 --- a/Source/WebCore/rendering/RenderView.cpp +++ b/Source/WebCore/rendering/RenderView.cpp @@ -84,13 +84,13 @@ bool RenderView::hitTest(const HitTestRequest& request, HitTestResult& result) void RenderView::computeLogicalHeight() { - if (!printing() && m_frameView) + if (!shouldUsePrintingLayout() && m_frameView) setLogicalHeight(viewLogicalHeight()); } void RenderView::computeLogicalWidth() { - if (!printing() && m_frameView) + if (!shouldUsePrintingLayout() && m_frameView) setLogicalWidth(viewLogicalWidth()); } @@ -111,11 +111,11 @@ void RenderView::layout() if (!document()->paginated()) setPageLogicalHeight(0); - if (printing()) + if (shouldUsePrintingLayout()) m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth(); // 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()); + bool relayoutChildren = !shouldUsePrintingLayout() && (!m_frameView || width() != viewWidth() || height() != viewHeight()); if (relayoutChildren) { setChildNeedsLayout(true, MarkOnlyThis); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { @@ -629,6 +629,15 @@ bool RenderView::printing() const return document()->printing(); } +bool RenderView::shouldUsePrintingLayout() const +{ + if (!printing() || !m_frameView) + return false; + Frame* frame = m_frameView->frame(); + // Only root frame should have special handling for printing. + return frame && !frame->tree()->parent(); +} + size_t RenderView::getRetainedWidgets(Vector& renderWidgets) { size_t size = m_widgets.size(); @@ -693,7 +702,7 @@ void RenderView::notifyWidgets(WidgetNotification notification) LayoutRect RenderView::viewRect() const { - if (printing()) + if (shouldUsePrintingLayout()) return LayoutRect(LayoutPoint(), size()); if (m_frameView) return m_frameView->visibleContentRect(); @@ -733,7 +742,7 @@ IntRect RenderView::documentRect() const int RenderView::viewHeight() const { int height = 0; - if (!printing() && m_frameView) { + if (!shouldUsePrintingLayout() && m_frameView) { height = m_frameView->layoutHeight(); height = m_frameView->useFixedLayout() ? ceilf(style()->effectiveZoom() * float(height)) : height; } @@ -743,7 +752,7 @@ int RenderView::viewHeight() const int RenderView::viewWidth() const { int width = 0; - if (!printing() && m_frameView) { + if (!shouldUsePrintingLayout() && m_frameView) { width = m_frameView->layoutWidth(); width = m_frameView->useFixedLayout() ? ceilf(style()->effectiveZoom() * float(width)) : width; } -- cgit v1.2.1