| 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 19 matching lines...) Expand all Loading... |
| 30 #include "core/rendering/GraphicsContextAnnotator.h" | 30 #include "core/rendering/GraphicsContextAnnotator.h" |
| 31 #include "core/rendering/HitTestResult.h" | 31 #include "core/rendering/HitTestResult.h" |
| 32 #include "core/rendering/PaintInfo.h" | 32 #include "core/rendering/PaintInfo.h" |
| 33 #include "core/rendering/RenderTableCell.h" | 33 #include "core/rendering/RenderTableCell.h" |
| 34 #include "core/rendering/RenderTableCol.h" | 34 #include "core/rendering/RenderTableCol.h" |
| 35 #include "core/rendering/RenderTableRow.h" | 35 #include "core/rendering/RenderTableRow.h" |
| 36 #include "core/rendering/RenderView.h" | 36 #include "core/rendering/RenderView.h" |
| 37 #include "core/rendering/SubtreeLayoutScope.h" | 37 #include "core/rendering/SubtreeLayoutScope.h" |
| 38 #include "wtf/HashSet.h" | 38 #include "wtf/HashSet.h" |
| 39 | 39 |
| 40 using namespace std; | |
| 41 | |
| 42 namespace WebCore { | 40 namespace WebCore { |
| 43 | 41 |
| 44 using namespace HTMLNames; | 42 using namespace HTMLNames; |
| 45 | 43 |
| 46 // Those 2 variables are used to balance the memory consumption vs the repaint t
ime on big tables. | 44 // Those 2 variables are used to balance the memory consumption vs the repaint t
ime on big tables. |
| 47 static unsigned gMinTableSizeToUseFastPaintPathWithOverflowingCell = 75 * 75; | 45 static unsigned gMinTableSizeToUseFastPaintPathWithOverflowingCell = 75 * 75; |
| 48 static float gMaxAllowedOverflowingCellRatioForFastPaintPath = 0.1f; | 46 static float gMaxAllowedOverflowingCellRatioForFastPaintPath = 0.1f; |
| 49 | 47 |
| 50 static inline void setRowLogicalHeightToRowStyleLogicalHeight(RenderTableSection
::RowStruct& row) | 48 static inline void setRowLogicalHeightToRowStyleLogicalHeight(RenderTableSection
::RowStruct& row) |
| 51 { | 49 { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 178 } |
| 181 | 179 |
| 182 void RenderTableSection::ensureRows(unsigned numRows) | 180 void RenderTableSection::ensureRows(unsigned numRows) |
| 183 { | 181 { |
| 184 if (numRows <= m_grid.size()) | 182 if (numRows <= m_grid.size()) |
| 185 return; | 183 return; |
| 186 | 184 |
| 187 unsigned oldSize = m_grid.size(); | 185 unsigned oldSize = m_grid.size(); |
| 188 m_grid.grow(numRows); | 186 m_grid.grow(numRows); |
| 189 | 187 |
| 190 unsigned effectiveColumnCount = max(1u, table()->numEffCols()); | 188 unsigned effectiveColumnCount = std::max(1u, table()->numEffCols()); |
| 191 for (unsigned row = oldSize; row < m_grid.size(); ++row) | 189 for (unsigned row = oldSize; row < m_grid.size(); ++row) |
| 192 m_grid[row].row.grow(effectiveColumnCount); | 190 m_grid[row].row.grow(effectiveColumnCount); |
| 193 } | 191 } |
| 194 | 192 |
| 195 void RenderTableSection::addCell(RenderTableCell* cell, RenderTableRow* row) | 193 void RenderTableSection::addCell(RenderTableCell* cell, RenderTableRow* row) |
| 196 { | 194 { |
| 197 // We don't insert the cell if we need cell recalc as our internal columns'
representation | 195 // We don't insert the cell if we need cell recalc as our internal columns'
representation |
| 198 // will have drifted from the table's representation. Also recalcCells will
call addCell | 196 // will have drifted from the table's representation. Also recalcCells will
call addCell |
| 199 // at a later time after sync'ing our columns' with the table's. | 197 // at a later time after sync'ing our columns' with the table's. |
| 200 if (needsCellRecalc()) | 198 if (needsCellRecalc()) |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing += borderSpacingF
orRow(rowIndex + rowSpan - 1); | 293 spanningRowsHeight.spanningCellHeightIgnoringBorderSpacing += borderSpacingF
orRow(rowIndex + rowSpan - 1); |
| 296 } | 294 } |
| 297 | 295 |
| 298 void RenderTableSection::distributeExtraRowSpanHeightToPercentRows(RenderTableCe
ll* cell, int totalPercent, int& extraRowSpanningHeight, Vector<int>& rowsHeight
) | 296 void RenderTableSection::distributeExtraRowSpanHeightToPercentRows(RenderTableCe
ll* cell, int totalPercent, int& extraRowSpanningHeight, Vector<int>& rowsHeight
) |
| 299 { | 297 { |
| 300 if (!extraRowSpanningHeight || !totalPercent) | 298 if (!extraRowSpanningHeight || !totalPercent) |
| 301 return; | 299 return; |
| 302 | 300 |
| 303 const unsigned rowSpan = cell->rowSpan(); | 301 const unsigned rowSpan = cell->rowSpan(); |
| 304 const unsigned rowIndex = cell->rowIndex(); | 302 const unsigned rowIndex = cell->rowIndex(); |
| 305 int percent = min(totalPercent, 100); | 303 int percent = std::min(totalPercent, 100); |
| 306 const int tableHeight = m_rowPos[m_grid.size()] + extraRowSpanningHeight; | 304 const int tableHeight = m_rowPos[m_grid.size()] + extraRowSpanningHeight; |
| 307 | 305 |
| 308 // Our algorithm matches Firefox. Extra spanning height would be distributed
Only in first percent height rows | 306 // Our algorithm matches Firefox. Extra spanning height would be distributed
Only in first percent height rows |
| 309 // those total percent is 100. Other percent rows would be uneffected even e
xtra spanning height is remain. | 307 // those total percent is 100. Other percent rows would be uneffected even e
xtra spanning height is remain. |
| 310 int accumulatedPositionIncrease = 0; | 308 int accumulatedPositionIncrease = 0; |
| 311 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { | 309 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { |
| 312 if (percent > 0 && extraRowSpanningHeight > 0) { | 310 if (percent > 0 && extraRowSpanningHeight > 0) { |
| 313 if (m_grid[row].logicalHeight.isPercent()) { | 311 if (m_grid[row].logicalHeight.isPercent()) { |
| 314 int toAdd = (tableHeight * m_grid[row].logicalHeight.percent() /
100) - rowsHeight[row - rowIndex]; | 312 int toAdd = (tableHeight * m_grid[row].logicalHeight.percent() /
100) - rowsHeight[row - rowIndex]; |
| 315 // FIXME: Note that this is wrong if we have a percentage above
100% and may make us grow | 313 // FIXME: Note that this is wrong if we have a percentage above
100% and may make us grow |
| 316 // above the available space. | 314 // above the available space. |
| 317 | 315 |
| 318 toAdd = min(toAdd, extraRowSpanningHeight); | 316 toAdd = std::min(toAdd, extraRowSpanningHeight); |
| 319 accumulatedPositionIncrease += toAdd; | 317 accumulatedPositionIncrease += toAdd; |
| 320 extraRowSpanningHeight -= toAdd; | 318 extraRowSpanningHeight -= toAdd; |
| 321 percent -= m_grid[row].logicalHeight.percent(); | 319 percent -= m_grid[row].logicalHeight.percent(); |
| 322 } | 320 } |
| 323 } | 321 } |
| 324 m_rowPos[row + 1] += accumulatedPositionIncrease; | 322 m_rowPos[row + 1] += accumulatedPositionIncrease; |
| 325 } | 323 } |
| 326 } | 324 } |
| 327 | 325 |
| 328 // Sometimes the multiplication of the 2 values below will overflow an integer. | 326 // Sometimes the multiplication of the 2 values below will overflow an integer. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 unsigned totalCols = m_grid[row].row.size(); | 462 unsigned totalCols = m_grid[row].row.size(); |
| 465 | 463 |
| 466 if (!totalCols) | 464 if (!totalCols) |
| 467 return 0; | 465 return 0; |
| 468 | 466 |
| 469 unsigned rowHeight = 0; | 467 unsigned rowHeight = 0; |
| 470 | 468 |
| 471 for (unsigned col = 0; col < totalCols; col++) { | 469 for (unsigned col = 0; col < totalCols; col++) { |
| 472 const CellStruct& rowSpanCell = cellAt(row, col); | 470 const CellStruct& rowSpanCell = cellAt(row, col); |
| 473 if (rowSpanCell.cells.size() && rowSpanCell.cells[0]->rowSpan() > 1) | 471 if (rowSpanCell.cells.size() && rowSpanCell.cells[0]->rowSpan() > 1) |
| 474 rowHeight = max(rowHeight, rowSpanCell.cells[0]->logicalHeightForRow
Sizing() / rowSpanCell.cells[0]->rowSpan()); | 472 rowHeight = std::max(rowHeight, rowSpanCell.cells[0]->logicalHeightF
orRowSizing() / rowSpanCell.cells[0]->rowSpan()); |
| 475 } | 473 } |
| 476 | 474 |
| 477 return rowHeight; | 475 return rowHeight; |
| 478 } | 476 } |
| 479 | 477 |
| 480 void RenderTableSection::updateRowsHeightHavingOnlySpanningCells(RenderTableCell
* cell, struct SpanningRowsHeight& spanningRowsHeight) | 478 void RenderTableSection::updateRowsHeightHavingOnlySpanningCells(RenderTableCell
* cell, struct SpanningRowsHeight& spanningRowsHeight) |
| 481 { | 479 { |
| 482 ASSERT(spanningRowsHeight.rowHeight.size()); | 480 ASSERT(spanningRowsHeight.rowHeight.size()); |
| 483 | 481 |
| 484 int accumulatedPositionIncrease = 0; | 482 int accumulatedPositionIncrease = 0; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 // and if the row's baseline goes out of the row's boundries then adjust row hei
ght accordingly. | 612 // and if the row's baseline goes out of the row's boundries then adjust row hei
ght accordingly. |
| 615 void RenderTableSection::updateBaselineForCell(RenderTableCell* cell, unsigned r
ow, LayoutUnit& baselineDescent) | 613 void RenderTableSection::updateBaselineForCell(RenderTableCell* cell, unsigned r
ow, LayoutUnit& baselineDescent) |
| 616 { | 614 { |
| 617 if (!cell->isBaselineAligned()) | 615 if (!cell->isBaselineAligned()) |
| 618 return; | 616 return; |
| 619 | 617 |
| 620 // Ignoring the intrinsic padding as it depends on knowing the row's baselin
e, which won't be accurate | 618 // Ignoring the intrinsic padding as it depends on knowing the row's baselin
e, which won't be accurate |
| 621 // until the end of this function. | 619 // until the end of this function. |
| 622 LayoutUnit baselinePosition = cell->cellBaselinePosition() - cell->intrinsic
PaddingBefore(); | 620 LayoutUnit baselinePosition = cell->cellBaselinePosition() - cell->intrinsic
PaddingBefore(); |
| 623 if (baselinePosition > cell->borderBefore() + (cell->paddingBefore() - cell-
>intrinsicPaddingBefore())) { | 621 if (baselinePosition > cell->borderBefore() + (cell->paddingBefore() - cell-
>intrinsicPaddingBefore())) { |
| 624 m_grid[row].baseline = max(m_grid[row].baseline, baselinePosition); | 622 m_grid[row].baseline = std::max(m_grid[row].baseline, baselinePosition); |
| 625 | 623 |
| 626 int cellStartRowBaselineDescent = 0; | 624 int cellStartRowBaselineDescent = 0; |
| 627 if (cell->rowSpan() == 1) { | 625 if (cell->rowSpan() == 1) { |
| 628 baselineDescent = max(baselineDescent, cell->logicalHeightForRowSizi
ng() - baselinePosition); | 626 baselineDescent = std::max(baselineDescent, cell->logicalHeightForRo
wSizing() - baselinePosition); |
| 629 cellStartRowBaselineDescent = baselineDescent; | 627 cellStartRowBaselineDescent = baselineDescent; |
| 630 } | 628 } |
| 631 m_rowPos[row + 1] = max<int>(m_rowPos[row + 1], m_rowPos[row] + m_grid[r
ow].baseline + cellStartRowBaselineDescent); | 629 m_rowPos[row + 1] = std::max<int>(m_rowPos[row + 1], m_rowPos[row] + m_g
rid[row].baseline + cellStartRowBaselineDescent); |
| 632 } | 630 } |
| 633 } | 631 } |
| 634 | 632 |
| 635 int RenderTableSection::calcRowLogicalHeight() | 633 int RenderTableSection::calcRowLogicalHeight() |
| 636 { | 634 { |
| 637 #ifndef NDEBUG | 635 #ifndef NDEBUG |
| 638 SetLayoutNeededForbiddenScope layoutForbiddenScope(*this); | 636 SetLayoutNeededForbiddenScope layoutForbiddenScope(*this); |
| 639 #endif | 637 #endif |
| 640 | 638 |
| 641 ASSERT(!needsLayout()); | 639 ASSERT(!needsLayout()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 656 SpanningRenderTableCells rowSpanCells; | 654 SpanningRenderTableCells rowSpanCells; |
| 657 #ifndef NDEBUG | 655 #ifndef NDEBUG |
| 658 HashSet<const RenderTableCell*> uniqueCells; | 656 HashSet<const RenderTableCell*> uniqueCells; |
| 659 #endif | 657 #endif |
| 660 | 658 |
| 661 for (unsigned r = 0; r < m_grid.size(); r++) { | 659 for (unsigned r = 0; r < m_grid.size(); r++) { |
| 662 m_grid[r].baseline = 0; | 660 m_grid[r].baseline = 0; |
| 663 LayoutUnit baselineDescent = 0; | 661 LayoutUnit baselineDescent = 0; |
| 664 | 662 |
| 665 // Our base size is the biggest logical height from our cells' styles (e
xcluding row spanning cells). | 663 // Our base size is the biggest logical height from our cells' styles (e
xcluding row spanning cells). |
| 666 m_rowPos[r + 1] = max(m_rowPos[r] + minimumValueForLength(m_grid[r].logi
calHeight, 0).round(), 0); | 664 m_rowPos[r + 1] = std::max(m_rowPos[r] + minimumValueForLength(m_grid[r]
.logicalHeight, 0).round(), 0); |
| 667 | 665 |
| 668 Row& row = m_grid[r].row; | 666 Row& row = m_grid[r].row; |
| 669 unsigned totalCols = row.size(); | 667 unsigned totalCols = row.size(); |
| 670 RenderTableCell* lastRowSpanCell = 0; | 668 RenderTableCell* lastRowSpanCell = 0; |
| 671 | 669 |
| 672 for (unsigned c = 0; c < totalCols; c++) { | 670 for (unsigned c = 0; c < totalCols; c++) { |
| 673 CellStruct& current = cellAt(r, c); | 671 CellStruct& current = cellAt(r, c); |
| 674 for (unsigned i = 0; i < current.cells.size(); i++) { | 672 for (unsigned i = 0; i < current.cells.size(); i++) { |
| 675 cell = current.cells[i]; | 673 cell = current.cells[i]; |
| 676 if (current.inColSpan && cell->rowSpan() == 1) | 674 if (current.inColSpan && cell->rowSpan() == 1) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 694 } | 692 } |
| 695 | 693 |
| 696 ASSERT(cell->rowSpan() == 1); | 694 ASSERT(cell->rowSpan() == 1); |
| 697 | 695 |
| 698 if (cell->hasOverrideHeight()) { | 696 if (cell->hasOverrideHeight()) { |
| 699 cell->clearIntrinsicPadding(); | 697 cell->clearIntrinsicPadding(); |
| 700 cell->clearOverrideSize(); | 698 cell->clearOverrideSize(); |
| 701 cell->forceChildLayout(); | 699 cell->forceChildLayout(); |
| 702 } | 700 } |
| 703 | 701 |
| 704 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r] + cell->logic
alHeightForRowSizing()); | 702 m_rowPos[r + 1] = std::max(m_rowPos[r + 1], m_rowPos[r] + cell->
logicalHeightForRowSizing()); |
| 705 | 703 |
| 706 // Find out the baseline. | 704 // Find out the baseline. |
| 707 updateBaselineForCell(cell, r, baselineDescent); | 705 updateBaselineForCell(cell, r, baselineDescent); |
| 708 } | 706 } |
| 709 } | 707 } |
| 710 | 708 |
| 711 // Add the border-spacing to our final position. | 709 // Add the border-spacing to our final position. |
| 712 m_rowPos[r + 1] += borderSpacingForRow(r); | 710 m_rowPos[r + 1] += borderSpacingForRow(r); |
| 713 m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[r]); | 711 m_rowPos[r + 1] = std::max(m_rowPos[r + 1], m_rowPos[r]); |
| 714 } | 712 } |
| 715 | 713 |
| 716 if (!rowSpanCells.isEmpty()) | 714 if (!rowSpanCells.isEmpty()) |
| 717 distributeRowSpanHeightToRows(rowSpanCells); | 715 distributeRowSpanHeightToRows(rowSpanCells); |
| 718 | 716 |
| 719 ASSERT(!needsLayout()); | 717 ASSERT(!needsLayout()); |
| 720 | 718 |
| 721 return m_rowPos[m_grid.size()]; | 719 return m_rowPos[m_grid.size()]; |
| 722 } | 720 } |
| 723 | 721 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 } | 767 } |
| 770 | 768 |
| 771 void RenderTableSection::distributeExtraLogicalHeightToPercentRows(int& extraLog
icalHeight, int totalPercent) | 769 void RenderTableSection::distributeExtraLogicalHeightToPercentRows(int& extraLog
icalHeight, int totalPercent) |
| 772 { | 770 { |
| 773 if (!totalPercent) | 771 if (!totalPercent) |
| 774 return; | 772 return; |
| 775 | 773 |
| 776 unsigned totalRows = m_grid.size(); | 774 unsigned totalRows = m_grid.size(); |
| 777 int totalHeight = m_rowPos[totalRows] + extraLogicalHeight; | 775 int totalHeight = m_rowPos[totalRows] + extraLogicalHeight; |
| 778 int totalLogicalHeightAdded = 0; | 776 int totalLogicalHeightAdded = 0; |
| 779 totalPercent = min(totalPercent, 100); | 777 totalPercent = std::min(totalPercent, 100); |
| 780 int rowHeight = m_rowPos[1] - m_rowPos[0]; | 778 int rowHeight = m_rowPos[1] - m_rowPos[0]; |
| 781 for (unsigned r = 0; r < totalRows; ++r) { | 779 for (unsigned r = 0; r < totalRows; ++r) { |
| 782 if (totalPercent > 0 && m_grid[r].logicalHeight.isPercent()) { | 780 if (totalPercent > 0 && m_grid[r].logicalHeight.isPercent()) { |
| 783 int toAdd = min<int>(extraLogicalHeight, (totalHeight * m_grid[r].lo
gicalHeight.percent() / 100) - rowHeight); | 781 int toAdd = std::min<int>(extraLogicalHeight, (totalHeight * m_grid[
r].logicalHeight.percent() / 100) - rowHeight); |
| 784 // If toAdd is negative, then we don't want to shrink the row (this
bug | 782 // If toAdd is negative, then we don't want to shrink the row (this
bug |
| 785 // affected Outlook Web Access). | 783 // affected Outlook Web Access). |
| 786 toAdd = max(0, toAdd); | 784 toAdd = std::max(0, toAdd); |
| 787 totalLogicalHeightAdded += toAdd; | 785 totalLogicalHeightAdded += toAdd; |
| 788 extraLogicalHeight -= toAdd; | 786 extraLogicalHeight -= toAdd; |
| 789 totalPercent -= m_grid[r].logicalHeight.percent(); | 787 totalPercent -= m_grid[r].logicalHeight.percent(); |
| 790 } | 788 } |
| 791 ASSERT(totalRows >= 1); | 789 ASSERT(totalRows >= 1); |
| 792 if (r < totalRows - 1) | 790 if (r < totalRows - 1) |
| 793 rowHeight = m_rowPos[r + 2] - m_rowPos[r + 1]; | 791 rowHeight = m_rowPos[r + 2] - m_rowPos[r + 1]; |
| 794 m_rowPos[r + 1] += totalLogicalHeightAdded; | 792 m_rowPos[r + 1] += totalLogicalHeightAdded; |
| 795 } | 793 } |
| 796 } | 794 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 // Alignment within a cell is based off the calculated | 953 // Alignment within a cell is based off the calculated |
| 956 // height, which becomes irrelevant once the cell has | 954 // height, which becomes irrelevant once the cell has |
| 957 // been resized based off its percentage. | 955 // been resized based off its percentage. |
| 958 cell->setOverrideLogicalContentHeightFromRowHeight(rHeight); | 956 cell->setOverrideLogicalContentHeightFromRowHeight(rHeight); |
| 959 cell->forceChildLayout(); | 957 cell->forceChildLayout(); |
| 960 | 958 |
| 961 // If the baseline moved, we may have to update the data for our
row. Find out the new baseline. | 959 // If the baseline moved, we may have to update the data for our
row. Find out the new baseline. |
| 962 if (cell->isBaselineAligned()) { | 960 if (cell->isBaselineAligned()) { |
| 963 LayoutUnit baseline = cell->cellBaselinePosition(); | 961 LayoutUnit baseline = cell->cellBaselinePosition(); |
| 964 if (baseline > cell->borderBefore() + cell->paddingBefore()) | 962 if (baseline > cell->borderBefore() + cell->paddingBefore()) |
| 965 m_grid[r].baseline = max(m_grid[r].baseline, baseline); | 963 m_grid[r].baseline = std::max(m_grid[r].baseline, baseli
ne); |
| 966 } | 964 } |
| 967 } | 965 } |
| 968 | 966 |
| 969 SubtreeLayoutScope layouter(*cell); | 967 SubtreeLayoutScope layouter(*cell); |
| 970 cell->computeIntrinsicPadding(rHeight, layouter); | 968 cell->computeIntrinsicPadding(rHeight, layouter); |
| 971 | 969 |
| 972 LayoutRect oldCellRect = cell->frameRect(); | 970 LayoutRect oldCellRect = cell->frameRect(); |
| 973 | 971 |
| 974 setLogicalPositionForCell(cell, c); | 972 setLogicalPositionForCell(cell, c); |
| 975 | 973 |
| 976 if (!cell->needsLayout()) | 974 if (!cell->needsLayout()) |
| 977 cell->markForPaginationRelayoutIfNeeded(layouter); | 975 cell->markForPaginationRelayoutIfNeeded(layouter); |
| 978 | 976 |
| 979 cell->layoutIfNeeded(); | 977 cell->layoutIfNeeded(); |
| 980 | 978 |
| 981 // FIXME: Make pagination work with vertical tables. | 979 // FIXME: Make pagination work with vertical tables. |
| 982 if (view()->layoutState()->pageLogicalHeight() && cell->logicalHeigh
t() != rHeight) { | 980 if (view()->layoutState()->pageLogicalHeight() && cell->logicalHeigh
t() != rHeight) { |
| 983 // FIXME: Pagination might have made us change size. For now jus
t shrink or grow the cell to fit without doing a relayout. | 981 // FIXME: Pagination might have made us change size. For now jus
t shrink or grow the cell to fit without doing a relayout. |
| 984 // 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 | 982 // 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 |
| 985 // either. It's at least stable though and won't result in an in
finite # of relayouts that may never stabilize. | 983 // either. It's at least stable though and won't result in an in
finite # of relayouts that may never stabilize. |
| 986 LayoutUnit oldLogicalHeight = cell->logicalHeight(); | 984 LayoutUnit oldLogicalHeight = cell->logicalHeight(); |
| 987 if (oldLogicalHeight > rHeight) | 985 if (oldLogicalHeight > rHeight) |
| 988 rowHeightIncreaseForPagination = max<int>(rowHeightIncreaseF
orPagination, oldLogicalHeight - rHeight); | 986 rowHeightIncreaseForPagination = std::max<int>(rowHeightIncr
easeForPagination, oldLogicalHeight - rHeight); |
| 989 cell->setLogicalHeight(rHeight); | 987 cell->setLogicalHeight(rHeight); |
| 990 cell->computeOverflow(oldLogicalHeight, false); | 988 cell->computeOverflow(oldLogicalHeight, false); |
| 991 } | 989 } |
| 992 | 990 |
| 993 LayoutSize childOffset(cell->location() - oldCellRect.location()); | 991 LayoutSize childOffset(cell->location() - oldCellRect.location()); |
| 994 if (childOffset.width() || childOffset.height()) { | 992 if (childOffset.width() || childOffset.height()) { |
| 995 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) | 993 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) |
| 996 view()->addLayoutDelta(childOffset); | 994 view()->addLayoutDelta(childOffset); |
| 997 | 995 |
| 998 // If the child moved, we have to repaint it as well as any floa
ting/positioned | 996 // If the child moved, we have to repaint it as well as any floa
ting/positioned |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 if (firstLineBaseline) | 1188 if (firstLineBaseline) |
| 1191 return firstLineBaseline + m_rowPos[0]; | 1189 return firstLineBaseline + m_rowPos[0]; |
| 1192 | 1190 |
| 1193 firstLineBaseline = -1; | 1191 firstLineBaseline = -1; |
| 1194 const Row& firstRow = m_grid[0].row; | 1192 const Row& firstRow = m_grid[0].row; |
| 1195 for (size_t i = 0; i < firstRow.size(); ++i) { | 1193 for (size_t i = 0; i < firstRow.size(); ++i) { |
| 1196 const CellStruct& cs = firstRow.at(i); | 1194 const CellStruct& cs = firstRow.at(i); |
| 1197 const RenderTableCell* cell = cs.primaryCell(); | 1195 const RenderTableCell* cell = cs.primaryCell(); |
| 1198 // Only cells with content have a baseline | 1196 // Only cells with content have a baseline |
| 1199 if (cell && cell->contentLogicalHeight()) | 1197 if (cell && cell->contentLogicalHeight()) |
| 1200 firstLineBaseline = max<int>(firstLineBaseline, cell->logicalTop() +
cell->paddingBefore() + cell->borderBefore() + cell->contentLogicalHeight()); | 1198 firstLineBaseline = std::max<int>(firstLineBaseline, cell->logicalTo
p() + cell->paddingBefore() + cell->borderBefore() + cell->contentLogicalHeight(
)); |
| 1201 } | 1199 } |
| 1202 | 1200 |
| 1203 return firstLineBaseline; | 1201 return firstLineBaseline; |
| 1204 } | 1202 } |
| 1205 | 1203 |
| 1206 void RenderTableSection::paint(PaintInfo& paintInfo, const LayoutPoint& paintOff
set) | 1204 void RenderTableSection::paint(PaintInfo& paintInfo, const LayoutPoint& paintOff
set) |
| 1207 { | 1205 { |
| 1208 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); | 1206 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); |
| 1209 | 1207 |
| 1210 ASSERT(!needsLayout()); | 1208 ASSERT(!needsLayout()); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1673 | 1671 |
| 1674 return false; | 1672 return false; |
| 1675 } | 1673 } |
| 1676 | 1674 |
| 1677 void RenderTableSection::removeCachedCollapsedBorders(const RenderTableCell* cel
l) | 1675 void RenderTableSection::removeCachedCollapsedBorders(const RenderTableCell* cel
l) |
| 1678 { | 1676 { |
| 1679 if (!table()->collapseBorders()) | 1677 if (!table()->collapseBorders()) |
| 1680 return; | 1678 return; |
| 1681 | 1679 |
| 1682 for (int side = CBSBefore; side <= CBSEnd; ++side) | 1680 for (int side = CBSBefore; side <= CBSEnd; ++side) |
| 1683 m_cellsCollapsedBorders.remove(make_pair(cell, side)); | 1681 m_cellsCollapsedBorders.remove(std::make_pair(cell, side)); |
| 1684 } | 1682 } |
| 1685 | 1683 |
| 1686 void RenderTableSection::setCachedCollapsedBorder(const RenderTableCell* cell, C
ollapsedBorderSide side, CollapsedBorderValue border) | 1684 void RenderTableSection::setCachedCollapsedBorder(const RenderTableCell* cell, C
ollapsedBorderSide side, CollapsedBorderValue border) |
| 1687 { | 1685 { |
| 1688 ASSERT(table()->collapseBorders()); | 1686 ASSERT(table()->collapseBorders()); |
| 1689 m_cellsCollapsedBorders.set(make_pair(cell, side), border); | 1687 m_cellsCollapsedBorders.set(std::make_pair(cell, side), border); |
| 1690 } | 1688 } |
| 1691 | 1689 |
| 1692 CollapsedBorderValue& RenderTableSection::cachedCollapsedBorder(const RenderTabl
eCell* cell, CollapsedBorderSide side) | 1690 CollapsedBorderValue& RenderTableSection::cachedCollapsedBorder(const RenderTabl
eCell* cell, CollapsedBorderSide side) |
| 1693 { | 1691 { |
| 1694 ASSERT(table()->collapseBorders()); | 1692 ASSERT(table()->collapseBorders()); |
| 1695 HashMap<pair<const RenderTableCell*, int>, CollapsedBorderValue>::iterator i
t = m_cellsCollapsedBorders.find(make_pair(cell, side)); | 1693 HashMap<pair<const RenderTableCell*, int>, CollapsedBorderValue>::iterator i
t = m_cellsCollapsedBorders.find(std::make_pair(cell, side)); |
| 1696 ASSERT_WITH_SECURITY_IMPLICATION(it != m_cellsCollapsedBorders.end()); | 1694 ASSERT_WITH_SECURITY_IMPLICATION(it != m_cellsCollapsedBorders.end()); |
| 1697 return it->value; | 1695 return it->value; |
| 1698 } | 1696 } |
| 1699 | 1697 |
| 1700 RenderTableSection* RenderTableSection::createAnonymousWithParentRenderer(const
RenderObject* parent) | 1698 RenderTableSection* RenderTableSection::createAnonymousWithParentRenderer(const
RenderObject* parent) |
| 1701 { | 1699 { |
| 1702 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), TABLE_ROW_GROUP); | 1700 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), TABLE_ROW_GROUP); |
| 1703 RenderTableSection* newSection = new RenderTableSection(0); | 1701 RenderTableSection* newSection = new RenderTableSection(0); |
| 1704 newSection->setDocumentForAnonymous(&parent->document()); | 1702 newSection->setDocumentForAnonymous(&parent->document()); |
| 1705 newSection->setStyle(newStyle.release()); | 1703 newSection->setStyle(newStyle.release()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1719 else | 1717 else |
| 1720 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont
alBorderSpacing); | 1718 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont
alBorderSpacing); |
| 1721 | 1719 |
| 1722 cell->setLogicalLocation(cellLocation); | 1720 cell->setLogicalLocation(cellLocation); |
| 1723 | 1721 |
| 1724 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) | 1722 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) |
| 1725 view()->addLayoutDelta(oldCellLocation - cell->location()); | 1723 view()->addLayoutDelta(oldCellLocation - cell->location()); |
| 1726 } | 1724 } |
| 1727 | 1725 |
| 1728 } // namespace WebCore | 1726 } // namespace WebCore |
| OLD | NEW |