Changeset 100386 in webkit
- Timestamp:
- Nov 15, 2011, 6:03:54 PM (14 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r100384 r100386 1 2011-11-15 Julien Chaffraix <jchaffraix@webkit.org> 2 3 Switch table indexing to unsigned 4 https://bugs.webkit.org/show_bug.cgi?id=72083 5 6 Reviewed by Darin Adler. 7 8 No expected change in behavior. 9 10 All of the code is now using unsigned for indexing! 11 12 * rendering/FixedTableLayout.cpp: 13 (WebCore::FixedTableLayout::layout): 14 * rendering/RenderTable.cpp: 15 (WebCore::RenderTable::colElement): 16 (WebCore::RenderTable::cellAbove): 17 * rendering/RenderTableSection.cpp: 18 (WebCore::RenderTableSection::splitColumn): 19 Added some ASSERTs to make sure we don't underflow. Looking at how 20 the different variables are populated, they should not be reached. 21 22 * rendering/RenderTableCell.cpp: 23 (WebCore::RenderTableCell::colSpan): 24 (WebCore::RenderTableCell::rowSpan): 25 Those 2 functions promotes HTMLTableCellElement's int to unsigned 26 which should be fine as we make sure their are positive. Also HTML5 27 makes those 2 fields "unsigned long" which goes in the same direction. 28 29 * rendering/AutoTableLayout.cpp: 30 (WebCore::AutoTableLayout::layout): 31 * rendering/RenderTableSection.cpp: 32 (WebCore::RenderTableSection::nodeAtPoint): 33 Rewrote a couple of reverse iterating to be able to use unsigned 34 without overflowing. 35 36 * rendering/AutoTableLayout.cpp: 37 (WebCore::AutoTableLayout::recalcColumn): 38 (WebCore::AutoTableLayout::fullRecalc): 39 (WebCore::AutoTableLayout::calcEffectiveLogicalWidth): 40 (WebCore::AutoTableLayout::insertSpanCell): 41 * rendering/AutoTableLayout.h: 42 * rendering/FixedTableLayout.cpp: 43 (WebCore::FixedTableLayout::calcWidthArray): 44 * rendering/RenderTable.cpp: 45 (WebCore::RenderTable::splitColumn): 46 (WebCore::RenderTable::appendColumn): 47 (WebCore::RenderTable::recalcSections): 48 * rendering/RenderTable.h: 49 (WebCore::RenderTable::getColumnPos): 50 (WebCore::RenderTable::spanOfEffCol): 51 (WebCore::RenderTable::effColToCol): 52 * rendering/RenderTableCell.cpp: 53 (WebCore::RenderTableCell::styleOrColLogicalWidth): 54 (WebCore::CollapsedBorders::nextBorder): 55 * rendering/RenderTableCell.h: 56 * rendering/RenderTableCol.cpp: 57 (WebCore::RenderTableCol::updateFromElement): 58 * rendering/RenderTableCol.h: 59 (WebCore::RenderTableCol::span): 60 (WebCore::RenderTableCol::setSpan): 61 * rendering/RenderTableSection.cpp: 62 (WebCore::RenderTableSection::addCell): 63 (WebCore::RenderTableSection::setCellLogicalWidths): 64 (WebCore::RenderTableSection::layoutRows): 65 (WebCore::RenderTableSection::calcOuterBorderBefore): 66 (WebCore::RenderTableSection::calcOuterBorderAfter): 67 (WebCore::RenderTableSection::calcOuterBorderStart): 68 (WebCore::RenderTableSection::calcOuterBorderEnd): 69 (WebCore::RenderTableSection::paintObject): 70 (WebCore::RenderTableSection::appendColumn): 71 * rendering/RenderTableSection.h: 72 (WebCore::RenderTableSection::cellAt): 73 (WebCore::RenderTableSection::primaryCellAt): 74 (WebCore::RenderTableSection::getBaseline): 75 Mechanical change int -> unsigned. 76 1 77 2011-11-15 Andy Estes <aestes@apple.com> 2 78 -
trunk/Source/WebCore/rendering/AutoTableLayout.cpp
r99254 r100386 43 43 } 44 44 45 void AutoTableLayout::recalcColumn( inteffCol)45 void AutoTableLayout::recalcColumn(unsigned effCol) 46 46 { 47 47 Layout& columnLayout = m_layoutStruct[effCol]; … … 55 55 else if (child->isTableSection()) { 56 56 RenderTableSection* section = toRenderTableSection(child); 57 intnumRows = section->numRows();58 for ( inti = 0; i < numRows; i++) {57 unsigned numRows = section->numRows(); 58 for (unsigned i = 0; i < numRows; i++) { 59 59 RenderTableSection::CellStruct current = section->cellAt(i, effCol); 60 60 RenderTableCell* cell = current.primaryCell(); … … 144 144 m_effectiveLogicalWidthDirty = true; 145 145 146 intnEffCols = m_table->numEffCols();146 unsigned nEffCols = m_table->numEffCols(); 147 147 m_layoutStruct.resize(nEffCols); 148 148 m_layoutStruct.fill(Layout()); … … 151 151 RenderObject* child = m_table->firstChild(); 152 152 Length groupLogicalWidth; 153 intcurrentColumn = 0;153 unsigned currentColumn = 0; 154 154 while (child && child->isTableCol()) { 155 155 RenderTableCol* col = toRenderTableCol(child); 156 intspan = col->span();156 unsigned span = col->span(); 157 157 if (col->firstChild()) 158 158 groupLogicalWidth = col->style()->logicalWidth(); … … 163 163 if ((colLogicalWidth.isFixed() || colLogicalWidth.isPercent()) && colLogicalWidth.isZero()) 164 164 colLogicalWidth = Length(); 165 inteffCol = m_table->colToEffCol(currentColumn);165 unsigned effCol = m_table->colToEffCol(currentColumn); 166 166 if (!colLogicalWidth.isAuto() && span == 1 && effCol < nEffCols && m_table->spanOfEffCol(effCol) == 1) { 167 167 m_layoutStruct[effCol].logicalWidth = colLogicalWidth; … … 182 182 } 183 183 184 for ( inti = 0; i < nEffCols; i++)184 for (unsigned i = 0; i < nEffCols; i++) 185 185 recalcColumn(i); 186 186 } … … 294 294 break; 295 295 296 intspan = cell->colSpan();296 unsigned span = cell->colSpan(); 297 297 298 298 Length cellLogicalWidth = cell->styleOrColLogicalWidth(); … … 300 300 cellLogicalWidth = Length(); // make it Auto 301 301 302 inteffCol = m_table->colToEffCol(cell->col());302 unsigned effCol = m_table->colToEffCol(cell->col()); 303 303 size_t lastCol = effCol; 304 304 int cellMinLogicalWidth = cell->minPreferredLogicalWidth() + spacingInRowDirection; … … 456 456 return; 457 457 458 intsize = m_spanCells.size();458 unsigned size = m_spanCells.size(); 459 459 if (!size || m_spanCells[size-1] != 0) { 460 460 m_spanCells.grow(size + 10); 461 for ( inti = 0; i < 10; i++)461 for (unsigned i = 0; i < 10; i++) 462 462 m_spanCells[size+i] = 0; 463 463 size += 10; … … 465 465 466 466 // add them in sort. This is a slow algorithm, and a binary search or a fast sorting after collection would be better 467 unsigned intpos = 0;468 intspan = cell->colSpan();467 unsigned pos = 0; 468 unsigned span = cell->colSpan(); 469 469 while (pos < m_spanCells.size() && m_spanCells[pos] && span > m_spanCells[pos]->colSpan()) 470 470 pos++; … … 545 545 // remove overallocated space from the last columns 546 546 int excess = tableLogicalWidth * (totalPercent - 100) / 100; 547 for (int i = nEffCols - 1; i >= 0; --i) { 547 for (unsigned i = nEffCols; i; ) { 548 --i; 548 549 if (m_layoutStruct[i].effectiveLogicalWidth.isPercent()) { 549 550 int cellLogicalWidth = m_layoutStruct[i].computedLogicalWidth; … … 627 628 // spread over the rest 628 629 if (available > 0 && nEffCols > numAutoEmptyCellsOnly) { 629 inttotal = nEffCols - numAutoEmptyCellsOnly;630 unsigned total = nEffCols - numAutoEmptyCellsOnly; 630 631 // still have some width to spread 631 for (int i = nEffCols - 1; i >= 0; --i) { 632 for (unsigned i = nEffCols; i; ) { 633 --i; 632 634 // variable columns with empty cells only don't get any width 633 635 if (m_layoutStruct[i].effectiveLogicalWidth.isAuto() && m_layoutStruct[i].emptyCellsOnly) … … 651 653 if (available < 0) { 652 654 int logicalWidthBeyondMin = 0; 653 for (int i = nEffCols - 1; i >= 0; --i) { 655 for (unsigned i = nEffCols; i; ) { 656 --i; 654 657 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 655 658 if (logicalWidth.isAuto()) … … 657 660 } 658 661 659 for (int i = nEffCols - 1; i >= 0 && logicalWidthBeyondMin > 0; --i) { 662 for (unsigned i = nEffCols; i && logicalWidthBeyondMin > 0; ) { 663 --i; 660 664 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 661 665 if (logicalWidth.isAuto()) { … … 673 677 if (available < 0) { 674 678 int logicalWidthBeyondMin = 0; 675 for (int i = nEffCols - 1; i >= 0; --i) { 679 for (unsigned i = nEffCols; i; ) { 680 --i; 676 681 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 677 682 if (logicalWidth.isRelative()) … … 679 684 } 680 685 681 for (int i = nEffCols - 1; i >= 0 && logicalWidthBeyondMin > 0; --i) { 686 for (unsigned i = nEffCols; i && logicalWidthBeyondMin > 0; ) { 687 --i; 682 688 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 683 689 if (logicalWidth.isRelative()) { … … 695 701 if (available < 0) { 696 702 int logicalWidthBeyondMin = 0; 697 for (int i = nEffCols - 1; i >= 0; --i) { 703 for (unsigned i = nEffCols; i; ) { 704 --i; 698 705 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 699 706 if (logicalWidth.isFixed()) … … 701 708 } 702 709 703 for (int i = nEffCols - 1; i >= 0 && logicalWidthBeyondMin > 0; --i) { 710 for (unsigned i = nEffCols; i && logicalWidthBeyondMin > 0; ) { 711 --i; 704 712 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 705 713 if (logicalWidth.isFixed()) { … … 717 725 if (available < 0) { 718 726 int logicalWidthBeyondMin = 0; 719 for (int i = nEffCols - 1; i >= 0; --i) { 727 for (unsigned i = nEffCols; i; ) { 728 --i; 720 729 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 721 730 if (logicalWidth.isPercent()) … … 723 732 } 724 733 725 for (int i = nEffCols-1; i >= 0 && logicalWidthBeyondMin > 0; i--) { 734 for (unsigned i = nEffCols; i && logicalWidthBeyondMin > 0; ) { 735 --i; 726 736 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 727 737 if (logicalWidth.isPercent()) { -
trunk/Source/WebCore/rendering/AutoTableLayout.h
r99254 r100386 42 42 private: 43 43 void fullRecalc(); 44 void recalcColumn( inteffCol);44 void recalcColumn(unsigned effCol); 45 45 46 46 int calcEffectiveLogicalWidth(); -
trunk/Source/WebCore/rendering/FixedTableLayout.cpp
r99254 r100386 84 84 // iterate over all <col> elements 85 85 RenderObject* child = m_table->firstChild(); 86 intnEffCols = m_table->numEffCols();86 unsigned nEffCols = m_table->numEffCols(); 87 87 m_width.resize(nEffCols); 88 88 m_width.fill(Length(Auto)); 89 89 90 intcurrentEffectiveColumn = 0;90 unsigned currentEffectiveColumn = 0; 91 91 Length grpWidth; 92 92 while (child && child->isTableCol()) { … … 102 102 effWidth = w.value(); 103 103 104 intspan = col->span();104 unsigned span = col->span(); 105 105 while (span) { 106 intspanInCurrentEffectiveColumn;106 unsigned spanInCurrentEffectiveColumn; 107 107 if (currentEffectiveColumn >= nEffCols) { 108 108 m_table->appendColumn(span); … … 142 142 RenderTableSection* section = m_table->topNonEmptySection(); 143 143 if (section) { 144 intcCol = 0;144 unsigned cCol = 0; 145 145 RenderObject* firstRow = section->firstChild(); 146 146 child = firstRow->firstChild(); … … 152 152 153 153 Length w = cell->styleOrColLogicalWidth(); 154 intspan = cell->colSpan();154 unsigned span = cell->colSpan(); 155 155 int effWidth = 0; 156 156 if (w.isFixed() && w.isPositive()) 157 157 effWidth = w.value(); 158 158 159 intusedSpan = 0;160 inti = 0;159 unsigned usedSpan = 0; 160 unsigned i = 0; 161 161 while (usedSpan < span && cCol + i < nEffCols) { 162 162 float eSpan = m_table->spanOfEffCol(cCol + i); … … 224 224 { 225 225 int tableLogicalWidth = m_table->logicalWidth() - m_table->bordersPaddingAndSpacingInRowDirection(); 226 intnEffCols = m_table->numEffCols();226 unsigned nEffCols = m_table->numEffCols(); 227 227 Vector<int> calcWidth(nEffCols, 0); 228 228 229 intnumAuto = 0;230 intautoSpan = 0;229 unsigned numAuto = 0; 230 unsigned autoSpan = 0; 231 231 int totalFixedWidth = 0; 232 232 int totalPercentWidth = 0; … … 237 237 // for a table width of 100px with columns (40px, 10%), the 10% compute 238 238 // to 10px here, and will scale up to 20px in the final (80px, 20px). 239 for ( inti = 0; i < nEffCols; i++) {239 for (unsigned i = 0; i < nEffCols; i++) { 240 240 if (m_width[i].isFixed()) { 241 241 calcWidth[i] = m_width[i].value(); … … 260 260 if (totalFixedWidth && totalWidth < tableLogicalWidth) { 261 261 totalFixedWidth = 0; 262 for ( inti = 0; i < nEffCols; i++) {262 for (unsigned i = 0; i < nEffCols; i++) { 263 263 if (m_width[i].isFixed()) { 264 264 calcWidth[i] = calcWidth[i] * tableLogicalWidth / totalWidth; … … 269 269 if (totalPercent) { 270 270 totalPercentWidth = 0; 271 for ( inti = 0; i < nEffCols; i++) {271 for (unsigned i = 0; i < nEffCols; i++) { 272 272 if (m_width[i].isPercent()) { 273 273 calcWidth[i] = m_width[i].percent() * (tableLogicalWidth - totalFixedWidth) / totalPercent; … … 280 280 } else { 281 281 // Divide the remaining width among the auto columns. 282 ASSERT(autoSpan >= numAuto); 282 283 int remainingWidth = tableLogicalWidth - totalFixedWidth - totalPercentWidth - hspacing * (autoSpan - numAuto); 283 284 int lastAuto = 0; 284 for ( inti = 0; i < nEffCols; i++) {285 for (unsigned i = 0; i < nEffCols; i++) { 285 286 if (m_width[i].isAuto()) { 286 intspan = m_table->spanOfEffCol(i);287 unsigned span = m_table->spanOfEffCol(i); 287 288 int w = remainingWidth * span / autoSpan; 288 289 calcWidth[i] = w + hspacing * (span - 1); … … 292 293 lastAuto = i; 293 294 numAuto--; 295 ASSERT(autoSpan >= span); 294 296 autoSpan -= span; 295 297 } … … 315 317 316 318 int pos = 0; 317 for ( inti = 0; i < nEffCols; i++) {319 for (unsigned i = 0; i < nEffCols; i++) { 318 320 m_table->columnPositions()[i] = pos; 319 321 pos += calcWidth[i] + hspacing; -
trunk/Source/WebCore/rendering/RenderTable.cpp
r100183 r100386 634 634 } 635 635 636 void RenderTable::splitColumn(unsigned position, intfirstSpan)636 void RenderTable::splitColumn(unsigned position, unsigned firstSpan) 637 637 { 638 638 // we need to add a new columnStruct 639 639 unsigned oldSize = m_columns.size(); 640 640 m_columns.grow(oldSize + 1); 641 intoldSpan = m_columns[position].span;641 unsigned oldSpan = m_columns[position].span; 642 642 ASSERT(oldSpan > firstSpan); 643 643 m_columns[position].span = firstSpan; … … 662 662 } 663 663 664 void RenderTable::appendColumn( intspan)664 void RenderTable::appendColumn(unsigned span) 665 665 { 666 666 unsigned pos = m_columns.size(); … … 705 705 } 706 706 707 RenderTableCol* RenderTable::colElement( intcol, bool* startEdge, bool* endEdge) const707 RenderTableCol* RenderTable::colElement(unsigned col, bool* startEdge, bool* endEdge) const 708 708 { 709 709 if (!m_hasColElements) 710 710 return 0; 711 711 RenderObject* child = firstChild(); 712 intcCol = 0;712 unsigned cCol = 0; 713 713 714 714 while (child) { … … 724 724 RenderTableCol* colElem = toRenderTableCol(child); 725 725 while (colElem) { 726 intspan = colElem->span();726 unsigned span = colElem->span(); 727 727 if (!colElem->firstChild()) { 728 int startCol = cCol; 729 int endCol = cCol + span - 1; 728 unsigned startCol = cCol; 729 ASSERT(span >= 1); 730 unsigned endCol = cCol + span - 1; 730 731 cCol += span; 731 732 if (cCol > col) { … … 793 794 794 795 // repair column count (addChild can grow it too much, because it always adds elements to the last row of a section) 795 intmaxCols = 0;796 unsigned maxCols = 0; 796 797 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { 797 798 if (child->isTableSection()) { 798 799 RenderTableSection* section = toRenderTableSection(child); 799 intsectionCols = section->numColumns();800 unsigned sectionCols = section->numColumns(); 800 801 if (sectionCols > maxCols) 801 802 maxCols = sectionCols; … … 1081 1082 1082 1083 // Find the section and row to look in 1083 intr = cell->row();1084 unsigned r = cell->row(); 1084 1085 RenderTableSection* section = 0; 1085 intrAbove = 0;1086 unsigned rAbove = 0; 1086 1087 if (r > 0) { 1087 1088 // cell is not in the first row, so use the above row in its own section … … 1090 1091 } else { 1091 1092 section = sectionAbove(cell->section(), SkipEmptySections); 1092 if (section) 1093 if (section) { 1094 ASSERT(section->numRows()); 1093 1095 rAbove = section->numRows() - 1; 1096 } 1094 1097 } 1095 1098 -
trunk/Source/WebCore/rendering/RenderTable.h
r100177 r100386 45 45 virtual ~RenderTable(); 46 46 47 LayoutUnit getColumnPos( intcol) const { return m_columnPos[col]; }47 LayoutUnit getColumnPos(unsigned col) const { return m_columnPos[col]; } 48 48 49 49 int hBorderSpacing() const { return m_hSpacing; } … … 147 147 RenderTableSection* topNonEmptySection() const; 148 148 149 void splitColumn(unsigned position, intfirstSpan);150 void appendColumn( intspan);149 void splitColumn(unsigned position, unsigned firstSpan); 150 void appendColumn(unsigned span); 151 151 unsigned numEffCols() const { return m_columns.size(); } 152 int spanOfEffCol(inteffCol) const { return m_columns[effCol].span; }152 unsigned spanOfEffCol(unsigned effCol) const { return m_columns[effCol].span; } 153 153 154 154 unsigned colToEffCol(unsigned column) const … … 161 161 } 162 162 163 int effColToCol(inteffCol) const164 { 165 intc = 0;166 for ( inti = 0; i < effCol; i++)163 unsigned effColToCol(unsigned effCol) const 164 { 165 unsigned c = 0; 166 for (unsigned i = 0; i < effCol; i++) 167 167 c += m_columns[i].span; 168 168 return c; … … 175 175 } 176 176 177 RenderTableCol* colElement( intcol, bool* startEdge = 0, bool* endEdge = 0) const;177 RenderTableCol* colElement(unsigned col, bool* startEdge = 0, bool* endEdge = 0) const; 178 178 RenderTableCol* nextColElement(RenderTableCol* current) const; 179 179 -
trunk/Source/WebCore/rendering/RenderTableCell.cpp
r100051 r100386 63 63 } 64 64 65 intRenderTableCell::colSpan() const65 unsigned RenderTableCell::colSpan() const 66 66 { 67 67 if (UNLIKELY(!m_hasAssociatedTableCellElement)) … … 71 71 } 72 72 73 intRenderTableCell::rowSpan() const73 unsigned RenderTableCell::rowSpan() const 74 74 { 75 75 if (UNLIKELY(!m_hasAssociatedTableCellElement)) … … 97 97 98 98 if (RenderTableCol* tableCol = table()->colElement(col())) { 99 intcolSpanCount = colSpan();99 unsigned colSpanCount = colSpan(); 100 100 101 101 Length colWidthSum = Length(0, Fixed); 102 for ( inti = 1; i <= colSpanCount; i++) {102 for (unsigned i = 1; i <= colSpanCount; i++) { 103 103 Length colWidth = tableCol->style()->logicalWidth(); 104 104 … … 867 867 CollapsedBorder* nextBorder() 868 868 { 869 for ( inti = 0; i < m_count; i++) {869 for (unsigned i = 0; i < m_count; i++) { 870 870 if (m_borders[i].borderValue.exists() && m_borders[i].shouldPaint) { 871 871 m_borders[i].shouldPaint = false; … … 878 878 879 879 CollapsedBorder m_borders[4]; 880 intm_count;880 unsigned m_count; 881 881 }; 882 882 -
trunk/Source/WebCore/rendering/RenderTableCell.h
r100051 r100386 44 44 void setCellIndex(int) { } 45 45 46 intcolSpan() const;47 introwSpan() const;46 unsigned colSpan() const; 47 unsigned rowSpan() const; 48 48 49 49 // Called from HTMLTableCellElement. -
trunk/Source/WebCore/rendering/RenderTableCol.cpp
r98767 r100386 59 59 void RenderTableCol::updateFromElement() 60 60 { 61 intoldSpan = m_span;61 unsigned oldSpan = m_span; 62 62 Node* n = node(); 63 63 if (n && (n->hasTagName(colTag) || n->hasTagName(colgroupTag))) { -
trunk/Source/WebCore/rendering/RenderTableCol.h
r98767 r100386 42 42 virtual void computePreferredLogicalWidths(); 43 43 44 intspan() const { return m_span; }45 void setSpan( intspan) { m_span = span; }44 unsigned span() const { return m_span; } 45 void setSpan(unsigned span) { m_span = span; } 46 46 47 47 private: … … 65 65 66 66 RenderObjectChildList m_children; 67 intm_span;67 unsigned m_span; 68 68 }; 69 69 -
trunk/Source/WebCore/rendering/RenderTableSection.cpp
r100183 r100386 194 194 return; 195 195 196 intrSpan = cell->rowSpan();197 intcSpan = cell->colSpan();196 unsigned rSpan = cell->rowSpan(); 197 unsigned cSpan = cell->colSpan(); 198 198 Vector<RenderTable::ColumnStruct>& columns = table()->columns(); 199 199 unsigned nCols = columns.size(); … … 242 242 bool inColSpan = false; 243 243 while (cSpan) { 244 intcurrentSpan;244 unsigned currentSpan; 245 245 if (m_cCol >= nCols) { 246 246 table()->appendColumn(cSpan); 247 247 currentSpan = cSpan; 248 248 } else { 249 if (cSpan < (int)columns[m_cCol].span)249 if (cSpan < columns[m_cCol].span) 250 250 table()->splitColumn(m_cCol, cSpan); 251 251 currentSpan = columns[m_cCol].span; 252 252 } 253 for ( intr = 0; r < rSpan; r++) {253 for (unsigned r = 0; r < rSpan; r++) { 254 254 CellStruct& c = cellAt(insertionRow + r, m_cCol); 255 255 ASSERT(cell); … … 284 284 continue; 285 285 unsigned endCol = j; 286 intcspan = cell->colSpan();286 unsigned cspan = cell->colSpan(); 287 287 while (cspan && endCol < cols) { 288 288 ASSERT(endCol < table()->columns().size()); … … 439 439 440 440 LayoutUnit rHeight; 441 intrindx;441 unsigned rindx; 442 442 unsigned totalRows = m_grid.size(); 443 443 … … 510 510 LayoutUnit hspacing = table()->hBorderSpacing(); 511 511 LayoutUnit vspacing = table()->vBorderSpacing(); 512 LayoutUnitnEffCols = table()->numEffCols();512 unsigned nEffCols = table()->numEffCols(); 513 513 514 514 LayoutStateMaintainer statePusher(view(), this, LayoutSize(x(), y()), style()->isFlippedBlocksWritingMode()); … … 523 523 } 524 524 525 for ( intc = 0; c < nEffCols; c++) {525 for (unsigned c = 0; c < nEffCols; c++) { 526 526 CellStruct& cs = cellAt(r, c); 527 527 RenderTableCell* cell = cs.primaryCell(); … … 680 680 // Now that our height has been determined, add in overflow from cells. 681 681 for (unsigned r = 0; r < totalRows; r++) { 682 for ( intc = 0; c < nEffCols; c++) {682 for (unsigned c = 0; c < nEffCols; c++) { 683 683 CellStruct& cs = cellAt(r, c); 684 684 RenderTableCell* cell = cs.primaryCell(); … … 711 711 LayoutUnit RenderTableSection::calcOuterBorderBefore() const 712 712 { 713 inttotalCols = table()->numEffCols();713 unsigned totalCols = table()->numEffCols(); 714 714 if (!m_grid.size() || !totalCols) 715 715 return 0; … … 730 730 731 731 bool allHidden = true; 732 for ( intc = 0; c < totalCols; c++) {732 for (unsigned c = 0; c < totalCols; c++) { 733 733 const CellStruct& current = cellAt(0, c); 734 734 if (current.inColSpan || !current.hasCells()) … … 762 762 LayoutUnit RenderTableSection::calcOuterBorderAfter() const 763 763 { 764 inttotalCols = table()->numEffCols();764 unsigned totalCols = table()->numEffCols(); 765 765 if (!m_grid.size() || !totalCols) 766 766 return 0; … … 781 781 782 782 bool allHidden = true; 783 for ( intc = 0; c < totalCols; c++) {783 for (unsigned c = 0; c < totalCols; c++) { 784 784 const CellStruct& current = cellAt(m_grid.size() - 1, c); 785 785 if (current.inColSpan || !current.hasCells()) … … 813 813 LayoutUnit RenderTableSection::calcOuterBorderStart() const 814 814 { 815 inttotalCols = table()->numEffCols();815 unsigned totalCols = table()->numEffCols(); 816 816 if (!m_grid.size() || !totalCols) 817 817 return 0; … … 857 857 LayoutUnit RenderTableSection::calcOuterBorderEnd() const 858 858 { 859 inttotalCols = table()->numEffCols();859 unsigned totalCols = table()->numEffCols(); 860 860 if (!m_grid.size() || !totalCols) 861 861 return 0; … … 1107 1107 std::sort(cells.begin(), cells.end(), compareCellPositionsWithOverflowingCells); 1108 1108 1109 int size = cells.size(); 1110 // Paint the cells. 1111 for (int i = 0; i < size; ++i) 1109 for (unsigned i = 0; i < cells.size(); ++i) 1112 1110 paintCell(cells[i], paintInfo, paintOffset); 1113 1111 } … … 1185 1183 } 1186 1184 1187 void RenderTableSection::appendColumn( intpos)1185 void RenderTableSection::appendColumn(unsigned pos) 1188 1186 { 1189 1187 ASSERT(!m_needsCellRecalc); … … 1193 1191 } 1194 1192 1195 void RenderTableSection::splitColumn(unsigned pos, intfirst)1193 void RenderTableSection::splitColumn(unsigned pos, unsigned first) 1196 1194 { 1197 1195 ASSERT(!m_needsCellRecalc); … … 1206 1204 RenderTableCell* cell = r[pos].primaryCell(); 1207 1205 ASSERT(cell); 1208 int colleft = cell->colSpan() - r[pos].inColSpan; 1206 ASSERT(cell->colSpan() >= (r[pos].inColSpan ? 1 : 0)); 1207 unsigned colleft = cell->colSpan() - r[pos].inColSpan; 1209 1208 if (first > colleft) 1210 1209 r[pos + 1].inColSpan = 0; … … 1280 1279 return false; 1281 1280 1282 for (int i = current.cells.size() - 1; i >= 0; --i) { 1281 for (unsigned i = current.cells.size() ; i; ) { 1282 --i; 1283 1283 RenderTableCell* cell = current.cells[i]; 1284 1284 LayoutPoint cellPoint = flipForWritingModeForChild(cell, adjustedLocation); -
trunk/Source/WebCore/rendering/RenderTableSection.h
r99919 r100386 91 91 }; 92 92 93 CellStruct& cellAt( int row, intcol) { return m_grid[row].row[col]; }94 const CellStruct& cellAt( int row, intcol) const { return m_grid[row].row[col]; }95 RenderTableCell* primaryCellAt( int row, intcol)93 CellStruct& cellAt(unsigned row, unsigned col) { return m_grid[row].row[col]; } 94 const CellStruct& cellAt(unsigned row, unsigned col) const { return m_grid[row].row[col]; } 95 RenderTableCell* primaryCellAt(unsigned row, unsigned col) 96 96 { 97 97 CellStruct& c = m_grid[row].row[col]; … … 99 99 } 100 100 101 void appendColumn( intpos);102 void splitColumn(unsigned pos, intfirst);101 void appendColumn(unsigned pos); 102 void splitColumn(unsigned pos, unsigned first); 103 103 104 104 LayoutUnit calcOuterBorderBefore() const; … … 125 125 void setNeedsCellRecalc(); 126 126 127 LayoutUnit getBaseline( introw) { return m_grid[row].baseline; }127 LayoutUnit getBaseline(unsigned row) { return m_grid[row].baseline; } 128 128 129 129 void rowLogicalHeightChanged(unsigned rowIndex);
Note:
See TracChangeset
for help on using the changeset viewer.