Changeset 140907 in webkit


Ignore:
Timestamp:
Jan 26, 2013 1:36:34 AM (11 years ago)
Author:
robert@webkit.org
Message:

REGRESSION(r120616): Cell's logical height wrongly computed with vertical-align: baseline and rowspan
https://bugs.webkit.org/show_bug.cgi?id=106571

Reviewed by Julien Chaffraix.

Source/WebCore:

When a cell spans multiple rows, its baseline is set on the first row it spans. r120616 contained a
couple of errors in its attempt to ensure the row height calculated in such cases was correct. When it
calculated the baseline on the first row in the span, it didn't ensure that the row height was increased
if necessary. It also suffered from allowing the baseline descent calculated on a rowspan to affect the
height of the other cells in the first row of the span.

Fix both of these errors in calcRowLogicalHeight() and refactor the calculation of the baseline and baseline
descent so that it is freestanding (rather than depending on the height of the section so far).

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

fast/css/vertical-align-baseline-rowspan-011.html

  • rendering/RenderTableSection.cpp:

(WebCore::RenderTableSection::calcRowLogicalHeight):

LayoutTests:

  • fast/css/vertical-align-baseline-rowspan-010-expected.html: Added.
  • fast/css/vertical-align-baseline-rowspan-010.html: Added.
  • fast/css/vertical-align-baseline-rowspan-011-expected.html: Added.
  • fast/css/vertical-align-baseline-rowspan-011.html: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140885 r140907  
     12013-01-26  Robert Hogan  <robert@webkit.org>
     2
     3        REGRESSION(r120616): Cell's logical height wrongly computed with vertical-align: baseline and rowspan
     4        https://bugs.webkit.org/show_bug.cgi?id=106571
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        * fast/css/vertical-align-baseline-rowspan-010-expected.html: Added.
     9        * fast/css/vertical-align-baseline-rowspan-010.html: Added.
     10        * fast/css/vertical-align-baseline-rowspan-011-expected.html: Added.
     11        * fast/css/vertical-align-baseline-rowspan-011.html: Added.
     12
    1132013-01-25  Elliott Sprehn  <esprehn@chromium.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r140906 r140907  
     12013-01-26  Robert Hogan  <robert@webkit.org>
     2
     3        REGRESSION(r120616): Cell's logical height wrongly computed with vertical-align: baseline and rowspan
     4        https://bugs.webkit.org/show_bug.cgi?id=106571
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        When a cell spans multiple rows, its baseline is set on the first row it spans. r120616 contained a
     9        couple of errors in its attempt to ensure the row height calculated in such cases was correct. When it
     10        calculated the baseline on the first row in the span, it didn't ensure that the row height was increased
     11        if necessary. It also suffered from allowing the baseline descent calculated on a rowspan to affect the
     12        height of the other cells in the first row of the span.
     13
     14        Fix both of these errors in calcRowLogicalHeight() and refactor the calculation of the baseline and baseline
     15        descent so that it is freestanding (rather than depending on the height of the section so far).
     16
     17        Tests: fast/css/vertical-align-baseline-rowspan-010.html
     18               fast/css/vertical-align-baseline-rowspan-011.html
     19
     20        * rendering/RenderTableSection.cpp:
     21        (WebCore::RenderTableSection::calcRowLogicalHeight):
     22
    1232013-01-26  James Simonsen  <simonjam@chromium.org>
    224
  • trunk/Source/WebCore/rendering/RenderTableSection.cpp

    r140244 r140907  
    319319                m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[cellStartRow] + cellLogicalHeight);
    320320
    321                 // find out the baseline
     321                // Find out the baseline. The baseline is set on the first row in a rowspan.
    322322                EVerticalAlign va = cell->style()->verticalAlign();
    323323                if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB || va == LENGTH) {
    324324                    LayoutUnit baselinePosition = cell->cellBaselinePosition();
    325325                    if (baselinePosition > cell->borderBefore() + cell->paddingBefore()) {
    326                         m_grid[cellStartRow].baseline = max(m_grid[cellStartRow].baseline, baselinePosition - cell->intrinsicPaddingBefore());
    327                         baselineDescent = max(baselineDescent, m_rowPos[cellStartRow] + cellLogicalHeight - (baselinePosition - cell->intrinsicPaddingBefore()));
     326                        m_grid[cellStartRow].baseline = max(m_grid[cellStartRow].baseline, baselinePosition);
     327                        // The descent of a cell that spans multiple rows does not affect the height of the first row it spans, so don't let it
     328                        // become the baseline descent applied to the rest of the row.
     329                        if (cell->rowSpan() == 1)
     330                            baselineDescent = max(baselineDescent, cellLogicalHeight - (baselinePosition - cell->intrinsicPaddingBefore()));
     331                        m_rowPos[cellStartRow + 1] = max<int>(m_rowPos[cellStartRow + 1], m_rowPos[cellStartRow] + m_grid[cellStartRow].baseline + baselineDescent);
    328332                    }
    329333                }
    330334            }
    331335        }
    332 
    333         // do we have baseline aligned elements?
    334         if (m_grid[r].baseline)
    335             // increase rowheight if baseline requires
    336             m_rowPos[r + 1] = max<int>(m_rowPos[r + 1], m_grid[r].baseline + baselineDescent);
    337336
    338337        // Add the border-spacing to our final position.
Note: See TracChangeset for help on using the changeset viewer.