Changeset 119548 in webkit


Ignore:
Timestamp:
Jun 5, 2012 6:51:08 PM (12 years ago)
Author:
Darin Adler
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 <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.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r119547 r119548  
     12012-06-05  Vitaly Buka  <vitalybuka@chromium.org>
     2
     3        Special layout handler should be done on top frame being printed.
     4        https://bugs.webkit.org/show_bug.cgi?id=88201
     5
     6        Reviewed by Brady Eidson.
     7
     8        No new tests. Root case is already covered by tests.
     9        Case described in the issue can be reproduced only by direct call
     10        to Frame::setPrinting of subframe. Probably it's not possible with
     11        layout tests.
     12
     13        * page/Frame.cpp:
     14        (WebCore::Frame::setPrinting):
     15        Use shouldUsePrintingLayout to choose proper version of forceLayout().
     16        (WebCore::Frame::shouldUsePrintingLayout):
     17        Checks if current frame is the top frame being printed.
     18        * rendering/RenderView.cpp:
     19        (WebCore::RenderView::shouldUsePrintingLayout): Forward to Frame.
     20
    1212012-06-05  Max Feil  <mfeil@rim.com>
    222
  • trunk/Source/WebCore/page/Frame.cpp

    r119225 r119548  
    523523
    524524    m_doc->styleResolverChanged(RecalcStyleImmediately);
    525     if (printing && !tree()->parent()) {
    526         // Only root frame should be fit to page size. Subframes should be constrained by parents only.
     525    if (shouldUsePrintingLayout()) {
    527526        view()->forceLayoutForPagination(pageSize, originalPageSize, maximumShrinkRatio, shouldAdjustViewSize);
    528527    } else {
     
    535534    for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling())
    536535        child->setPrinting(printing, FloatSize(), FloatSize(), 0, shouldAdjustViewSize);
     536}
     537
     538bool Frame::shouldUsePrintingLayout() const
     539{
     540    // Only top frame being printed should be fit to page size.
     541    // Subframes should be constrained by parents only.
     542    return m_doc->printing() && (!tree()->parent() || !tree()->parent()->m_doc->printing());
    537543}
    538544
  • trunk/Source/WebCore/page/Frame.h

    r119225 r119548  
    142142
    143143        void setPrinting(bool printing, const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkRatio, AdjustViewSizeOrNot);
     144        bool shouldUsePrintingLayout() const;
    144145        FloatSize resizePageRectsKeepingRatio(const FloatSize& originalSize, const FloatSize& expectedSize);
    145146
  • trunk/Source/WebCore/rendering/RenderView.cpp

    r118569 r119548  
    657657        return false;
    658658    Frame* frame = m_frameView->frame();
    659     // Only root frame should have special handling for printing.
    660     return frame && !frame->tree()->parent();
     659    return frame && frame->shouldUsePrintingLayout();
    661660}
    662661
Note: See TracChangeset for help on using the changeset viewer.