Changeset 122408 in webkit


Ignore:
Timestamp:
Jul 11, 2012 7:38:38 PM (12 years ago)
Author:
mitz@apple.com
Message:

When a table row height grows because of pagination, not all cells’ heights are adjusted
https://bugs.webkit.org/show_bug.cgi?id=91043

Reviewed by Sam Weinig.

Source/WebCore:

The fix for in bug <http://webkit.org/b/83595> in <http://trac.webkit.org/r113738> made table
rows grow as necessary to fit cells that grow as a result of pagination. But it had two bad
side effects: earlier cells on the row would not grow by the same amount, and later cells on
the row would factor the existing growth into their intrinsic padding.

Test: fast/multicol/table-row-height-increase.html

  • rendering/RenderTableSection.cpp:

(WebCore::RenderTableSection::layoutRows): Now when a cell becomes taller than the row height,
the additional height needed is recorded, and the cell is shrunk back to row height. Then
after finishing the row, all cells occurring on the row (including cells spanning it but not
starting on it) are grown by the same amount.

LayoutTests:

  • fast/multicol/table-row-height-increase-expected.html: Added.
  • fast/multicol/table-row-height-increase.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r122406 r122408  
     12012-07-11  Dan Bernstein  <mitz@apple.com>
     2
     3        When a table row height grows because of pagination, not all cells’ heights are adjusted
     4        https://bugs.webkit.org/show_bug.cgi?id=91043
     5
     6        Reviewed by Sam Weinig.
     7
     8        * fast/multicol/table-row-height-increase-expected.html: Added.
     9        * fast/multicol/table-row-height-increase.html: Added.
     10
    1112012-07-11  Ojan Vafai  <ojan@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r122404 r122408  
     12012-07-11  Dan Bernstein  <mitz@apple.com>
     2
     3        When a table row height grows because of pagination, not all cells’ heights are adjusted
     4        https://bugs.webkit.org/show_bug.cgi?id=91043
     5
     6        Reviewed by Sam Weinig.
     7
     8        The fix for in bug <http://webkit.org/b/83595> in <http://trac.webkit.org/r113738> made table
     9        rows grow as necessary to fit cells that grow as a result of pagination. But it had two bad
     10        side effects: earlier cells on the row would not grow by the same amount, and later cells on
     11        the row would factor the existing growth into their intrinsic padding.
     12
     13        Test: fast/multicol/table-row-height-increase.html
     14
     15        * rendering/RenderTableSection.cpp:
     16        (WebCore::RenderTableSection::layoutRows): Now when a cell becomes taller than the row height,
     17        the additional height needed is recorded, and the cell is shrunk back to row height. Then
     18        after finishing the row, all cells occurring on the row (including cells spanning it but not
     19        starting on it) are grown by the same amount.
     20
    1212012-07-11  Mark Rowe  <mrowe@apple.com>
    222
  • trunk/Source/WebCore/rendering/RenderTableSection.cpp

    r121096 r122408  
    548548        }
    549549
     550        int rowHeightIncreaseForPagination = 0;
     551
    550552        for (unsigned c = 0; c < nEffCols; c++) {
    551553            CellStruct& cs = cellAt(r, c);
     
    672674                // We'll also do a basic increase of the row height to accommodate the cell if it's bigger, but this isn't quite right
    673675                // either. It's at least stable though and won't result in an infinite # of relayouts that may never stabilize.
    674                 if (cell->logicalHeight() > rHeight) {
    675                     unsigned delta = cell->logicalHeight() - rHeight;
    676                     for (unsigned rowIndex = rindx + cell->rowSpan(); rowIndex <= totalRows; rowIndex++)
    677                         m_rowPos[rowIndex] += delta;
    678                     rHeight = cell->logicalHeight();
    679                 } else
    680                     cell->setLogicalHeight(rHeight);
     676                if (cell->logicalHeight() > rHeight)
     677                    rowHeightIncreaseForPagination = max<int>(rowHeightIncreaseForPagination, cell->logicalHeight() - rHeight);
     678                cell->setLogicalHeight(rHeight);
    681679            }
    682680
     
    690688                if (!table()->selfNeedsLayout() && cell->checkForRepaintDuringLayout())
    691689                    cell->repaintDuringLayoutIfMoved(oldCellRect);
     690            }
     691        }
     692        if (rowHeightIncreaseForPagination) {
     693            for (unsigned rowIndex = r + 1; rowIndex <= totalRows; rowIndex++)
     694                m_rowPos[rowIndex] += rowHeightIncreaseForPagination;
     695            for (unsigned c = 0; c < nEffCols; ++c) {
     696                Vector<RenderTableCell*, 1>& cells = cellAt(r, c).cells;
     697                for (size_t i = 0; i < cells.size(); ++i)
     698                    cells[i]->setLogicalHeight(cells[i]->logicalHeight() + rowHeightIncreaseForPagination);
    692699            }
    693700        }
Note: See TracChangeset for help on using the changeset viewer.