Changeset 141459 in webkit


Ignore:
Timestamp:
Jan 31, 2013 12:00:12 PM (11 years ago)
Author:
ojan@chromium.org
Message:

REGRESSION(r128517): Percentage heights in quirks mode collapse when printing
https://bugs.webkit.org/show_bug.cgi?id=108382

Reviewed by David Hyatt.

Source/WebCore:

r128517 clean up our containing block finding logic, but broke percentage
heights in quirks mode during printing since the RenderView would have 0 height.
Turns out we already had a long-standing bug where we'd incorrectly
treat collapse percentage heights on the body when printing as well.

Fix both bugs by changing the way we grab the logical height on the RenderView.
RenderView::computeLogicalHeight returns 0 when printing. For the purposes of
stretching and percentage heights, we instead need to return the pageLogicalHeight.

Tests: printing/quirks-percentage-height-body.html

printing/quirks-percentage-height.html
printing/standards-percentage-heights.html

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::computeLogicalHeight):
This FIXME is outdated and already fixed. Also, call viewLogicalHeightForPercentages
which does the same logic except also correctly handles column RenderViews.
(WebCore::RenderBox::viewLogicalHeightForPercentages):
(WebCore::RenderBox::computePercentageLogicalHeight):

  • rendering/RenderBox.h:
  • rendering/RenderBox.cpp:

(WebCore::RenderBox::computeLogicalHeight):
(WebCore::RenderBox::viewLogicalHeightForPercentages):
(WebCore):
(WebCore::RenderBox::computePercentageLogicalHeight):

  • rendering/RenderBox.h:

(RenderBox):

LayoutTests:

  • platform/chromium/fast/multicol/shrink-to-column-height-for-pagination-expected.txt:

We're just clipping more content that you can't scroll to anyways. This looks
like an improvement to me.

  • printing/css2.1/page-break-inside-000-expected.txt:

We pass this test now!

  • printing/quirks-percentage-height-body-expected.html: Added.
  • printing/quirks-percentage-height-body.html: Added.
  • printing/quirks-percentage-height-expected.html: Added.
  • printing/quirks-percentage-height.html: Added.
  • printing/standards-percentage-heights-expected.html: Added.
  • printing/standards-percentage-heights.html: Added.
Location:
trunk
Files:
6 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r141458 r141459  
     12013-01-31  Ojan Vafai  <ojan@chromium.org>
     2
     3        REGRESSION(r128517): Percentage heights in quirks mode collapse when printing
     4        https://bugs.webkit.org/show_bug.cgi?id=108382
     5
     6        Reviewed by David Hyatt.
     7
     8        * platform/chromium/fast/multicol/shrink-to-column-height-for-pagination-expected.txt:
     9        We're just clipping more content that you can't scroll to anyways. This looks
     10        like an improvement to me.
     11        * printing/css2.1/page-break-inside-000-expected.txt:
     12        We pass this test now!
     13        * printing/quirks-percentage-height-body-expected.html: Added.
     14        * printing/quirks-percentage-height-body.html: Added.
     15        * printing/quirks-percentage-height-expected.html: Added.
     16        * printing/quirks-percentage-height.html: Added.
     17        * printing/standards-percentage-heights-expected.html: Added.
     18        * printing/standards-percentage-heights.html: Added.
     19
    1202013-01-31  Jessie Berlin  <jberlin@apple.com>
    221
  • trunk/LayoutTests/platform/chromium/fast/multicol/shrink-to-column-height-for-pagination-expected.txt

    r123111 r141459  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 400x600
    3 layer at (-400,0) size 800x600 backgroundClip at (0,0) size 800x600 clip at (0,0) size 800x600 outlineClip at (0,0) size 800x600
    4   RenderBlock {HTML} at (0,0) size 800x600
     3layer at (-16,0) size 416x600 backgroundClip at (0,0) size 800x600 clip at (0,0) size 800x600 outlineClip at (0,0) size 800x600
     4  RenderBlock {HTML} at (0,0) size 416x600
    55    RenderBody {BODY} at (8,8) size 400x600
    66      RenderBlock {DIV} at (0,0) size 400x600
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r141362 r141459  
    309309webkit.org/b/106405 http/tests/xmlhttprequest/remember-bad-password.html [ Failure ]
    310310
     311webkit.org/b/108507 printing/quirks-percentage-height-body.html [ Skip ]
     312webkit.org/b/108507 printing/quirks-percentage-height.html [ Skip ]
     313webkit.org/b/108507 printing/standards-percentage-heights.html [ Skip ]
     314
    311315webkit.org/b/107356 fast/css/sticky/sticky-top-zoomed.html [ ImageOnlyFailure ]
    312316
  • trunk/LayoutTests/printing/css2.1/page-break-inside-000-expected.txt

    r55275 r141459  
    22FIRST dummy dummy dummy dummy dummy dummy dummy dummy dummy FIRST
    33
    4 FAIL: expected page number of "test1" is 0. Was -1
    5 FAIL: expected page number of "test2" is 1. Was 0
     4PASS: page number of "test1" is 0
     5PASS: page number of "test2" is 1
     6All tests passed
  • trunk/Source/WebCore/ChangeLog

    r141456 r141459  
     12013-01-31  Ojan Vafai  <ojan@chromium.org>
     2
     3        REGRESSION(r128517): Percentage heights in quirks mode collapse when printing
     4        https://bugs.webkit.org/show_bug.cgi?id=108382
     5
     6        Reviewed by David Hyatt.
     7
     8        r128517 clean up our containing block finding logic, but broke percentage
     9        heights in quirks mode during printing since the RenderView would have 0 height.
     10        Turns out we already had a long-standing bug where we'd incorrectly
     11        treat collapse percentage heights on the body when printing as well.
     12
     13        Fix both bugs by changing the way we grab the logical height on the RenderView.
     14        RenderView::computeLogicalHeight returns 0 when printing. For the purposes of
     15        stretching and percentage heights, we instead need to return the pageLogicalHeight.
     16
     17        Tests: printing/quirks-percentage-height-body.html
     18               printing/quirks-percentage-height.html
     19               printing/standards-percentage-heights.html
     20
     21        * rendering/RenderBox.cpp:
     22        (WebCore::RenderBox::computeLogicalHeight):
     23        This FIXME is outdated and already fixed. Also, call viewLogicalHeightForPercentages
     24        which does the same logic except also correctly handles column RenderViews.
     25        (WebCore::RenderBox::viewLogicalHeightForPercentages):
     26        (WebCore::RenderBox::computePercentageLogicalHeight):
     27        * rendering/RenderBox.h:
     28
     29        * rendering/RenderBox.cpp:
     30        (WebCore::RenderBox::computeLogicalHeight):
     31        (WebCore::RenderBox::viewLogicalHeightForPercentages):
     32        (WebCore):
     33        (WebCore::RenderBox::computePercentageLogicalHeight):
     34        * rendering/RenderBox.h:
     35        (RenderBox):
     36
    1372013-01-31  Dirk Schulze  <krit@webkit.org>
    238
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r140978 r141459  
    24172417        && (isRoot() || (isBody() && document()->documentElement()->renderer()->style()->logicalHeight().isPercent()));
    24182418    if (stretchesToViewport() || paginatedContentNeedsBaseHeight) {
    2419         // FIXME: Finish accounting for block flow here.
    2420         // https://bugs.webkit.org/show_bug.cgi?id=46603
    24212419        LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter();
    2422         LayoutUnit visHeight;
    2423         if (document()->printing())
    2424             visHeight = static_cast<LayoutUnit>(view()->pageLogicalHeight());
    2425         else  {
    2426             if (isHorizontalWritingMode())
    2427                 visHeight = view()->viewHeight();
    2428             else
    2429                 visHeight = view()->viewWidth();
    2430         }
     2420        LayoutUnit visibleHeight = viewLogicalHeightForPercentages();
    24312421        if (isRoot())
    2432             computedValues.m_extent = max(computedValues.m_extent, visHeight - margins);
     2422            computedValues.m_extent = max(computedValues.m_extent, visibleHeight - margins);
    24332423        else {
    24342424            LayoutUnit marginsBordersPadding = margins + parentBox()->marginBefore() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight();
    2435             computedValues.m_extent = max(computedValues.m_extent, visHeight - marginsBordersPadding);
    2436         }
    2437     }
     2425            computedValues.m_extent = max(computedValues.m_extent, visibleHeight - marginsBordersPadding);
     2426        }
     2427    }
     2428}
     2429
     2430LayoutUnit RenderBox::viewLogicalHeightForPercentages() const
     2431{
     2432    if (document()->printing())
     2433        return static_cast<LayoutUnit>(view()->pageLogicalHeight());
     2434    return view()->viewLogicalHeight();
    24382435}
    24392436
     
    25432540            availableHeight = max<LayoutUnit>(0, contentBoxHeight);
    25442541        }
    2545     } else if (cb->isRenderView() || isOutOfFlowPositionedWithSpecifiedHeight) {
     2542    } else if (isOutOfFlowPositionedWithSpecifiedHeight) {
    25462543        // Don't allow this to affect the block' height() member variable, since this
    25472544        // can get called while the block is still laying out its kids.
     
    25492546        cb->computeLogicalHeight(cb->logicalHeight(), 0, computedValues);
    25502547        availableHeight = computedValues.m_extent - cb->borderAndPaddingLogicalHeight() - cb->scrollbarLogicalHeight();
    2551     }
     2548    } else if (cb->isRenderView())
     2549        availableHeight = viewLogicalHeightForPercentages();
    25522550
    25532551    if (availableHeight == -1)
  • trunk/Source/WebCore/rendering/RenderBox.h

    r140978 r141459  
    642642    LayoutUnit containingBlockLogicalHeightForPositioned(const RenderBoxModelObject* containingBlock, bool checkForPerpendicularWritingMode = true) const;
    643643
     644    LayoutUnit viewLogicalHeightForPercentages() const;
     645
    644646    void computePositionedLogicalHeight(LogicalExtentComputedValues&) const;
    645647    void computePositionedLogicalWidthUsing(SizeType, Length logicalWidth, const RenderBoxModelObject* containerBlock, TextDirection containerDirection,
Note: See TracChangeset for help on using the changeset viewer.