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 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1253 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); | 1253 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); |
1254 if (!pageLogicalHeight) | 1254 if (!pageLogicalHeight) |
1255 return 0; | 1255 return 0; |
1256 // If the row is too tall for the page don't insert a strut. | 1256 // If the row is too tall for the page don't insert a strut. |
1257 LayoutUnit rowLogicalHeight = row->logicalHeight(); | 1257 LayoutUnit rowLogicalHeight = row->logicalHeight(); |
1258 if (rowLogicalHeight > pageLogicalHeight) | 1258 if (rowLogicalHeight > pageLogicalHeight) |
1259 return 0; | 1259 return 0; |
1260 | 1260 |
1261 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset( | 1261 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset( |
1262 logicalOffset, LayoutBlock::AssociateWithLatterPage); | 1262 logicalOffset, LayoutBlock::AssociateWithLatterPage); |
1263 LayoutUnit offsetForBorderSpacing = | |
1264 pageLogicalHeight - (remainingLogicalHeight + table()->vBorderSpacing()); | |
1265 // Border spacing from the previous row has pushed this row just past the top | |
1266 // of the page, so we must reposition it to the top of the page and avoid any | |
1267 // repeating header. | |
1268 if (offsetForBorderSpacing < 0) | |
1269 return offsetForBorderSpacing.toInt(); | |
1270 | |
1271 if (remainingLogicalHeight >= rowLogicalHeight) | 1263 if (remainingLogicalHeight >= rowLogicalHeight) |
1272 return 0; // It fits fine where it is. No need to break. | 1264 return 0; // It fits fine where it is. No need to break. |
1273 LayoutUnit paginationStrut = calculatePaginationStrutToFitContent( | 1265 LayoutUnit paginationStrut = calculatePaginationStrutToFitContent( |
1274 logicalOffset, remainingLogicalHeight, rowLogicalHeight); | 1266 logicalOffset, remainingLogicalHeight, rowLogicalHeight); |
1275 if (paginationStrut == remainingLogicalHeight && | 1267 if (paginationStrut == remainingLogicalHeight && |
1276 remainingLogicalHeight == pageLogicalHeight) { | 1268 remainingLogicalHeight == pageLogicalHeight) { |
1277 // Don't break if we were at the top of a page, and we failed to fit the | 1269 // Don't break if we were at the top of a page, and we failed to fit the |
1278 // content completely. No point in leaving a page completely blank. | 1270 // content completely. No point in leaving a page completely blank. |
1279 return 0; | 1271 return 0; |
1280 } | 1272 } |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1983 return logicalHeight; | 1975 return logicalHeight; |
1984 } | 1976 } |
1985 | 1977 |
1986 void LayoutTableSection::adjustRowForPagination(LayoutTableRow& rowObject, | 1978 void LayoutTableSection::adjustRowForPagination(LayoutTableRow& rowObject, |
1987 SubtreeLayoutScope& layouter) { | 1979 SubtreeLayoutScope& layouter) { |
1988 LayoutState& state = *view()->layoutState(); | 1980 LayoutState& state = *view()->layoutState(); |
1989 rowObject.setPaginationStrut(LayoutUnit()); | 1981 rowObject.setPaginationStrut(LayoutUnit()); |
1990 rowObject.setLogicalHeight(LayoutUnit(logicalHeightForRow(rowObject))); | 1982 rowObject.setLogicalHeight(LayoutUnit(logicalHeightForRow(rowObject))); |
1991 int paginationStrut = | 1983 int paginationStrut = |
1992 paginationStrutForRow(&rowObject, rowObject.logicalTop()); | 1984 paginationStrutForRow(&rowObject, rowObject.logicalTop()); |
1985 bool rowIsAtTopOfColumn = false; | |
1986 LayoutUnit offsetFromTopOfPage; | |
1993 if (!paginationStrut) { | 1987 if (!paginationStrut) { |
1994 bool rowIsAtTopOfColumn = | 1988 if (state.heightOffsetForTableHeaders()) { |
mstensho (USE GERRIT)
2016/10/24 08:39:35
Yeah, we used to check for this before your change
| |
1995 state.heightOffsetForTableHeaders() && | 1989 offsetFromTopOfPage = |
1996 pageLogicalHeightForOffset(rowObject.logicalTop()) == | 1990 pageLogicalHeightForOffset(rowObject.logicalTop()) - |
1997 pageRemainingLogicalHeightForOffset(rowObject.logicalTop(), | 1991 pageRemainingLogicalHeightForOffset(rowObject.logicalTop(), |
mstensho (USE GERRIT)
2016/10/24 08:39:35
It's not allowed to call pageRemainingLogicalHeigh
| |
1998 AssociateWithLatterPage); | 1992 AssociateWithLatterPage); |
1993 rowIsAtTopOfColumn = !offsetFromTopOfPage || | |
1994 offsetFromTopOfPage <= table()->vBorderSpacing(); | |
1995 } | |
1996 | |
1999 if (!rowIsAtTopOfColumn) | 1997 if (!rowIsAtTopOfColumn) |
2000 return; | 1998 return; |
2001 } | 1999 } |
2002 // We need to push this row to the next fragmentainer. If there are repeated | 2000 // We need to push this row to the next fragmentainer. If there are repeated |
2003 // table headers, we need to make room for those at the top of the next | 2001 // table headers, we need to make room for those at the top of the next |
2004 // fragmentainer, above this row. Otherwise, this row will just go at the top | 2002 // fragmentainer, above this row. Otherwise, this row will just go at the top |
2005 // of the next fragmentainer. | 2003 // of the next fragmentainer. |
2006 | 2004 |
2007 // If there isn't room for at least one content row on a page with a | 2005 // If there isn't room for at least one content row on a page with a |
2008 // header group, then we won't repeat the header on each page. | 2006 // header group, then we won't repeat the header on each page. |
2009 LayoutTableSection* header = table()->header(); | 2007 LayoutTableSection* header = table()->header(); |
2010 if (!rowObject.rowIndex() && header && | 2008 if (!rowObject.rowIndex() && header && |
2011 table()->sectionAbove(this) == header && | 2009 table()->sectionAbove(this) == header && |
2012 header->getPaginationBreakability() != AllowAnyBreaks) { | 2010 header->getPaginationBreakability() != AllowAnyBreaks) { |
2013 state.setHeightOffsetForTableHeaders(state.heightOffsetForTableHeaders() - | 2011 state.setHeightOffsetForTableHeaders(state.heightOffsetForTableHeaders() - |
2014 header->logicalHeight()); | 2012 header->logicalHeight()); |
2015 } | 2013 } |
2016 // If we have a header group we will paint it at the top of each page, | 2014 // If we have a header group we will paint it at the top of each page, |
2017 // move the rows down to accomodate it. | 2015 // move the rows down to accomodate it. |
2016 if (rowIsAtTopOfColumn && offsetFromTopOfPage) | |
2017 paginationStrut -= offsetFromTopOfPage.toInt(); | |
2018 | |
mstensho (USE GERRIT)
2016/10/24 08:39:35
Better delete this blank line, so that it's a bit
| |
2018 paginationStrut += state.heightOffsetForTableHeaders().toInt(); | 2019 paginationStrut += state.heightOffsetForTableHeaders().toInt(); |
2019 rowObject.setPaginationStrut(LayoutUnit(paginationStrut)); | 2020 rowObject.setPaginationStrut(LayoutUnit(paginationStrut)); |
2020 | 2021 |
2021 // We have inserted a pagination strut before the row. Adjust the logical top | 2022 // We have inserted a pagination strut before the row. Adjust the logical top |
2022 // and re-lay out. We no longer want to break inside the row, but rather | 2023 // and re-lay out. We no longer want to break inside the row, but rather |
2023 // *before* it. From the previous layout pass, there are most likely | 2024 // *before* it. From the previous layout pass, there are most likely |
2024 // pagination struts inside some cell in this row that we need to get rid of. | 2025 // pagination struts inside some cell in this row that we need to get rid of. |
2025 rowObject.setLogicalTop(rowObject.logicalTop() + paginationStrut); | 2026 rowObject.setLogicalTop(rowObject.logicalTop() + paginationStrut); |
2026 layouter.setChildNeedsLayout(&rowObject); | 2027 layouter.setChildNeedsLayout(&rowObject); |
2027 rowObject.layoutIfNeeded(); | 2028 rowObject.layoutIfNeeded(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2067 // the header in all columns. | 2068 // the header in all columns. |
2068 // Note that this is in flow thread coordinates, not visual coordinates. The | 2069 // Note that this is in flow thread coordinates, not visual coordinates. The |
2069 // enclosing LayoutFlowThread will convert to visual coordinates. | 2070 // enclosing LayoutFlowThread will convert to visual coordinates. |
2070 if (table()->header() == this && isRepeatingHeaderGroup()) | 2071 if (table()->header() == this && isRepeatingHeaderGroup()) |
2071 rect.setHeight(table()->logicalHeight()); | 2072 rect.setHeight(table()->logicalHeight()); |
2072 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect, | 2073 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect, |
2073 flags); | 2074 flags); |
2074 } | 2075 } |
2075 | 2076 |
2076 } // namespace blink | 2077 } // namespace blink |
OLD | NEW |