Index: Source/WebCore/rendering/RenderView.cpp |
=================================================================== |
--- Source/WebCore/rendering/RenderView.cpp (revision 118242) |
+++ Source/WebCore/rendering/RenderView.cpp (working copy) |
@@ -84,13 +84,13 @@ |
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 @@ |
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()) { |
@@ -647,6 +647,15 @@ |
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<RenderWidget*>& renderWidgets) |
{ |
size_t size = m_widgets.size(); |
@@ -711,7 +720,7 @@ |
LayoutRect RenderView::viewRect() const |
{ |
- if (printing()) |
+ if (shouldUsePrintingLayout()) |
return LayoutRect(LayoutPoint(), size()); |
if (m_frameView) |
return m_frameView->visibleContentRect(); |
@@ -751,7 +760,7 @@ |
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; |
} |
@@ -761,7 +770,7 @@ |
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; |
} |