Index: Source/WebCore/page/Frame.cpp |
=================================================================== |
--- Source/WebCore/page/Frame.cpp (revision 121785) |
+++ Source/WebCore/page/Frame.cpp (working copy) |
@@ -522,8 +522,7 @@ |
view()->adjustMediaTypeForPrinting(printing); |
m_doc->styleResolverChanged(RecalcStyleImmediately); |
- if (printing && !tree()->parent()) { |
- // Only root frame should be fit to page size. Subframes should be constrained by parents only. |
+ if (shouldUsePrintingLayout()) { |
view()->forceLayoutForPagination(pageSize, originalPageSize, maximumShrinkRatio, shouldAdjustViewSize); |
} else { |
view()->forceLayout(); |
@@ -536,6 +535,13 @@ |
child->setPrinting(printing, FloatSize(), FloatSize(), 0, shouldAdjustViewSize); |
} |
+bool Frame::shouldUsePrintingLayout() const |
+{ |
+ // Only top frame being printed should be fit to page size. |
+ // Subframes should be constrained by parents only. |
+ return m_doc->printing() && (!tree()->parent() || !tree()->parent()->m_doc->printing()); |
+} |
+ |
FloatSize Frame::resizePageRectsKeepingRatio(const FloatSize& originalSize, const FloatSize& expectedSize) |
{ |
FloatSize resultSize; |