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 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 return; | 1155 return; |
1156 | 1156 |
1157 unsigned totalRows = m_grid.size(); | 1157 unsigned totalRows = m_grid.size(); |
1158 unsigned totalCols = table()->columns().size(); | 1158 unsigned totalCols = table()->columns().size(); |
1159 | 1159 |
1160 if (!totalRows || !totalCols) | 1160 if (!totalRows || !totalCols) |
1161 return; | 1161 return; |
1162 | 1162 |
1163 LayoutPoint adjustedPaintOffset = paintOffset + location(); | 1163 LayoutPoint adjustedPaintOffset = paintOffset + location(); |
1164 | 1164 |
1165 PaintPhase phase = paintInfo.phase; | 1165 PaintPhase phase = paintInfo.getPhase(); |
1166 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset); | 1166 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset); |
1167 paintObject(paintInfo, adjustedPaintOffset); | 1167 paintObject(paintInfo, adjustedPaintOffset); |
1168 if (pushedClip) | 1168 if (pushedClip) |
1169 popContentsClip(paintInfo, phase, adjustedPaintOffset); | 1169 popContentsClip(paintInfo, phase, adjustedPaintOffset); |
1170 | 1170 |
1171 if ((phase == PaintPhaseOutline || phase == PaintPhaseSelfOutline) && style(
)->visibility() == VISIBLE) | 1171 if ((phase == PaintPhaseOutline || phase == PaintPhaseSelfOutline) && style(
)->visibility() == VISIBLE) |
1172 paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, size())); | 1172 paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, size())); |
1173 } | 1173 } |
1174 | 1174 |
1175 static inline bool compareCellPositions(RenderTableCell* elem1, RenderTableCell*
elem2) | 1175 static inline bool compareCellPositions(RenderTableCell* elem1, RenderTableCell*
elem2) |
1176 { | 1176 { |
1177 return elem1->rowIndex() < elem2->rowIndex(); | 1177 return elem1->rowIndex() < elem2->rowIndex(); |
1178 } | 1178 } |
1179 | 1179 |
1180 // This comparison is used only when we have overflowing cells as we have an uns
orted array to sort. We thus need | 1180 // This comparison is used only when we have overflowing cells as we have an uns
orted array to sort. We thus need |
1181 // to sort both on rows and columns to properly repaint. | 1181 // to sort both on rows and columns to properly repaint. |
1182 static inline bool compareCellPositionsWithOverflowingCells(RenderTableCell* ele
m1, RenderTableCell* elem2) | 1182 static inline bool compareCellPositionsWithOverflowingCells(RenderTableCell* ele
m1, RenderTableCell* elem2) |
1183 { | 1183 { |
1184 if (elem1->rowIndex() != elem2->rowIndex()) | 1184 if (elem1->rowIndex() != elem2->rowIndex()) |
1185 return elem1->rowIndex() < elem2->rowIndex(); | 1185 return elem1->rowIndex() < elem2->rowIndex(); |
1186 | 1186 |
1187 return elem1->col() < elem2->col(); | 1187 return elem1->col() < elem2->col(); |
1188 } | 1188 } |
1189 | 1189 |
1190 void RenderTableSection::paintCell(RenderTableCell* cell, PaintInfo& paintInfo,
const LayoutPoint& paintOffset) | 1190 void RenderTableSection::paintCell(RenderTableCell* cell, PaintInfo& paintInfo,
const LayoutPoint& paintOffset) |
1191 { | 1191 { |
1192 LayoutPoint cellPoint = flipForWritingModeForChild(cell, paintOffset); | 1192 LayoutPoint cellPoint = flipForWritingModeForChild(cell, paintOffset); |
1193 PaintPhase paintPhase = paintInfo.phase; | 1193 PaintPhase paintPhase = paintInfo.getPhase(); |
1194 RenderTableRow* row = toRenderTableRow(cell->parent()); | 1194 RenderTableRow* row = toRenderTableRow(cell->parent()); |
1195 | 1195 |
1196 if (paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChild
BlockBackground) { | 1196 if (paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChild
BlockBackground) { |
1197 // We need to handle painting a stack of backgrounds. This stack (from
bottom to top) consists of | 1197 // We need to handle painting a stack of backgrounds. This stack (from
bottom to top) consists of |
1198 // the column group, column, row group, row, and then the cell. | 1198 // the column group, column, row group, row, and then the cell. |
1199 RenderTableCol* column = table()->colElement(cell->col()); | 1199 RenderTableCol* column = table()->colElement(cell->col()); |
1200 RenderTableCol* columnGroup = column ? column->enclosingColumnGroup() :
0; | 1200 RenderTableCol* columnGroup = column ? column->enclosingColumnGroup() :
0; |
1201 | 1201 |
1202 // Column groups and columns first. | 1202 // Column groups and columns first. |
1203 // FIXME: Columns and column groups do not currently support opacity, an
d they are being painted "too late" in | 1203 // 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... |
1319 if (endColumn == columnPos.size()) | 1319 if (endColumn == columnPos.size()) |
1320 endColumn = columnPos.size() - 1; | 1320 endColumn = columnPos.size() - 1; |
1321 } | 1321 } |
1322 | 1322 |
1323 return CellSpan(startColumn, endColumn); | 1323 return CellSpan(startColumn, endColumn); |
1324 } | 1324 } |
1325 | 1325 |
1326 | 1326 |
1327 void RenderTableSection::paintObject(PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) | 1327 void RenderTableSection::paintObject(PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) |
1328 { | 1328 { |
1329 PaintPhase paintPhase = paintInfo.phase; | 1329 PaintPhase paintPhase = paintInfo.getPhase(); |
1330 | 1330 |
1331 LayoutRect localRepaintRect = paintInfo.rect; | 1331 LayoutRect localRepaintRect = paintInfo.getRect(); |
1332 localRepaintRect.moveBy(-paintOffset); | 1332 localRepaintRect.moveBy(-paintOffset); |
1333 localRepaintRect.inflate(maximalOutlineSize(paintPhase)); | 1333 localRepaintRect.inflate(maximalOutlineSize(paintPhase)); |
1334 | 1334 |
1335 LayoutRect tableAlignedRect = logicalRectForWritingModeAndDirection(localRep
aintRect); | 1335 LayoutRect tableAlignedRect = logicalRectForWritingModeAndDirection(localRep
aintRect); |
1336 | 1336 |
1337 CellSpan dirtiedRows = this->dirtiedRows(tableAlignedRect); | 1337 CellSpan dirtiedRows = this->dirtiedRows(tableAlignedRect); |
1338 CellSpan dirtiedColumns = this->dirtiedColumns(tableAlignedRect); | 1338 CellSpan dirtiedColumns = this->dirtiedColumns(tableAlignedRect); |
1339 | 1339 |
1340 if (dirtiedColumns.start() < dirtiedColumns.end()) { | 1340 if (dirtiedColumns.start() < dirtiedColumns.end()) { |
1341 if (!m_hasMultipleCellLevels && !m_overflowingCells.size()) { | 1341 if (!m_hasMultipleCellLevels && !m_overflowingCells.size()) { |
1342 if (paintInfo.phase == PaintPhaseCollapsedTableBorders) { | 1342 if (paintInfo.getPhase() == PaintPhaseCollapsedTableBorders) { |
1343 // Collapsed borders are painted from the bottom right to the to
p left so that precedence | 1343 // Collapsed borders are painted from the bottom right to the to
p left so that precedence |
1344 // due to cell position is respected. | 1344 // due to cell position is respected. |
1345 for (unsigned r = dirtiedRows.end(); r > dirtiedRows.start(); r-
-) { | 1345 for (unsigned r = dirtiedRows.end(); r > dirtiedRows.start(); r-
-) { |
1346 unsigned row = r - 1; | 1346 unsigned row = r - 1; |
1347 for (unsigned c = dirtiedColumns.end(); c > dirtiedColumns.s
tart(); c--) { | 1347 for (unsigned c = dirtiedColumns.end(); c > dirtiedColumns.s
tart(); c--) { |
1348 unsigned col = c - 1; | 1348 unsigned col = c - 1; |
1349 CellStruct& current = cellAt(row, col); | 1349 CellStruct& current = cellAt(row, col); |
1350 RenderTableCell* cell = current.primaryCell(); | 1350 RenderTableCell* cell = current.primaryCell(); |
1351 if (!cell || (row > dirtiedRows.start() && primaryCellAt
(row - 1, col) == cell) || (col > dirtiedColumns.start() && primaryCellAt(row, c
ol - 1) == cell)) | 1351 if (!cell || (row > dirtiedRows.start() && primaryCellAt
(row - 1, col) == cell) || (col > dirtiedColumns.start() && primaryCellAt(row, c
ol - 1) == cell)) |
1352 continue; | 1352 continue; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 } | 1404 } |
1405 } | 1405 } |
1406 } | 1406 } |
1407 | 1407 |
1408 // Sort the dirty cells by paint order. | 1408 // Sort the dirty cells by paint order. |
1409 if (!m_overflowingCells.size()) | 1409 if (!m_overflowingCells.size()) |
1410 std::stable_sort(cells.begin(), cells.end(), compareCellPosition
s); | 1410 std::stable_sort(cells.begin(), cells.end(), compareCellPosition
s); |
1411 else | 1411 else |
1412 std::sort(cells.begin(), cells.end(), compareCellPositionsWithOv
erflowingCells); | 1412 std::sort(cells.begin(), cells.end(), compareCellPositionsWithOv
erflowingCells); |
1413 | 1413 |
1414 if (paintInfo.phase == PaintPhaseCollapsedTableBorders) { | 1414 if (paintInfo.getPhase() == PaintPhaseCollapsedTableBorders) { |
1415 for (unsigned i = cells.size(); i > 0; --i) { | 1415 for (unsigned i = cells.size(); i > 0; --i) { |
1416 LayoutPoint cellPoint = flipForWritingModeForChild(cells[i -
1], paintOffset); | 1416 LayoutPoint cellPoint = flipForWritingModeForChild(cells[i -
1], paintOffset); |
1417 cells[i - 1]->paintCollapsedBorders(paintInfo, cellPoint); | 1417 cells[i - 1]->paintCollapsedBorders(paintInfo, cellPoint); |
1418 } | 1418 } |
1419 } else { | 1419 } else { |
1420 for (unsigned i = 0; i < cells.size(); ++i) | 1420 for (unsigned i = 0; i < cells.size(); ++i) |
1421 paintCell(cells[i], paintInfo, paintOffset); | 1421 paintCell(cells[i], paintInfo, paintOffset); |
1422 } | 1422 } |
1423 } | 1423 } |
1424 } | 1424 } |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1674 if (!style()->isLeftToRightDirection()) | 1674 if (!style()->isLeftToRightDirection()) |
1675 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta
ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] +
horizontalBorderSpacing); | 1675 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta
ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] +
horizontalBorderSpacing); |
1676 else | 1676 else |
1677 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont
alBorderSpacing); | 1677 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont
alBorderSpacing); |
1678 | 1678 |
1679 cell->setLogicalLocation(cellLocation); | 1679 cell->setLogicalLocation(cellLocation); |
1680 view()->addLayoutDelta(oldCellLocation - cell->location()); | 1680 view()->addLayoutDelta(oldCellLocation - cell->location()); |
1681 } | 1681 } |
1682 | 1682 |
1683 } // namespace WebCore | 1683 } // namespace WebCore |
OLD | NEW |