Changeset 145305 in webkit


Ignore:
Timestamp:
Mar 8, 2013 10:40:13 PM (11 years ago)
Author:
robert@webkit.org
Message:

REGRESSION(r140907): Incorrect baseline for cells with media content during load
https://bugs.webkit.org/show_bug.cgi?id=108357

Reviewed by Julien Chaffraix.

Source/WebCore:

If a cell has replaced content, the intrinsic height of its content can change between layouts. If that's the case then the intrinsic padding we used
for layout (the padding required to push the contents of the cell down to the row's baseline) is included in the new height and baseline and makes both
of them wrong. So if a cell's content's intrinsic height has changed push the new content up into the intrinsic padding and relayout so that the rest of
table and row layout can use the correct baseline and height for this cell.

Tests: fast/css/vertical-align-baseline-rowspan-012.html

http/tests/css/vertical-align-baseline-after-image-load-2.html
http/tests/css/vertical-align-baseline-after-image-load-3.html
http/tests/css/vertical-align-baseline-after-image-load.html

  • rendering/RenderTableCell.cpp:

(WebCore::RenderTableCell::layout):

  • rendering/RenderTableCell.h:

(WebCore::RenderTableCell::isBaselineAligned):

  • rendering/RenderTableSection.cpp:

(WebCore::RenderTableSection::calcRowLogicalHeight):
(WebCore::RenderTableSection::layoutRows):

LayoutTests:

  • fast/css/vertical-align-baseline-rowspan-012-expected.html: Added.
  • fast/css/vertical-align-baseline-rowspan-012.html: Added.
  • http/tests/css/vertical-align-baseline-after-image-load-2-expected.html: Added.
  • http/tests/css/vertical-align-baseline-after-image-load-2.html: Added.
  • http/tests/css/vertical-align-baseline-after-image-load-3-expected.html: Added.
  • http/tests/css/vertical-align-baseline-after-image-load-3.html: Added.
  • http/tests/css/vertical-align-baseline-after-image-load-expected.html: Added.
  • http/tests/css/vertical-align-baseline-after-image-load.html: Added.
Location:
trunk
Files:
8 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r145300 r145305  
     12013-03-07  Robert Hogan  <robert@webkit.org>
     2
     3        REGRESSION(r140907): Incorrect baseline for cells with media content during load
     4        https://bugs.webkit.org/show_bug.cgi?id=108357
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        * fast/css/vertical-align-baseline-rowspan-012-expected.html: Added.
     9        * fast/css/vertical-align-baseline-rowspan-012.html: Added.
     10        * http/tests/css/vertical-align-baseline-after-image-load-2-expected.html: Added.
     11        * http/tests/css/vertical-align-baseline-after-image-load-2.html: Added.
     12        * http/tests/css/vertical-align-baseline-after-image-load-3-expected.html: Added.
     13        * http/tests/css/vertical-align-baseline-after-image-load-3.html: Added.
     14        * http/tests/css/vertical-align-baseline-after-image-load-expected.html: Added.
     15        * http/tests/css/vertical-align-baseline-after-image-load.html: Added.
     16
    1172013-03-08  Sheriff Bot  <webkit.review.bot@gmail.com>
    218
  • trunk/Source/WebCore/ChangeLog

    r145304 r145305  
     12013-03-07  Robert Hogan  <robert@webkit.org>
     2
     3        REGRESSION(r140907): Incorrect baseline for cells with media content during load
     4        https://bugs.webkit.org/show_bug.cgi?id=108357
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        If a cell has replaced content, the intrinsic height of its content can change between layouts. If that's the case then the intrinsic padding we used
     9        for layout (the padding required to push the contents of the cell down to the row's baseline) is included in the new height and baseline and makes both
     10        of them wrong. So if a cell's content's intrinsic height has changed push the new content up into the intrinsic padding and relayout so that the rest of
     11        table and row layout can use the correct baseline and height for this cell.
     12
     13        Tests: fast/css/vertical-align-baseline-rowspan-012.html
     14               http/tests/css/vertical-align-baseline-after-image-load-2.html
     15               http/tests/css/vertical-align-baseline-after-image-load-3.html
     16               http/tests/css/vertical-align-baseline-after-image-load.html
     17
     18        * rendering/RenderTableCell.cpp:
     19        (WebCore::RenderTableCell::layout):
     20        * rendering/RenderTableCell.h:
     21        (WebCore::RenderTableCell::isBaselineAligned):
     22        * rendering/RenderTableSection.cpp:
     23        (WebCore::RenderTableSection::calcRowLogicalHeight):
     24        (WebCore::RenderTableSection::layoutRows):
     25
    1262013-03-08  Chris Fleizach  <cfleizach@apple.com>
    227
  • trunk/Source/WebCore/rendering/RenderTableCell.cpp

    r143926 r145305  
    244244    StackStats::LayoutCheckPoint layoutCheckPoint;
    245245    updateFirstLetter();
     246
     247    int oldCellBaseline = cellBaselinePosition();
    246248    layoutBlock(cellWidthChanged());
     249
     250    // If we have replaced content, the intrinsic height of our content may have changed since the last time we laid out. If that's the case the intrinsic padding we used
     251    // for layout (the padding required to push the contents of the cell down to the row's baseline) is included in our new height and baseline and makes both
     252    // of them wrong. So if our content's intrinsic height has changed push the new content up into the intrinsic padding and relayout so that the rest of
     253    // table and row layout can use the correct baseline and height for this cell.
     254    if (isBaselineAligned() && cellBaselinePosition() > section()->rowBaseline(rowIndex())) {
     255        int newIntrinsicPaddingBefore = max<LayoutUnit>(0, intrinsicPaddingBefore() - max<LayoutUnit>(0, cellBaselinePosition() - oldCellBaseline));
     256        setIntrinsicPaddingBefore(newIntrinsicPaddingBefore);
     257        setNeedsLayout(true, MarkOnlyThis);
     258        layoutBlock(cellWidthChanged());
     259    }
     260
    247261    setCellWidthChanged(false);
    248262}
  • trunk/Source/WebCore/rendering/RenderTableCell.h

    r145242 r145305  
    126126
    127127    LayoutUnit cellBaselinePosition() const;
     128    bool isBaselineAligned() const
     129    {
     130        EVerticalAlign va = style()->verticalAlign();
     131        return va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB || va == LENGTH;
     132    }
    128133
    129134    void computeIntrinsicPadding(int rowHeight);
  • trunk/Source/WebCore/rendering/RenderTableSection.cpp

    r144565 r145305  
    320320
    321321                // Find out the baseline. The baseline is set on the first row in a rowspan.
    322                 EVerticalAlign va = cell->style()->verticalAlign();
    323                 if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB || va == LENGTH) {
     322                if (cell->isBaselineAligned()) {
    324323                    LayoutUnit baselinePosition = cell->cellBaselinePosition();
    325324                    if (baselinePosition > cell->borderBefore() + cell->paddingBefore()) {
     
    584583
    585584                // If the baseline moved, we may have to update the data for our row. Find out the new baseline.
    586                 EVerticalAlign va = cell->style()->verticalAlign();
    587                 if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB || va == LENGTH) {
     585                if (cell->isBaselineAligned()) {
    588586                    LayoutUnit baseline = cell->cellBaselinePosition();
    589587                    if (baseline > cell->borderBefore() + cell->paddingBefore())
Note: See TracChangeset for help on using the changeset viewer.