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, 2013 Apple Inc. All r
ights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. All r
ights 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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 #endif | 936 #endif |
937 | 937 |
938 ASSERT(!needsLayout()); | 938 ASSERT(!needsLayout()); |
939 | 939 |
940 // FIXME: Changing the height without a layout can change the overflow so it
seems wrong. | 940 // FIXME: Changing the height without a layout can change the overflow so it
seems wrong. |
941 | 941 |
942 unsigned totalRows = m_grid.size(); | 942 unsigned totalRows = m_grid.size(); |
943 | 943 |
944 // Set the width of our section now. The rows will also be this width. | 944 // Set the width of our section now. The rows will also be this width. |
945 setLogicalWidth(table()->contentLogicalWidth()); | 945 setLogicalWidth(table()->contentLogicalWidth()); |
946 m_overflow.clear(); | |
947 m_overflowingCells.clear(); | |
948 m_forceSlowPaintPathWithOverflowingCell = false; | |
949 | 946 |
950 int vspacing = table()->vBorderSpacing(); | 947 int vspacing = table()->vBorderSpacing(); |
951 unsigned nEffCols = table()->numEffCols(); | 948 unsigned nEffCols = table()->numEffCols(); |
952 | 949 |
953 LayoutState state(*this, locationOffset()); | 950 LayoutState state(*this, locationOffset()); |
954 | 951 |
955 for (unsigned r = 0; r < totalRows; r++) { | 952 for (unsigned r = 0; r < totalRows; r++) { |
956 // Set the row's x/y position and width/height. | 953 // Set the row's x/y position and width/height. |
957 RenderTableRow* rowRenderer = m_grid[r].rowRenderer; | 954 RenderTableRow* rowRenderer = m_grid[r].rowRenderer; |
958 if (rowRenderer) { | 955 if (rowRenderer) { |
959 rowRenderer->setLocation(LayoutPoint(0, m_rowPos[r])); | 956 rowRenderer->setLocation(LayoutPoint(0, m_rowPos[r])); |
960 rowRenderer->setLogicalWidth(logicalWidth()); | 957 rowRenderer->setLogicalWidth(logicalWidth()); |
961 rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspaci
ng); | 958 rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspaci
ng); |
962 rowRenderer->updateLayerTransformAfterLayout(); | 959 rowRenderer->updateLayerTransformAfterLayout(); |
963 rowRenderer->clearAllOverflows(); | |
964 rowRenderer->addVisualEffectOverflow(); | |
965 } | 960 } |
966 | 961 |
967 int rowHeightIncreaseForPagination = 0; | 962 int rowHeightIncreaseForPagination = 0; |
968 | 963 |
969 for (unsigned c = 0; c < nEffCols; c++) { | 964 for (unsigned c = 0; c < nEffCols; c++) { |
970 CellStruct& cs = cellAt(r, c); | 965 CellStruct& cs = cellAt(r, c); |
971 RenderTableCell* cell = cs.primaryCell(); | 966 RenderTableCell* cell = cs.primaryCell(); |
972 | 967 |
973 if (!cell || cs.inColSpan) | 968 if (!cell || cs.inColSpan) |
974 continue; | 969 continue; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 // FIXME: Pagination might have made us change size. For now jus
t shrink or grow the cell to fit without doing a relayout. | 1041 // FIXME: Pagination might have made us change size. For now jus
t shrink or grow the cell to fit without doing a relayout. |
1047 // 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 | 1042 // 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 |
1048 // either. It's at least stable though and won't result in an in
finite # of relayouts that may never stabilize. | 1043 // either. It's at least stable though and won't result in an in
finite # of relayouts that may never stabilize. |
1049 LayoutUnit oldLogicalHeight = cell->logicalHeight(); | 1044 LayoutUnit oldLogicalHeight = cell->logicalHeight(); |
1050 if (oldLogicalHeight > rHeight) | 1045 if (oldLogicalHeight > rHeight) |
1051 rowHeightIncreaseForPagination = std::max<int>(rowHeightIncr
easeForPagination, oldLogicalHeight - rHeight); | 1046 rowHeightIncreaseForPagination = std::max<int>(rowHeightIncr
easeForPagination, oldLogicalHeight - rHeight); |
1052 cell->setLogicalHeight(rHeight); | 1047 cell->setLogicalHeight(rHeight); |
1053 cell->computeOverflow(oldLogicalHeight, false); | 1048 cell->computeOverflow(oldLogicalHeight, false); |
1054 } | 1049 } |
1055 | 1050 |
1056 if (rowRenderer) | |
1057 rowRenderer->addOverflowFromCell(cell); | |
1058 | |
1059 LayoutSize childOffset(cell->location() - oldCellRect.location()); | 1051 LayoutSize childOffset(cell->location() - oldCellRect.location()); |
1060 if (childOffset.width() || childOffset.height()) { | 1052 if (childOffset.width() || childOffset.height()) { |
1061 // If the child moved, we have to issue paint invalidations to i
t as well as any floating/positioned | 1053 // If the child moved, we have to issue paint invalidations to i
t as well as any floating/positioned |
1062 // descendants. An exception is if we need a layout. In this cas
e, we know we're going to | 1054 // descendants. An exception is if we need a layout. In this cas
e, we know we're going to |
1063 // issue paint invalidations ourselves (and the child) anyway. | 1055 // issue paint invalidations ourselves (and the child) anyway. |
1064 if (!table()->selfNeedsLayout()) | 1056 if (!table()->selfNeedsLayout()) |
1065 cell->setMayNeedPaintInvalidation(true); | 1057 cell->setMayNeedPaintInvalidation(true); |
1066 } | 1058 } |
1067 } | 1059 } |
1068 if (rowHeightIncreaseForPagination) { | 1060 if (rowHeightIncreaseForPagination) { |
1069 for (unsigned rowIndex = r + 1; rowIndex <= totalRows; rowIndex++) | 1061 for (unsigned rowIndex = r + 1; rowIndex <= totalRows; rowIndex++) |
1070 m_rowPos[rowIndex] += rowHeightIncreaseForPagination; | 1062 m_rowPos[rowIndex] += rowHeightIncreaseForPagination; |
1071 for (unsigned c = 0; c < nEffCols; ++c) { | 1063 for (unsigned c = 0; c < nEffCols; ++c) { |
1072 WillBeHeapVector<RawPtrWillBeMember<RenderTableCell>, 1>& cells
= cellAt(r, c).cells; | 1064 WillBeHeapVector<RawPtrWillBeMember<RenderTableCell>, 1>& cells
= cellAt(r, c).cells; |
1073 for (size_t i = 0; i < cells.size(); ++i) { | 1065 for (size_t i = 0; i < cells.size(); ++i) { |
1074 LayoutUnit oldLogicalHeight = cells[i]->logicalHeight(); | 1066 LayoutUnit oldLogicalHeight = cells[i]->logicalHeight(); |
1075 cells[i]->setLogicalHeight(oldLogicalHeight + rowHeightIncre
aseForPagination); | 1067 cells[i]->setLogicalHeight(oldLogicalHeight + rowHeightIncre
aseForPagination); |
1076 cells[i]->computeOverflow(oldLogicalHeight, false); | 1068 cells[i]->computeOverflow(oldLogicalHeight, false); |
1077 } | 1069 } |
1078 } | 1070 } |
1079 } | 1071 } |
| 1072 |
| 1073 if (rowRenderer) |
| 1074 rowRenderer->recomputeOverflow(); |
1080 } | 1075 } |
1081 | 1076 |
1082 ASSERT(!needsLayout()); | 1077 ASSERT(!needsLayout()); |
1083 | 1078 |
1084 setLogicalHeight(m_rowPos[totalRows]); | 1079 setLogicalHeight(m_rowPos[totalRows]); |
1085 | 1080 |
1086 computeOverflowFromCells(totalRows, nEffCols); | 1081 computeOverflowFromCells(totalRows, nEffCols); |
1087 } | 1082 } |
1088 | 1083 |
1089 void RenderTableSection::computeOverflowFromCells() | 1084 void RenderTableSection::computeOverflowFromCells() |
1090 { | 1085 { |
1091 unsigned totalRows = m_grid.size(); | 1086 unsigned totalRows = m_grid.size(); |
1092 unsigned nEffCols = table()->numEffCols(); | 1087 unsigned nEffCols = table()->numEffCols(); |
1093 computeOverflowFromCells(totalRows, nEffCols); | 1088 computeOverflowFromCells(totalRows, nEffCols); |
1094 } | 1089 } |
1095 | 1090 |
1096 void RenderTableSection::computeOverflowFromCells(unsigned totalRows, unsigned n
EffCols) | 1091 void RenderTableSection::computeOverflowFromCells(unsigned totalRows, unsigned n
EffCols) |
1097 { | 1092 { |
1098 unsigned totalCellsCount = nEffCols * totalRows; | 1093 unsigned totalCellsCount = nEffCols * totalRows; |
1099 unsigned maxAllowedOverflowingCellsCount = totalCellsCount < gMinTableSizeTo
UseFastPaintPathWithOverflowingCell ? 0 : gMaxAllowedOverflowingCellRatioForFast
PaintPath * totalCellsCount; | 1094 unsigned maxAllowedOverflowingCellsCount = totalCellsCount < gMinTableSizeTo
UseFastPaintPathWithOverflowingCell ? 0 : gMaxAllowedOverflowingCellRatioForFast
PaintPath * totalCellsCount; |
1100 | 1095 |
| 1096 m_overflow.clear(); |
| 1097 m_overflowingCells.clear(); |
| 1098 m_forceSlowPaintPathWithOverflowingCell = false; |
| 1099 |
1101 #if ENABLE(ASSERT) | 1100 #if ENABLE(ASSERT) |
1102 bool hasOverflowingCell = false; | 1101 bool hasOverflowingCell = false; |
1103 #endif | 1102 #endif |
1104 // Now that our height has been determined, add in overflow from cells. | 1103 // Now that our height has been determined, add in overflow from cells. |
1105 for (unsigned r = 0; r < totalRows; r++) { | 1104 for (unsigned r = 0; r < totalRows; r++) { |
1106 for (unsigned c = 0; c < nEffCols; c++) { | 1105 for (unsigned c = 0; c < nEffCols; c++) { |
1107 CellStruct& cs = cellAt(r, c); | 1106 CellStruct& cs = cellAt(r, c); |
1108 RenderTableCell* cell = cs.primaryCell(); | 1107 RenderTableCell* cell = cs.primaryCell(); |
1109 if (!cell || cs.inColSpan) | 1108 if (!cell || cs.inColSpan) |
1110 continue; | 1109 continue; |
(...skipping 11 matching lines...) Expand all Loading... |
1122 // The slow path does not make any use of the overflowing ce
lls info, don't hold on to the memory. | 1121 // The slow path does not make any use of the overflowing ce
lls info, don't hold on to the memory. |
1123 m_overflowingCells.clear(); | 1122 m_overflowingCells.clear(); |
1124 } | 1123 } |
1125 } | 1124 } |
1126 } | 1125 } |
1127 } | 1126 } |
1128 | 1127 |
1129 ASSERT(hasOverflowingCell == this->hasOverflowingCell()); | 1128 ASSERT(hasOverflowingCell == this->hasOverflowingCell()); |
1130 } | 1129 } |
1131 | 1130 |
| 1131 bool RenderTableSection::recalcChildOverflowAfterStyleChange() |
| 1132 { |
| 1133 ASSERT(childNeedsOverflowRecalcAfterStyleChange()); |
| 1134 clearChildNeedsOverflowRecalcAfterStyleChange(); |
| 1135 |
| 1136 unsigned totalRows = m_grid.size(); |
| 1137 unsigned numEffCols = table()->numEffCols(); |
| 1138 bool childrenOverflowChanged = false; |
| 1139 |
| 1140 for (unsigned r = 0; r < totalRows; r++) { |
| 1141 RenderTableRow* rowRenderer = rowRendererAt(r); |
| 1142 if (!rowRenderer || !rowRenderer->childNeedsOverflowRecalcAfterStyleChan
ge()) |
| 1143 continue; |
| 1144 |
| 1145 rowRenderer->clearChildNeedsOverflowRecalcAfterStyleChange(); |
| 1146 |
| 1147 bool rowChildrenOverflowChanged = false; |
| 1148 for (unsigned c = 0; c < numEffCols; c++) { |
| 1149 CellStruct& cs = cellAt(r, c); |
| 1150 RenderTableCell* cell = cs.primaryCell(); |
| 1151 if (!cell || cs.inColSpan || !cell->needsOverflowRecalcAfterStyleCha
nge()) |
| 1152 continue; |
| 1153 rowChildrenOverflowChanged |= cell->recalcOverflowAfterStyleChange()
; |
| 1154 } |
| 1155 if (rowChildrenOverflowChanged) |
| 1156 rowRenderer->recomputeOverflow(); |
| 1157 childrenOverflowChanged |= rowChildrenOverflowChanged; |
| 1158 } |
| 1159 |
| 1160 if (childrenOverflowChanged) |
| 1161 computeOverflowFromCells(totalRows, numEffCols); |
| 1162 |
| 1163 return childrenOverflowChanged; |
| 1164 } |
| 1165 |
1132 int RenderTableSection::calcBlockDirectionOuterBorder(BlockBorderSide side) cons
t | 1166 int RenderTableSection::calcBlockDirectionOuterBorder(BlockBorderSide side) cons
t |
1133 { | 1167 { |
1134 unsigned totalCols = table()->numEffCols(); | 1168 unsigned totalCols = table()->numEffCols(); |
1135 if (!m_grid.size() || !totalCols) | 1169 if (!m_grid.size() || !totalCols) |
1136 return 0; | 1170 return 0; |
1137 | 1171 |
1138 unsigned borderWidth = 0; | 1172 unsigned borderWidth = 0; |
1139 | 1173 |
1140 const BorderValue& sb = side == BorderBefore ? style()->borderBefore() : sty
le()->borderAfter(); | 1174 const BorderValue& sb = side == BorderBefore ? style()->borderBefore() : sty
le()->borderAfter(); |
1141 if (sb.style() == BHIDDEN) | 1175 if (sb.style() == BHIDDEN) |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 // FIXME: The table's direction should determine our row's direction, not th
e section's (see bug 96691). | 1647 // FIXME: The table's direction should determine our row's direction, not th
e section's (see bug 96691). |
1614 if (!style()->isLeftToRightDirection()) | 1648 if (!style()->isLeftToRightDirection()) |
1615 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta
ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] +
horizontalBorderSpacing); | 1649 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta
ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] +
horizontalBorderSpacing); |
1616 else | 1650 else |
1617 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont
alBorderSpacing); | 1651 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont
alBorderSpacing); |
1618 | 1652 |
1619 cell->setLogicalLocation(cellLocation); | 1653 cell->setLogicalLocation(cellLocation); |
1620 } | 1654 } |
1621 | 1655 |
1622 } // namespace blink | 1656 } // namespace blink |
OLD | NEW |