| 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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 ASSERT(!table()->needsSectionRecalc()); | 936 ASSERT(!table()->needsSectionRecalc()); |
| 937 | 937 |
| 938 // addChild may over-grow m_grid but we don't want to throw away the memory | 938 // addChild may over-grow m_grid but we don't want to throw away the memory |
| 939 // too early as addChild can be called in a loop (e.g during parsing). Doing | 939 // too early as addChild can be called in a loop (e.g during parsing). Doing |
| 940 // it now ensures we have a stable-enough structure. | 940 // it now ensures we have a stable-enough structure. |
| 941 m_grid.shrinkToFit(); | 941 m_grid.shrinkToFit(); |
| 942 | 942 |
| 943 LayoutState state(*this, locationOffset()); | 943 LayoutState state(*this, locationOffset()); |
| 944 | 944 |
| 945 const Vector<int>& columnPos = table()->effectiveColumnPositions(); | 945 const Vector<int>& columnPos = table()->effectiveColumnPositions(); |
| 946 LayoutUnit rowLogicalTop; |
| 946 | 947 |
| 947 SubtreeLayoutScope layouter(*this); | 948 SubtreeLayoutScope layouter(*this); |
| 948 for (unsigned r = 0; r < m_grid.size(); ++r) { | 949 for (unsigned r = 0; r < m_grid.size(); ++r) { |
| 949 Row& row = m_grid[r].row; | 950 Row& row = m_grid[r].row; |
| 950 unsigned cols = row.size(); | 951 unsigned cols = row.size(); |
| 951 // First, propagate our table layout's information to the cells. This will | 952 // First, propagate our table layout's information to the cells. This will |
| 952 // mark the row as needing layout if there was a column logical width | 953 // mark the row as needing layout if there was a column logical width |
| 953 // change. | 954 // change. |
| 954 for (unsigned startColumn = 0; startColumn < cols; ++startColumn) { | 955 for (unsigned startColumn = 0; startColumn < cols; ++startColumn) { |
| 955 CellStruct& current = row[startColumn]; | 956 CellStruct& current = row[startColumn]; |
| 956 LayoutTableCell* cell = current.primaryCell(); | 957 LayoutTableCell* cell = current.primaryCell(); |
| 957 if (!cell || current.inColSpan) | 958 if (!cell || current.inColSpan) |
| 958 continue; | 959 continue; |
| 959 | 960 |
| 960 unsigned endCol = startColumn; | 961 unsigned endCol = startColumn; |
| 961 unsigned cspan = cell->colSpan(); | 962 unsigned cspan = cell->colSpan(); |
| 962 while (cspan && endCol < cols) { | 963 while (cspan && endCol < cols) { |
| 963 ASSERT(endCol < table()->effectiveColumns().size()); | 964 ASSERT(endCol < table()->effectiveColumns().size()); |
| 964 cspan -= table()->effectiveColumns()[endCol].span; | 965 cspan -= table()->effectiveColumns()[endCol].span; |
| 965 endCol++; | 966 endCol++; |
| 966 } | 967 } |
| 967 int tableLayoutLogicalWidth = columnPos[endCol] - columnPos[startColumn] - | 968 int tableLayoutLogicalWidth = columnPos[endCol] - columnPos[startColumn] - |
| 968 table()->hBorderSpacing(); | 969 table()->hBorderSpacing(); |
| 969 cell->setCellLogicalWidth(tableLayoutLogicalWidth, layouter); | 970 cell->setCellLogicalWidth(tableLayoutLogicalWidth, layouter); |
| 970 } | 971 } |
| 971 | 972 |
| 972 if (LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject) { | 973 if (LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject) { |
| 973 if (!rowLayoutObject->needsLayout()) | 974 if (state.isPaginated()) { |
| 974 markChildForPaginationRelayoutIfNeeded(*rowLayoutObject, layouter); | 975 rowLayoutObject->setLogicalTop(rowLogicalTop); |
| 976 if (!rowLayoutObject->needsLayout()) |
| 977 markChildForPaginationRelayoutIfNeeded(*rowLayoutObject, layouter); |
| 978 } |
| 975 rowLayoutObject->layoutIfNeeded(); | 979 rowLayoutObject->layoutIfNeeded(); |
| 980 if (state.isPaginated()) { |
| 981 rowLayoutObject->setLogicalHeight( |
| 982 LayoutUnit(logicalHeightForRow(*rowLayoutObject))); |
| 983 rowLogicalTop = rowLayoutObject->logicalBottom(); |
| 984 rowLogicalTop += LayoutUnit(table()->vBorderSpacing()); |
| 985 } |
| 976 } | 986 } |
| 977 } | 987 } |
| 978 | 988 |
| 979 clearNeedsLayout(); | 989 clearNeedsLayout(); |
| 980 } | 990 } |
| 981 | 991 |
| 982 void LayoutTableSection::distributeExtraLogicalHeightToPercentRows( | 992 void LayoutTableSection::distributeExtraLogicalHeightToPercentRows( |
| 983 int& extraLogicalHeight, | 993 int& extraLogicalHeight, |
| 984 int totalPercent) { | 994 int totalPercent) { |
| 985 if (!totalPercent) | 995 if (!totalPercent) |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1968 | 1978 |
| 1969 // If the baseline moved, we may have to update the data for our row. Find | 1979 // If the baseline moved, we may have to update the data for our row. Find |
| 1970 // out the new baseline. | 1980 // out the new baseline. |
| 1971 if (cell.isBaselineAligned()) { | 1981 if (cell.isBaselineAligned()) { |
| 1972 int baseline = cell.cellBaselinePosition(); | 1982 int baseline = cell.cellBaselinePosition(); |
| 1973 if (baseline > cell.borderBefore() + cell.paddingBefore()) | 1983 if (baseline > cell.borderBefore() + cell.paddingBefore()) |
| 1974 m_grid[rowIndex].baseline = std::max(m_grid[rowIndex].baseline, baseline); | 1984 m_grid[rowIndex].baseline = std::max(m_grid[rowIndex].baseline, baseline); |
| 1975 } | 1985 } |
| 1976 } | 1986 } |
| 1977 | 1987 |
| 1988 int LayoutTableSection::logicalHeightForRow( |
| 1989 const LayoutTableRow& rowObject) const { |
| 1990 unsigned rowIndex = rowObject.rowIndex(); |
| 1991 int logicalHeight = 0; |
| 1992 const Row& row = m_grid[rowIndex].row; |
| 1993 unsigned cols = row.size(); |
| 1994 for (unsigned colIndex = 0; colIndex < cols; colIndex++) { |
| 1995 const CellStruct& cellStruct = cellAt(rowIndex, colIndex); |
| 1996 const LayoutTableCell* cell = cellStruct.primaryCell(); |
| 1997 if (!cell || cellStruct.inColSpan) |
| 1998 continue; |
| 1999 // TODO(mstensho): Rowspanned cells also need to contribute to row heights |
| 2000 // during the first layout pass, in order to get fragmentation right. |
| 2001 if (cell->rowSpan() == 1) { |
| 2002 logicalHeight = |
| 2003 std::max(logicalHeight, cell->logicalHeightForRowSizing()); |
| 2004 } |
| 2005 } |
| 2006 return logicalHeight; |
| 2007 } |
| 2008 |
| 1978 bool LayoutTableSection::isRepeatingHeaderGroup() const { | 2009 bool LayoutTableSection::isRepeatingHeaderGroup() const { |
| 1979 if (getPaginationBreakability() == LayoutBox::AllowAnyBreaks) | 2010 if (getPaginationBreakability() == LayoutBox::AllowAnyBreaks) |
| 1980 return false; | 2011 return false; |
| 1981 // TODO(rhogan): Should we paint a header repeatedly if it's self-painting? | 2012 // TODO(rhogan): Should we paint a header repeatedly if it's self-painting? |
| 1982 if (hasSelfPaintingLayer()) | 2013 if (hasSelfPaintingLayer()) |
| 1983 return false; | 2014 return false; |
| 1984 LayoutUnit pageHeight = table()->pageLogicalHeightForOffset(LayoutUnit()); | 2015 LayoutUnit pageHeight = table()->pageLogicalHeightForOffset(LayoutUnit()); |
| 1985 if (!pageHeight) | 2016 if (!pageHeight) |
| 1986 return false; | 2017 return false; |
| 1987 | 2018 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2011 // the header in all columns. | 2042 // the header in all columns. |
| 2012 // Note that this is in flow thread coordinates, not visual coordinates. The | 2043 // Note that this is in flow thread coordinates, not visual coordinates. The |
| 2013 // enclosing LayoutFlowThread will convert to visual coordinates. | 2044 // enclosing LayoutFlowThread will convert to visual coordinates. |
| 2014 if (table()->header() == this && isRepeatingHeaderGroup()) | 2045 if (table()->header() == this && isRepeatingHeaderGroup()) |
| 2015 rect.setHeight(table()->logicalHeight()); | 2046 rect.setHeight(table()->logicalHeight()); |
| 2016 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect, | 2047 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect, |
| 2017 flags); | 2048 flags); |
| 2018 } | 2049 } |
| 2019 | 2050 |
| 2020 } // namespace blink | 2051 } // namespace blink |
| OLD | NEW |