Changeset 64225 in webkit


Ignore:
Timestamp:
Jul 28, 2010 1:07:19 PM (14 years ago)
Author:
jamesr@google.com
Message:

2010-07-28 fsamuel@chromium.org <fsamuel@chromium.org>

Reviewed by David Hyatt.

REGRESSION (r63994): Bank of America's home page is horribly mis-rendered
https://bugs.webkit.org/show_bug.cgi?id=42993

Fixed bug introduced by patch for bug 40775.

The new table rendering code did not take into account table layouts starting
during a partial construction of the table render tree. As such,
multiple layouts on the same table resulted in more columns being generated.
This patch solves this issue.

  • rendering/AutoTableLayout.cpp: (WebCore::AutoTableLayout::recalcColumn):
  • rendering/RenderTable.cpp: (WebCore::RenderTable::cellAbove): (WebCore::RenderTable::cellBelow): (WebCore::RenderTable::cellBefore):
  • rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::ensureRows): (WebCore::RenderTableSection::addCell): (WebCore::RenderTableSection::setCellWidths): (WebCore::RenderTableSection::calcRowHeight): (WebCore::RenderTableSection::layoutRows): (WebCore::RenderTableSection::paintObject): (WebCore::RenderTableSection::appendColumn): (WebCore::RenderTableSection::splitColumn):
  • rendering/RenderTableSection.h: (WebCore::RenderTableSection::CellStruct::CellStruct):

2010-07-28 fsamuel@chromium.org <fsamuel@chromium.org>

Reviewed by David Hyatt.

REGRESSION (r63994): Bank of America's home page is horribly mis-rendered
https://bugs.webkit.org/show_bug.cgi?id=42993

Restored the expectation for the slashdot logo table test.

Added a new layout test to check for the correctness of early table layout.

  • fast/table/early-table-layout.html: Added.
  • platform/chromium/test_expectations.txt:
  • platform/gtk/fast/table/early-table-layout-expected.checksum: Added.
  • platform/gtk/fast/table/early-table-layout-expected.png: Added.
  • platform/gtk/fast/table/early-table-layout-expected.txt: Added.
Location:
trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r64218 r64225  
     12010-07-28  fsamuel@chromium.org  <fsamuel@chromium.org>
     2
     3        Reviewed by David Hyatt.
     4
     5        REGRESSION (r63994): Bank of America's home page is horribly mis-rendered
     6        https://bugs.webkit.org/show_bug.cgi?id=42993
     7
     8        Restored the expectation for the slashdot logo table test.
     9
     10        Added a new layout test to check for the correctness of early table layout.
     11
     12        * fast/table/early-table-layout.html: Added.
     13        * platform/chromium/test_expectations.txt:
     14        * platform/gtk/fast/table/early-table-layout-expected.checksum: Added.
     15        * platform/gtk/fast/table/early-table-layout-expected.png: Added.
     16        * platform/gtk/fast/table/early-table-layout-expected.txt: Added.
     17
    1182010-07-28  Victor Wang  <victorw@chromium.org>
    219
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r64218 r64225  
    6767BUG24182 SLOW : http/tests/xmlhttprequest/simple-cross-origin-progress-events.html = PASS
    6868BUG24182 SLOW WIN MAC : svg/custom/invisible-text-after-scrolling.xhtml = PASS
     69BUG24182 SLOW : tables/mozilla/other/slashlogo.html = PASS
    6970BUG24182 SLOW WIN RELEASE : tables/mozilla/bugs/bug113235-1.html = PASS
    7071BUG24182 SLOW DEBUG : fast/js/toString-and-valueOf-override.html = PASS
  • trunk/WebCore/ChangeLog

    r64213 r64225  
     12010-07-28  fsamuel@chromium.org  <fsamuel@chromium.org>
     2
     3        Reviewed by David Hyatt.
     4
     5        REGRESSION (r63994): Bank of America's home page is horribly mis-rendered
     6        https://bugs.webkit.org/show_bug.cgi?id=42993
     7
     8        Fixed bug introduced by patch for bug 40775.
     9
     10        The new table rendering code did not take into account table layouts starting
     11        during a partial construction of the table render tree. As such,
     12        multiple layouts on the same table resulted in more columns being generated.
     13        This patch solves this issue.
     14
     15        * rendering/AutoTableLayout.cpp:
     16        (WebCore::AutoTableLayout::recalcColumn):
     17        * rendering/RenderTable.cpp:
     18        (WebCore::RenderTable::cellAbove):
     19        (WebCore::RenderTable::cellBelow):
     20        (WebCore::RenderTable::cellBefore):
     21        * rendering/RenderTableSection.cpp:
     22        (WebCore::RenderTableSection::ensureRows):
     23        (WebCore::RenderTableSection::addCell):
     24        (WebCore::RenderTableSection::setCellWidths):
     25        (WebCore::RenderTableSection::calcRowHeight):
     26        (WebCore::RenderTableSection::layoutRows):
     27        (WebCore::RenderTableSection::paintObject):
     28        (WebCore::RenderTableSection::appendColumn):
     29        (WebCore::RenderTableSection::splitColumn):
     30        * rendering/RenderTableSection.h:
     31        (WebCore::RenderTableSection::CellStruct::CellStruct):
     32
    1332010-07-28  Tony Gentilcore  <tonyg@chromium.org>
    234
  • trunk/WebCore/rendering/AutoTableLayout.cpp

    r63994 r64225  
    126126                    }
    127127                } else {
    128                     if (cell && (!effCol || cell->section()->primaryCellAt(i, effCol-1) != cell)) {
     128                    if (cell && (!effCol || section->primaryCellAt(i, effCol-1) != cell)) {
    129129                        // This spanning cell originates in this column.  Ensure we have
    130130                        // a min/max width of at least 1px for this column now.
  • trunk/WebCore/rendering/RenderTable.cpp

    r63994 r64225  
    10201020    if (section) {
    10211021        int effCol = colToEffCol(cell->col());
    1022         RenderTableSection::CellStruct aboveCell;
    1023         // If we hit a span back up to a real cell.
    1024         do {
    1025             aboveCell = section->cellAt(rAbove, effCol);
    1026             effCol--;
    1027         } while (!aboveCell.hasCells() && aboveCell.inColSpan && effCol >= 0);
     1022        RenderTableSection::CellStruct& aboveCell = section->cellAt(rAbove, effCol);
    10281023        return aboveCell.primaryCell();
    10291024    } else
     
    10521047    if (section) {
    10531048        int effCol = colToEffCol(cell->col());
    1054         RenderTableSection::CellStruct belowCell;
    1055         // If we hit a colspan back up to a real cell.
    1056         do {
    1057             belowCell = section->cellAt(rBelow, effCol);
    1058             effCol--;
    1059         } while (!belowCell.hasCells() && belowCell.inColSpan && effCol >= 0);
     1049        RenderTableSection::CellStruct& belowCell = section->cellAt(rBelow, effCol);
    10601050        return belowCell.primaryCell();
    10611051    } else
     
    10731063   
    10741064    // If we hit a colspan back up to a real cell.
    1075     RenderTableSection::CellStruct prevCell;
    1076     do {
    1077         prevCell = section->cellAt(cell->row(), effCol - 1);
    1078         effCol--;
    1079     } while (!prevCell.hasCells() && prevCell.inColSpan && effCol >= 0);
     1065    RenderTableSection::CellStruct& prevCell = section->cellAt(cell->row(), effCol - 1);
    10801066    return prevCell.primaryCell();
    10811067}
  • trunk/WebCore/rendering/RenderTableSection.cpp

    r63994 r64225  
    162162        m_gridRows = numRows;
    163163        int nCols = max(1, table()->numEffCols());
    164         CellStruct emptyCellStruct;
    165         emptyCellStruct.inColSpan = false;
    166         emptyCellStruct.empty = false;
    167164        for (int r = nRows; r < numRows; r++) {
    168165            m_grid[r].row = new Row(nCols);
    169             m_grid[r].row->fill(emptyCellStruct);
    170166            m_grid[r].rowRenderer = 0;
    171167            m_grid[r].baseline = 0;
     
    192188    while (m_cCol < nCols && (cellAt(m_cRow, m_cCol).hasCells() || cellAt(m_cRow, m_cCol).inColSpan))
    193189        m_cCol++;
     190
    194191    if (rSpan == 1) {
    195192        // we ignore height settings on rowspan cells
     
    225222    bool inColSpan = false;
    226223    while (cSpan) {
    227       int currentSpan;
    228       if (m_cCol >= nCols) {
    229           table()->appendColumn(cSpan);
    230           currentSpan = cSpan;
    231       } else {
    232           if (cSpan < (int)columns[m_cCol].span)
    233               table()->splitColumn(m_cCol, cSpan);
    234           currentSpan = columns[m_cCol].span;
    235       }
    236       for (int r = 0; r < rSpan; r++) {
    237           CellStruct& c = cellAt(m_cRow + r, m_cCol);
    238           ASSERT(cell);
    239           c.cells.append(cell);
    240           // If cells overlap then we take the slow path for painting.
    241           if (c.cells.size() > 1)
    242               m_hasMultipleCellLevels = true;
    243           if (inColSpan)
    244               c.inColSpan = true;
    245       }
    246       m_cCol++;
    247       cSpan -= currentSpan;
    248       inColSpan = true;
     224        int currentSpan;
     225        if (m_cCol >= nCols) {
     226            table()->appendColumn(cSpan);
     227            currentSpan = cSpan;
     228        } else {
     229            if (cSpan < (int)columns[m_cCol].span)
     230                table()->splitColumn(m_cCol, cSpan);
     231            currentSpan = columns[m_cCol].span;
     232        }
     233        for (int r = 0; r < rSpan; r++) {
     234            CellStruct& c = cellAt(m_cRow + r, m_cCol);
     235            ASSERT(cell);
     236            c.cells.append(cell);
     237            // If cells overlap then we take the slow path for painting.
     238            if (c.cells.size() > 1)
     239                m_hasMultipleCellLevels = true;
     240            if (inColSpan)
     241                c.inColSpan = true;
     242        }
     243        m_cCol++;
     244        cSpan -= currentSpan;
     245        inColSpan = true;
    249246    }
    250247    cell->setRow(m_cRow);
     
    261258        Row& row = *m_grid[i].row;
    262259        int cols = row.size();
    263         RenderTableCell* lastCell = 0;
    264260        for (int j = 0; j < cols; j++) {
    265261            CellStruct& current = row[j];
    266262            RenderTableCell* cell = current.primaryCell();
    267             if (!cell) {
    268               ASSERT(lastCell || !current.inColSpan);
    269               if (lastCell)
    270                 current.cells.append(lastCell);
    271               if (!current.inColSpan)
    272                 current.empty = true;
     263            if (!cell || current.inColSpan)
    273264              continue;
    274             }
    275             if (current.inColSpan || current.empty)
    276               continue;
    277             lastCell = cell;
    278265            int endCol = j;
    279266            int cspan = cell->colSpan();
     
    336323            CellStruct& current = cellAt(r, c);
    337324            cell = current.primaryCell();
    338             ASSERT(cell || current.empty);
    339             if (!cell || current.empty || current.inColSpan)
     325
     326            if (!cell || current.inColSpan)
    340327                continue;
    341328
     
    512499            RenderTableCell* cell = cs.primaryCell();
    513500
    514             if (!cell || cs.empty || cs.inColSpan)
     501            if (!cell || cs.inColSpan)
    515502                continue;
    516503
     
    652639            CellStruct& cs = cellAt(r, c);
    653640            RenderTableCell* cell = cs.primaryCell();
    654             if (!cell || cs.empty || cs.inColSpan)
     641            if (!cell || cs.inColSpan)
    655642                continue;
    656643            if (r < totalRows - 1 && cell == primaryCellAt(r + 1, c))
     
    10651052                    CellStruct& current = cellAt(r, c);
    10661053                    RenderTableCell* cell = current.primaryCell();
    1067                     if (current.empty || (r > startrow && primaryCellAt(r - 1, c) == cell) || (c > startcol && primaryCellAt(r, c - 1) == cell))
     1054                    if (!cell || (r > startrow && primaryCellAt(r - 1, c) == cell) || (c > startcol && primaryCellAt(r, c - 1) == cell))
    10681055                        continue;
    10691056                    paintCell(cell, paintInfo, tx, ty);
     
    10771064                for (unsigned c = startcol; c < endcol; c++) {
    10781065                    CellStruct& current = cellAt(r, c);
    1079                     if (current.empty)
     1066                    if (!current.hasCells())
    10801067                        continue;
    10811068                    for (unsigned i = 0; i < current.cells.size(); ++i) {
     
    11571144void RenderTableSection::appendColumn(int pos)
    11581145{
    1159     for (int row = 0; row < m_gridRows; ++row) {
     1146    for (int row = 0; row < m_gridRows; ++row)
    11601147        m_grid[row].row->resize(pos + 1);
    1161         CellStruct& c = cellAt(row, pos);
    1162         c.inColSpan = false;
    1163         c.empty = false;
    1164     }
    11651148}
    11661149
     
    11841167            r[pos + 1].inColSpan = 0;
    11851168        }
    1186         r[pos + 1].empty = false;
    11871169    }
    11881170}
  • trunk/WebCore/rendering/RenderTableSection.h

    r63994 r64225  
    5757        Vector<RenderTableCell*, 1> cells;
    5858        bool inColSpan; // true for columns after the first in a colspan
    59         bool empty;
    6059
    6160        CellStruct():
    62           inColSpan(false),
    63           empty(false) {}
    64 
    65         CellStruct(const CellStruct& other):
    66             cells(other.cells),
    67             inColSpan(other.inColSpan),
    68             empty(other.empty) {}
     61          inColSpan(false) {}
    6962       
    7063        RenderTableCell* primaryCell()
Note: See TracChangeset for help on using the changeset viewer.