| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) |
| 3 * (C) 1997 Torben Weis (weis@kde.org) | 3 * (C) 1997 Torben Weis (weis@kde.org) |
| 4 * (C) 1998 Waldo Bastian (bastian@kde.org) | 4 * (C) 1998 Waldo Bastian (bastian@kde.org) |
| 5 * (C) 1999 Lars Knoll (knoll@kde.org) | 5 * (C) 1999 Lars Knoll (knoll@kde.org) |
| 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
| 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 } | 873 } |
| 874 | 874 |
| 875 void RenderTableSection::layoutRows() | 875 void RenderTableSection::layoutRows() |
| 876 { | 876 { |
| 877 #ifndef NDEBUG | 877 #ifndef NDEBUG |
| 878 SetLayoutNeededForbiddenScope layoutForbiddenScope(this); | 878 SetLayoutNeededForbiddenScope layoutForbiddenScope(this); |
| 879 #endif | 879 #endif |
| 880 | 880 |
| 881 ASSERT(!needsLayout()); | 881 ASSERT(!needsLayout()); |
| 882 | 882 |
| 883 // FIXME: Changing the height without a layout can change the overflow so it
seems wrong. |
| 884 |
| 883 unsigned totalRows = m_grid.size(); | 885 unsigned totalRows = m_grid.size(); |
| 884 | 886 |
| 885 // Set the width of our section now. The rows will also be this width. | 887 // Set the width of our section now. The rows will also be this width. |
| 886 setLogicalWidth(table()->contentLogicalWidth()); | 888 setLogicalWidth(table()->contentLogicalWidth()); |
| 887 m_overflow.clear(); | 889 m_overflow.clear(); |
| 888 m_overflowingCells.clear(); | 890 m_overflowingCells.clear(); |
| 889 m_forceSlowPaintPathWithOverflowingCell = false; | 891 m_forceSlowPaintPathWithOverflowingCell = false; |
| 890 | 892 |
| 891 int vspacing = table()->vBorderSpacing(); | 893 int vspacing = table()->vBorderSpacing(); |
| 892 unsigned nEffCols = table()->numEffCols(); | 894 unsigned nEffCols = table()->numEffCols(); |
| 893 | 895 |
| 894 LayoutStateMaintainer statePusher(*this, locationOffset()); | 896 LayoutStateMaintainer statePusher(*this, locationOffset()); |
| 895 | 897 |
| 896 for (unsigned r = 0; r < totalRows; r++) { | 898 for (unsigned r = 0; r < totalRows; r++) { |
| 897 // Set the row's x/y position and width/height. | 899 // Set the row's x/y position and width/height. |
| 898 if (RenderTableRow* rowRenderer = m_grid[r].rowRenderer) { | 900 if (RenderTableRow* rowRenderer = m_grid[r].rowRenderer) { |
| 899 rowRenderer->setLocation(LayoutPoint(0, m_rowPos[r])); | 901 rowRenderer->setLocation(LayoutPoint(0, m_rowPos[r])); |
| 900 rowRenderer->setLogicalWidth(logicalWidth()); | 902 rowRenderer->setLogicalWidth(logicalWidth()); |
| 901 rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspaci
ng); | 903 rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspaci
ng); |
| 902 rowRenderer->updateLayerTransform(); | 904 rowRenderer->updateLayerTransform(); |
| 905 rowRenderer->clearAllOverflows(); |
| 906 rowRenderer->addVisualEffectOverflow(); |
| 903 } | 907 } |
| 904 | 908 |
| 905 int rowHeightIncreaseForPagination = 0; | 909 int rowHeightIncreaseForPagination = 0; |
| 906 | 910 |
| 907 for (unsigned c = 0; c < nEffCols; c++) { | 911 for (unsigned c = 0; c < nEffCols; c++) { |
| 908 CellStruct& cs = cellAt(r, c); | 912 CellStruct& cs = cellAt(r, c); |
| 909 RenderTableCell* cell = cs.primaryCell(); | 913 RenderTableCell* cell = cs.primaryCell(); |
| 910 | 914 |
| 911 if (!cell || cs.inColSpan) | 915 if (!cell || cs.inColSpan) |
| 912 continue; | 916 continue; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 if (!cell->needsLayout()) | 983 if (!cell->needsLayout()) |
| 980 cell->markForPaginationRelayoutIfNeeded(layouter); | 984 cell->markForPaginationRelayoutIfNeeded(layouter); |
| 981 | 985 |
| 982 cell->layoutIfNeeded(); | 986 cell->layoutIfNeeded(); |
| 983 | 987 |
| 984 // FIXME: Make pagination work with vertical tables. | 988 // FIXME: Make pagination work with vertical tables. |
| 985 if (view()->layoutState()->pageLogicalHeight() && cell->logicalHeigh
t() != rHeight) { | 989 if (view()->layoutState()->pageLogicalHeight() && cell->logicalHeigh
t() != rHeight) { |
| 986 // FIXME: Pagination might have made us change size. For now jus
t shrink or grow the cell to fit without doing a relayout. | 990 // FIXME: Pagination might have made us change size. For now jus
t shrink or grow the cell to fit without doing a relayout. |
| 987 // We'll also do a basic increase of the row height to accommoda
te the cell if it's bigger, but this isn't quite right | 991 // We'll also do a basic increase of the row height to accommoda
te the cell if it's bigger, but this isn't quite right |
| 988 // either. It's at least stable though and won't result in an in
finite # of relayouts that may never stabilize. | 992 // either. It's at least stable though and won't result in an in
finite # of relayouts that may never stabilize. |
| 989 if (cell->logicalHeight() > rHeight) | 993 LayoutUnit oldLogicalHeight = cell->logicalHeight(); |
| 990 rowHeightIncreaseForPagination = max<int>(rowHeightIncreaseF
orPagination, cell->logicalHeight() - rHeight); | 994 if (oldLogicalHeight > rHeight) |
| 995 rowHeightIncreaseForPagination = max<int>(rowHeightIncreaseF
orPagination, oldLogicalHeight - rHeight); |
| 991 cell->setLogicalHeight(rHeight); | 996 cell->setLogicalHeight(rHeight); |
| 997 cell->computeOverflow(oldLogicalHeight, false); |
| 992 } | 998 } |
| 993 | 999 |
| 994 LayoutSize childOffset(cell->location() - oldCellRect.location()); | 1000 LayoutSize childOffset(cell->location() - oldCellRect.location()); |
| 995 if (childOffset.width() || childOffset.height()) { | 1001 if (childOffset.width() || childOffset.height()) { |
| 996 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) | 1002 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) |
| 997 view()->addLayoutDelta(childOffset); | 1003 view()->addLayoutDelta(childOffset); |
| 998 | 1004 |
| 999 // If the child moved, we have to repaint it as well as any floa
ting/positioned | 1005 // If the child moved, we have to repaint it as well as any floa
ting/positioned |
| 1000 // descendants. An exception is if we need a layout. In this c
ase, we know we're going to | 1006 // descendants. An exception is if we need a layout. In this c
ase, we know we're going to |
| 1001 // repaint ourselves (and the child) anyway. | 1007 // repaint ourselves (and the child) anyway. |
| 1002 if (!table()->selfNeedsLayout() && cell->checkForRepaintDuringLa
yout()) | 1008 if (!table()->selfNeedsLayout() && cell->checkForRepaintDuringLa
yout()) |
| 1003 cell->repaintDuringLayoutIfMoved(oldCellRect); | 1009 cell->repaintDuringLayoutIfMoved(oldCellRect); |
| 1004 } | 1010 } |
| 1005 } | 1011 } |
| 1006 if (rowHeightIncreaseForPagination) { | 1012 if (rowHeightIncreaseForPagination) { |
| 1007 for (unsigned rowIndex = r + 1; rowIndex <= totalRows; rowIndex++) | 1013 for (unsigned rowIndex = r + 1; rowIndex <= totalRows; rowIndex++) |
| 1008 m_rowPos[rowIndex] += rowHeightIncreaseForPagination; | 1014 m_rowPos[rowIndex] += rowHeightIncreaseForPagination; |
| 1009 for (unsigned c = 0; c < nEffCols; ++c) { | 1015 for (unsigned c = 0; c < nEffCols; ++c) { |
| 1010 Vector<RenderTableCell*, 1>& cells = cellAt(r, c).cells; | 1016 Vector<RenderTableCell*, 1>& cells = cellAt(r, c).cells; |
| 1011 for (size_t i = 0; i < cells.size(); ++i) | 1017 for (size_t i = 0; i < cells.size(); ++i) { |
| 1012 cells[i]->setLogicalHeight(cells[i]->logicalHeight() + rowHe
ightIncreaseForPagination); | 1018 LayoutUnit oldLogicalHeight = cells[i]->logicalHeight(); |
| 1019 cells[i]->setLogicalHeight(oldLogicalHeight + rowHeightIncre
aseForPagination); |
| 1020 cells[i]->computeOverflow(oldLogicalHeight, false); |
| 1021 } |
| 1013 } | 1022 } |
| 1014 } | 1023 } |
| 1015 } | 1024 } |
| 1016 | 1025 |
| 1017 ASSERT(!needsLayout()); | 1026 ASSERT(!needsLayout()); |
| 1018 | 1027 |
| 1019 setLogicalHeight(m_rowPos[totalRows]); | 1028 setLogicalHeight(m_rowPos[totalRows]); |
| 1020 | 1029 |
| 1021 computeOverflowFromCells(totalRows, nEffCols); | 1030 computeOverflowFromCells(totalRows, nEffCols); |
| 1022 | 1031 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 if (endColumn == columnPos.size()) | 1382 if (endColumn == columnPos.size()) |
| 1374 endColumn = columnPos.size() - 1; | 1383 endColumn = columnPos.size() - 1; |
| 1375 } | 1384 } |
| 1376 | 1385 |
| 1377 return CellSpan(startColumn, endColumn); | 1386 return CellSpan(startColumn, endColumn); |
| 1378 } | 1387 } |
| 1379 | 1388 |
| 1380 | 1389 |
| 1381 void RenderTableSection::paintObject(PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) | 1390 void RenderTableSection::paintObject(PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) |
| 1382 { | 1391 { |
| 1383 PaintPhase paintPhase = paintInfo.phase; | |
| 1384 | |
| 1385 LayoutRect localRepaintRect = paintInfo.rect; | 1392 LayoutRect localRepaintRect = paintInfo.rect; |
| 1386 localRepaintRect.moveBy(-paintOffset); | 1393 localRepaintRect.moveBy(-paintOffset); |
| 1387 localRepaintRect.inflate(maximalOutlineSize(paintPhase)); | |
| 1388 | 1394 |
| 1389 LayoutRect tableAlignedRect = logicalRectForWritingModeAndDirection(localRep
aintRect); | 1395 LayoutRect tableAlignedRect = logicalRectForWritingModeAndDirection(localRep
aintRect); |
| 1390 | 1396 |
| 1391 CellSpan dirtiedRows = this->dirtiedRows(tableAlignedRect); | 1397 CellSpan dirtiedRows = this->dirtiedRows(tableAlignedRect); |
| 1392 CellSpan dirtiedColumns = this->dirtiedColumns(tableAlignedRect); | 1398 CellSpan dirtiedColumns = this->dirtiedColumns(tableAlignedRect); |
| 1393 | 1399 |
| 1394 if (dirtiedColumns.start() < dirtiedColumns.end()) { | 1400 if (dirtiedColumns.start() < dirtiedColumns.end()) { |
| 1395 if (!m_hasMultipleCellLevels && !m_overflowingCells.size()) { | 1401 if (!m_hasMultipleCellLevels && !m_overflowingCells.size()) { |
| 1396 if (paintInfo.phase == PaintPhaseCollapsedTableBorders) { | 1402 if (paintInfo.phase == PaintPhaseCollapsedTableBorders) { |
| 1397 // Collapsed borders are painted from the bottom right to the to
p left so that precedence | 1403 // Collapsed borders are painted from the bottom right to the to
p left so that precedence |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1730 else | 1736 else |
| 1731 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont
alBorderSpacing); | 1737 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont
alBorderSpacing); |
| 1732 | 1738 |
| 1733 cell->setLogicalLocation(cellLocation); | 1739 cell->setLogicalLocation(cellLocation); |
| 1734 | 1740 |
| 1735 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) | 1741 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) |
| 1736 view()->addLayoutDelta(oldCellLocation - cell->location()); | 1742 view()->addLayoutDelta(oldCellLocation - cell->location()); |
| 1737 } | 1743 } |
| 1738 | 1744 |
| 1739 } // namespace WebCore | 1745 } // namespace WebCore |
| OLD | NEW |