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 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 return; | 1133 return; |
1134 | 1134 |
1135 unsigned totalRows = m_grid.size(); | 1135 unsigned totalRows = m_grid.size(); |
1136 unsigned totalCols = table()->columns().size(); | 1136 unsigned totalCols = table()->columns().size(); |
1137 | 1137 |
1138 if (!totalRows || !totalCols) | 1138 if (!totalRows || !totalCols) |
1139 return; | 1139 return; |
1140 | 1140 |
1141 LayoutPoint adjustedPaintOffset = paintOffset + location(); | 1141 LayoutPoint adjustedPaintOffset = paintOffset + location(); |
1142 | 1142 |
1143 PaintPhase phase = paintInfo.phase; | 1143 PaintPhase phase = paintInfo.getPhase(); |
1144 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset); | 1144 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset); |
1145 paintObject(paintInfo, adjustedPaintOffset); | 1145 paintObject(paintInfo, adjustedPaintOffset); |
1146 if (pushedClip) | 1146 if (pushedClip) |
1147 popContentsClip(paintInfo, phase, adjustedPaintOffset); | 1147 popContentsClip(paintInfo, phase, adjustedPaintOffset); |
1148 | 1148 |
1149 if ((phase == PaintPhaseOutline || phase == PaintPhaseSelfOutline) && style(
)->visibility() == VISIBLE) | 1149 if ((phase == PaintPhaseOutline || phase == PaintPhaseSelfOutline) && style(
)->visibility() == VISIBLE) |
1150 paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, size())); | 1150 paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, size())); |
1151 } | 1151 } |
1152 | 1152 |
1153 static inline bool compareCellPositions(RenderTableCell* elem1, RenderTableCell*
elem2) | 1153 static inline bool compareCellPositions(RenderTableCell* elem1, RenderTableCell*
elem2) |
1154 { | 1154 { |
1155 return elem1->rowIndex() < elem2->rowIndex(); | 1155 return elem1->rowIndex() < elem2->rowIndex(); |
1156 } | 1156 } |
1157 | 1157 |
1158 // This comparison is used only when we have overflowing cells as we have an uns
orted array to sort. We thus need | 1158 // This comparison is used only when we have overflowing cells as we have an uns
orted array to sort. We thus need |
1159 // to sort both on rows and columns to properly repaint. | 1159 // to sort both on rows and columns to properly repaint. |
1160 static inline bool compareCellPositionsWithOverflowingCells(RenderTableCell* ele
m1, RenderTableCell* elem2) | 1160 static inline bool compareCellPositionsWithOverflowingCells(RenderTableCell* ele
m1, RenderTableCell* elem2) |
1161 { | 1161 { |
1162 if (elem1->rowIndex() != elem2->rowIndex()) | 1162 if (elem1->rowIndex() != elem2->rowIndex()) |
1163 return elem1->rowIndex() < elem2->rowIndex(); | 1163 return elem1->rowIndex() < elem2->rowIndex(); |
1164 | 1164 |
1165 return elem1->col() < elem2->col(); | 1165 return elem1->col() < elem2->col(); |
1166 } | 1166 } |
1167 | 1167 |
1168 void RenderTableSection::paintCell(RenderTableCell* cell, PaintInfo& paintInfo,
const LayoutPoint& paintOffset) | 1168 void RenderTableSection::paintCell(RenderTableCell* cell, PaintInfo& paintInfo,
const LayoutPoint& paintOffset) |
1169 { | 1169 { |
1170 LayoutPoint cellPoint = flipForWritingModeForChild(cell, paintOffset); | 1170 LayoutPoint cellPoint = flipForWritingModeForChild(cell, paintOffset); |
1171 PaintPhase paintPhase = paintInfo.phase; | 1171 PaintPhase paintPhase = paintInfo.getPhase(); |
1172 RenderTableRow* row = toRenderTableRow(cell->parent()); | 1172 RenderTableRow* row = toRenderTableRow(cell->parent()); |
1173 | 1173 |
1174 if (paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChild
BlockBackground) { | 1174 if (paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChild
BlockBackground) { |
1175 // We need to handle painting a stack of backgrounds. This stack (from
bottom to top) consists of | 1175 // We need to handle painting a stack of backgrounds. This stack (from
bottom to top) consists of |
1176 // the column group, column, row group, row, and then the cell. | 1176 // the column group, column, row group, row, and then the cell. |
1177 RenderTableCol* column = table()->colElement(cell->col()); | 1177 RenderTableCol* column = table()->colElement(cell->col()); |
1178 RenderTableCol* columnGroup = column ? column->enclosingColumnGroup() :
0; | 1178 RenderTableCol* columnGroup = column ? column->enclosingColumnGroup() :
0; |
1179 | 1179 |
1180 // Column groups and columns first. | 1180 // Column groups and columns first. |
1181 // FIXME: Columns and column groups do not currently support opacity, an
d they are being painted "too late" in | 1181 // FIXME: Columns and column groups do not currently support opacity, an
d they are being painted "too late" in |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 if (endColumn == columnPos.size()) | 1297 if (endColumn == columnPos.size()) |
1298 endColumn = columnPos.size() - 1; | 1298 endColumn = columnPos.size() - 1; |
1299 } | 1299 } |
1300 | 1300 |
1301 return CellSpan(startColumn, endColumn); | 1301 return CellSpan(startColumn, endColumn); |
1302 } | 1302 } |
1303 | 1303 |
1304 | 1304 |
1305 void RenderTableSection::paintObject(PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) | 1305 void RenderTableSection::paintObject(PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) |
1306 { | 1306 { |
1307 PaintPhase paintPhase = paintInfo.phase; | 1307 PaintPhase paintPhase = paintInfo.getPhase(); |
1308 | 1308 |
1309 LayoutRect localRepaintRect = paintInfo.rect; | 1309 LayoutRect localRepaintRect = paintInfo.getRect(); |
1310 localRepaintRect.moveBy(-paintOffset); | 1310 localRepaintRect.moveBy(-paintOffset); |
1311 localRepaintRect.inflate(maximalOutlineSize(paintPhase)); | 1311 localRepaintRect.inflate(maximalOutlineSize(paintPhase)); |
1312 | 1312 |
1313 LayoutRect tableAlignedRect = logicalRectForWritingModeAndDirection(localRep
aintRect); | 1313 LayoutRect tableAlignedRect = logicalRectForWritingModeAndDirection(localRep
aintRect); |
1314 | 1314 |
1315 CellSpan dirtiedRows = this->dirtiedRows(tableAlignedRect); | 1315 CellSpan dirtiedRows = this->dirtiedRows(tableAlignedRect); |
1316 CellSpan dirtiedColumns = this->dirtiedColumns(tableAlignedRect); | 1316 CellSpan dirtiedColumns = this->dirtiedColumns(tableAlignedRect); |
1317 | 1317 |
1318 if (dirtiedColumns.start() < dirtiedColumns.end()) { | 1318 if (dirtiedColumns.start() < dirtiedColumns.end()) { |
1319 if (!m_hasMultipleCellLevels && !m_overflowingCells.size()) { | 1319 if (!m_hasMultipleCellLevels && !m_overflowingCells.size()) { |
1320 if (paintInfo.phase == PaintPhaseCollapsedTableBorders) { | 1320 if (paintInfo.getPhase() == PaintPhaseCollapsedTableBorders) { |
1321 // Collapsed borders are painted from the bottom right to the to
p left so that precedence | 1321 // Collapsed borders are painted from the bottom right to the to
p left so that precedence |
1322 // due to cell position is respected. | 1322 // due to cell position is respected. |
1323 for (unsigned r = dirtiedRows.end(); r > dirtiedRows.start(); r-
-) { | 1323 for (unsigned r = dirtiedRows.end(); r > dirtiedRows.start(); r-
-) { |
1324 unsigned row = r - 1; | 1324 unsigned row = r - 1; |
1325 for (unsigned c = dirtiedColumns.end(); c > dirtiedColumns.s
tart(); c--) { | 1325 for (unsigned c = dirtiedColumns.end(); c > dirtiedColumns.s
tart(); c--) { |
1326 unsigned col = c - 1; | 1326 unsigned col = c - 1; |
1327 CellStruct& current = cellAt(row, col); | 1327 CellStruct& current = cellAt(row, col); |
1328 RenderTableCell* cell = current.primaryCell(); | 1328 RenderTableCell* cell = current.primaryCell(); |
1329 if (!cell || (row > dirtiedRows.start() && primaryCellAt
(row - 1, col) == cell) || (col > dirtiedColumns.start() && primaryCellAt(row, c
ol - 1) == cell)) | 1329 if (!cell || (row > dirtiedRows.start() && primaryCellAt
(row - 1, col) == cell) || (col > dirtiedColumns.start() && primaryCellAt(row, c
ol - 1) == cell)) |
1330 continue; | 1330 continue; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 } | 1382 } |
1383 } | 1383 } |
1384 } | 1384 } |
1385 | 1385 |
1386 // Sort the dirty cells by paint order. | 1386 // Sort the dirty cells by paint order. |
1387 if (!m_overflowingCells.size()) | 1387 if (!m_overflowingCells.size()) |
1388 std::stable_sort(cells.begin(), cells.end(), compareCellPosition
s); | 1388 std::stable_sort(cells.begin(), cells.end(), compareCellPosition
s); |
1389 else | 1389 else |
1390 std::sort(cells.begin(), cells.end(), compareCellPositionsWithOv
erflowingCells); | 1390 std::sort(cells.begin(), cells.end(), compareCellPositionsWithOv
erflowingCells); |
1391 | 1391 |
1392 if (paintInfo.phase == PaintPhaseCollapsedTableBorders) { | 1392 if (paintInfo.getPhase() == PaintPhaseCollapsedTableBorders) { |
1393 for (unsigned i = cells.size(); i > 0; --i) { | 1393 for (unsigned i = cells.size(); i > 0; --i) { |
1394 LayoutPoint cellPoint = flipForWritingModeForChild(cells[i -
1], paintOffset); | 1394 LayoutPoint cellPoint = flipForWritingModeForChild(cells[i -
1], paintOffset); |
1395 cells[i - 1]->paintCollapsedBorders(paintInfo, cellPoint); | 1395 cells[i - 1]->paintCollapsedBorders(paintInfo, cellPoint); |
1396 } | 1396 } |
1397 } else { | 1397 } else { |
1398 for (unsigned i = 0; i < cells.size(); ++i) | 1398 for (unsigned i = 0; i < cells.size(); ++i) |
1399 paintCell(cells[i], paintInfo, paintOffset); | 1399 paintCell(cells[i], paintInfo, paintOffset); |
1400 } | 1400 } |
1401 } | 1401 } |
1402 } | 1402 } |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 if (!style()->isLeftToRightDirection()) | 1652 if (!style()->isLeftToRightDirection()) |
1653 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta
ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] +
horizontalBorderSpacing); | 1653 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta
ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] +
horizontalBorderSpacing); |
1654 else | 1654 else |
1655 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont
alBorderSpacing); | 1655 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont
alBorderSpacing); |
1656 | 1656 |
1657 cell->setLogicalLocation(cellLocation); | 1657 cell->setLogicalLocation(cellLocation); |
1658 view()->addLayoutDelta(oldCellLocation - cell->location()); | 1658 view()->addLayoutDelta(oldCellLocation - cell->location()); |
1659 } | 1659 } |
1660 | 1660 |
1661 } // namespace WebCore | 1661 } // namespace WebCore |
OLD | NEW |