Commit bf782019 authored by darin@apple.com's avatar darin@apple.com

Special layout handler should be done on top frame being printed.

https://bugs.webkit.org/show_bug.cgi?id=88201

Patch by Vitaly Buka <vitalybuka@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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@119548 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c8c0f145
2012-06-05 Vitaly Buka <vitalybuka@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 <mfeil@rim.com>
[BlackBerry] Conditionally enlarge HTML5 video controls in fullscreen mode
......
......@@ -522,8 +522,7 @@ void Frame::setPrinting(bool printing, const FloatSize& pageSize, const FloatSiz
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 @@ void Frame::setPrinting(bool printing, const FloatSize& pageSize, const FloatSiz
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;
......
......@@ -141,6 +141,7 @@ namespace WebCore {
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;
......
......@@ -656,8 +656,7 @@ 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();
return frame && frame->shouldUsePrintingLayout();
}
size_t RenderView::getRetainedWidgets(Vector<RenderWidget*>& renderWidgets)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment