| 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. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. |
| 8 * All rights reserved. | 8 * All rights reserved. |
| 9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 10 * | 10 * |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 m_rowPos.resize(m_grid.size() + 1); | 845 m_rowPos.resize(m_grid.size() + 1); |
| 846 | 846 |
| 847 // We ignore the border-spacing on any non-top section as it is already | 847 // We ignore the border-spacing on any non-top section as it is already |
| 848 // included in the previous section's last row position. | 848 // included in the previous section's last row position. |
| 849 if (this == table()->topSection()) | 849 if (this == table()->topSection()) |
| 850 m_rowPos[0] = table()->vBorderSpacing(); | 850 m_rowPos[0] = table()->vBorderSpacing(); |
| 851 else | 851 else |
| 852 m_rowPos[0] = 0; | 852 m_rowPos[0] = 0; |
| 853 | 853 |
| 854 SpanningLayoutTableCells rowSpanCells; | 854 SpanningLayoutTableCells rowSpanCells; |
| 855 #if ENABLE(ASSERT) | |
| 856 HashSet<const LayoutTableCell*> uniqueCells; | |
| 857 #endif | |
| 858 | 855 |
| 859 for (unsigned r = 0; r < m_grid.size(); r++) { | 856 for (unsigned r = 0; r < m_grid.size(); r++) { |
| 860 m_grid[r].baseline = -1; | 857 m_grid[r].baseline = -1; |
| 861 int baselineDescent = 0; | 858 int baselineDescent = 0; |
| 862 | 859 |
| 863 if (state.isPaginated() && m_grid[r].rowLayoutObject) | 860 if (state.isPaginated() && m_grid[r].rowLayoutObject) |
| 864 m_rowPos[r] += m_grid[r].rowLayoutObject->paginationStrut().ceil(); | 861 m_rowPos[r] += m_grid[r].rowLayoutObject->paginationStrut().ceil(); |
| 865 | 862 |
| 866 if (m_grid[r].logicalHeight.isSpecified()) { | 863 if (m_grid[r].logicalHeight.isSpecified()) { |
| 867 // Our base size is the biggest logical height from our cells' styles | 864 // Our base size is the biggest logical height from our cells' styles |
| 868 // (excluding row spanning cells). | 865 // (excluding row spanning cells). |
| 869 m_rowPos[r + 1] = std::max( | 866 m_rowPos[r + 1] = std::max( |
| 870 m_rowPos[r] + | 867 m_rowPos[r] + |
| 871 minimumValueForLength(m_grid[r].logicalHeight, LayoutUnit()) | 868 minimumValueForLength(m_grid[r].logicalHeight, LayoutUnit()) |
| 872 .round(), | 869 .round(), |
| 873 0); | 870 0); |
| 874 } else { | 871 } else { |
| 875 // Non-specified lengths are ignored because the row already accounts for | 872 // Non-specified lengths are ignored because the row already accounts for |
| 876 // the cells intrinsic logical height. | 873 // the cells intrinsic logical height. |
| 877 m_rowPos[r + 1] = std::max(m_rowPos[r], 0); | 874 m_rowPos[r + 1] = std::max(m_rowPos[r], 0); |
| 878 } | 875 } |
| 879 | 876 |
| 880 Row& row = m_grid[r].row; | 877 Row& row = m_grid[r].row; |
| 881 unsigned totalCols = row.size(); | 878 unsigned totalCols = row.size(); |
| 882 LayoutTableCell* lastRowSpanCell = nullptr; | |
| 883 | 879 |
| 884 for (unsigned c = 0; c < totalCols; c++) { | 880 for (unsigned c = 0; c < totalCols; c++) { |
| 885 CellStruct& current = cellAt(r, c); | 881 CellStruct& current = cellAt(r, c); |
| 882 if (current.inColSpan) |
| 883 continue; |
| 886 for (unsigned i = 0; i < current.cells.size(); i++) { | 884 for (unsigned i = 0; i < current.cells.size(); i++) { |
| 887 cell = current.cells[i]; | 885 cell = current.cells[i]; |
| 888 if (current.inColSpan && cell->rowSpan() == 1) | 886 |
| 887 // For row spanning cells, we only handle them for the first row they |
| 888 // span. This ensures we take their baseline into account. |
| 889 if (cell->rowIndex() != r) |
| 889 continue; | 890 continue; |
| 890 | 891 |
| 891 if (cell->rowSpan() > 1) { | 892 if (cell->rowSpan() > 1) { |
| 892 // For row spanning cells, we only handle them for the first row they | 893 DCHECK(!rowSpanCells.contains(cell)); |
| 893 // span. This ensures we take their baseline into account. | 894 rowSpanCells.append(cell); |
| 894 if (lastRowSpanCell != cell && cell->rowIndex() == r) { | |
| 895 #if ENABLE(ASSERT) | |
| 896 ASSERT(!uniqueCells.contains(cell)); | |
| 897 uniqueCells.add(cell); | |
| 898 #endif | |
| 899 | |
| 900 rowSpanCells.append(cell); | |
| 901 lastRowSpanCell = cell; | |
| 902 } | |
| 903 } | 895 } |
| 904 | 896 |
| 905 if (cell->rowIndex() == r && cell->hasOverrideLogicalContentHeight()) { | 897 if (cell->hasOverrideLogicalContentHeight()) { |
| 906 cell->clearIntrinsicPadding(); | 898 cell->clearIntrinsicPadding(); |
| 907 cell->clearOverrideSize(); | 899 cell->clearOverrideSize(); |
| 908 cell->forceChildLayout(); | 900 cell->forceChildLayout(); |
| 909 } | 901 } |
| 910 | 902 |
| 911 if (cell->rowSpan() == 1) | 903 if (cell->rowSpan() == 1) |
| 912 m_rowPos[r + 1] = std::max( | 904 m_rowPos[r + 1] = std::max( |
| 913 m_rowPos[r + 1], m_rowPos[r] + cell->logicalHeightForRowSizing()); | 905 m_rowPos[r + 1], m_rowPos[r] + cell->logicalHeightForRowSizing()); |
| 914 | 906 |
| 915 // Find out the baseline. The baseline is set on the first row in a | 907 // Find out the baseline. The baseline is set on the first row in a |
| 916 // rowSpan. | 908 // rowSpan. |
| 917 if (cell->rowIndex() == r) | 909 updateBaselineForCell(cell, r, baselineDescent); |
| 918 updateBaselineForCell(cell, r, baselineDescent); | |
| 919 } | 910 } |
| 920 } | 911 } |
| 921 | 912 |
| 922 // Add the border-spacing to our final position. | 913 // Add the border-spacing to our final position. |
| 923 m_rowPos[r + 1] += borderSpacingForRow(r); | 914 m_rowPos[r + 1] += borderSpacingForRow(r); |
| 924 m_rowPos[r + 1] = std::max(m_rowPos[r + 1], m_rowPos[r]); | 915 m_rowPos[r + 1] = std::max(m_rowPos[r + 1], m_rowPos[r]); |
| 925 } | 916 } |
| 926 | 917 |
| 927 if (!rowSpanCells.isEmpty()) | 918 if (!rowSpanCells.isEmpty()) |
| 928 distributeRowSpanHeightToRows(rowSpanCells); | 919 distributeRowSpanHeightToRows(rowSpanCells); |
| (...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2074 // the header in all columns. | 2065 // the header in all columns. |
| 2075 // Note that this is in flow thread coordinates, not visual coordinates. The | 2066 // Note that this is in flow thread coordinates, not visual coordinates. The |
| 2076 // enclosing LayoutFlowThread will convert to visual coordinates. | 2067 // enclosing LayoutFlowThread will convert to visual coordinates. |
| 2077 if (table()->header() == this && isRepeatingHeaderGroup()) | 2068 if (table()->header() == this && isRepeatingHeaderGroup()) |
| 2078 rect.setHeight(table()->logicalHeight()); | 2069 rect.setHeight(table()->logicalHeight()); |
| 2079 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect, | 2070 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect, |
| 2080 flags); | 2071 flags); |
| 2081 } | 2072 } |
| 2082 | 2073 |
| 2083 } // namespace blink | 2074 } // namespace blink |
| OLD | NEW |