Title: [119548] trunk/Source/WebCore
- Revision
- 119548
- Author
- da...@apple.com
- Date
- 2012-06-05 18:51:08 -0700 (Tue, 05 Jun 2012)
Log Message
Special layout handler should be done on top frame being printed.
https://bugs.webkit.org/show_bug.cgi?id=88201
Patch by Vitaly Buka <vitalyb...@chromium.org> on 2012-06-05
Reviewed by Brady Eidson.
No new tests. Root case is already covered by tests.
Case described in the issue can be reproduced only by direct call
to Frame::setPrinting of subframe. Probably it's not possible with
layout tests.
* page/Frame.cpp:
(WebCore::Frame::setPrinting):
Use shouldUsePrintingLayout to choose proper version of forceLayout().
(WebCore::Frame::shouldUsePrintingLayout):
Checks if current frame is the top frame being printed.
* rendering/RenderView.cpp:
(WebCore::RenderView::shouldUsePrintingLayout): Forward to Frame.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (119547 => 119548)
--- trunk/Source/WebCore/ChangeLog 2012-06-06 01:40:38 UTC (rev 119547)
+++ trunk/Source/WebCore/ChangeLog 2012-06-06 01:51:08 UTC (rev 119548)
@@ -1,3 +1,23 @@
+2012-06-05 Vitaly Buka <vitalyb...@chromium.org>
+
+ Special layout handler should be done on top frame being printed.
+ https://bugs.webkit.org/show_bug.cgi?id=88201
+
+ Reviewed by Brady Eidson.
+
+ No new tests. Root case is already covered by tests.
+ Case described in the issue can be reproduced only by direct call
+ to Frame::setPrinting of subframe. Probably it's not possible with
+ layout tests.
+
+ * page/Frame.cpp:
+ (WebCore::Frame::setPrinting):
+ Use shouldUsePrintingLayout to choose proper version of forceLayout().
+ (WebCore::Frame::shouldUsePrintingLayout):
+ Checks if current frame is the top frame being printed.
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::shouldUsePrintingLayout): Forward to Frame.
+
2012-06-05 Max Feil <mf...@rim.com>
[BlackBerry] Conditionally enlarge HTML5 video controls in fullscreen mode
Modified: trunk/Source/WebCore/page/Frame.cpp (119547 => 119548)
--- trunk/Source/WebCore/page/Frame.cpp 2012-06-06 01:40:38 UTC (rev 119547)
+++ trunk/Source/WebCore/page/Frame.cpp 2012-06-06 01:51:08 UTC (rev 119548)
@@ -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;
Modified: trunk/Source/WebCore/page/Frame.h (119547 => 119548)
--- trunk/Source/WebCore/page/Frame.h 2012-06-06 01:40:38 UTC (rev 119547)
+++ trunk/Source/WebCore/page/Frame.h 2012-06-06 01:51:08 UTC (rev 119548)
@@ -141,6 +141,7 @@
Settings* settings() const; // can be NULL
void setPrinting(bool printing, const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkRatio, AdjustViewSizeOrNot);
+ bool shouldUsePrintingLayout() const;
FloatSize resizePageRectsKeepingRatio(const FloatSize& originalSize, const FloatSize& expectedSize);
bool inViewSourceMode() const;
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (119547 => 119548)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2012-06-06 01:40:38 UTC (rev 119547)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2012-06-06 01:51:08 UTC (rev 119548)
@@ -656,8 +656,7 @@
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();
+ return frame && frame->shouldUsePrintingLayout();
}
size_t RenderView::getRetainedWidgets(Vector<RenderWidget*>& renderWidgets)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes