Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTableSection.cpp

Issue 2388613002: Move below headers even when row doesn't require a strut (Closed)
Patch Set: bug 642814 Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 if (rowLayoutObject) { 1095 if (rowLayoutObject) {
1096 rowLayoutObject->setLocation(LayoutPoint(0, m_rowPos[r])); 1096 rowLayoutObject->setLocation(LayoutPoint(0, m_rowPos[r]));
1097 rowLayoutObject->setLogicalWidth(logicalWidth()); 1097 rowLayoutObject->setLogicalWidth(logicalWidth());
1098 rowLayoutObject->setLogicalHeight( 1098 rowLayoutObject->setLogicalHeight(
1099 LayoutUnit(m_rowPos[r + 1] - m_rowPos[r] - vspacing)); 1099 LayoutUnit(m_rowPos[r + 1] - m_rowPos[r] - vspacing));
1100 rowLayoutObject->updateLayerTransformAfterLayout(); 1100 rowLayoutObject->updateLayerTransformAfterLayout();
1101 if (isPaginated) { 1101 if (isPaginated) {
1102 paginationStrutOnRow = 1102 paginationStrutOnRow =
1103 paginationStrutForRow(rowLayoutObject, LayoutUnit(m_rowPos[r])); 1103 paginationStrutForRow(rowLayoutObject, LayoutUnit(m_rowPos[r]));
1104 rowLayoutObject->setPaginationStrut(LayoutUnit(paginationStrutOnRow)); 1104 rowLayoutObject->setPaginationStrut(LayoutUnit(paginationStrutOnRow));
1105 if (paginationStrutOnRow) { 1105 bool rowIsAtTopOfColumn =
1106 pageRemainingLogicalHeightForOffset(
1107 LayoutUnit(m_rowPos[r]),
1108 LayoutBlock::AssociateWithLatterPage) ==
mstensho (USE GERRIT) 2016/10/05 18:21:11 LayoutBlock:: prefix not necessary.
1109 pageLogicalHeightForOffset(LayoutUnit(m_rowPos[r]));
1110 if (paginationStrutOnRow ||
1111 (state.heightOffsetForTableHeaders() && rowIsAtTopOfColumn)) {
1106 // If there isn't room for at least one content row on a page with a h eader group, then 1112 // If there isn't room for at least one content row on a page with a h eader group, then
1107 // we won't repeat the header on each page. 1113 // we won't repeat the header on each page.
1108 if (!r && table()->header() && 1114 if (!r && table()->header() &&
1109 table()->sectionAbove(this) == table()->header() && 1115 table()->sectionAbove(this) == table()->header() &&
1110 table()->header()->getPaginationBreakability() != AllowAnyBreaks) 1116 table()->header()->getPaginationBreakability() != AllowAnyBreaks)
1111 state.setHeightOffsetForTableHeaders( 1117 state.setHeightOffsetForTableHeaders(
1112 state.heightOffsetForTableHeaders() - 1118 state.heightOffsetForTableHeaders() -
1113 table()->header()->logicalHeight()); 1119 table()->header()->logicalHeight());
1114 // If we have a header group we will paint it at the top of each page, move the rows 1120 // If we have a header group we will paint it at the top of each page, move the rows
1115 // down to accomodate it. 1121 // down to accomodate it.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 if (row->getPaginationBreakability() == AllowAnyBreaks && 1266 if (row->getPaginationBreakability() == AllowAnyBreaks &&
1261 !tableHeaderForcesStrut) 1267 !tableHeaderForcesStrut)
1262 return 0; 1268 return 0;
1263 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); 1269 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
1264 if (!pageLogicalHeight) 1270 if (!pageLogicalHeight)
1265 return 0; 1271 return 0;
1266 // If the row is too tall for the page don't insert a strut. 1272 // If the row is too tall for the page don't insert a strut.
1267 LayoutUnit rowLogicalHeight = row->logicalHeight(); 1273 LayoutUnit rowLogicalHeight = row->logicalHeight();
1268 if (rowLogicalHeight > pageLogicalHeight) 1274 if (rowLogicalHeight > pageLogicalHeight)
1269 return 0; 1275 return 0;
1276
1270 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset( 1277 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(
1271 logicalOffset, LayoutBlock::AssociateWithLatterPage); 1278 logicalOffset, LayoutBlock::AssociateWithLatterPage);
1279 LayoutUnit offsetForBorderSpacing =
1280 pageLogicalHeight - (remainingLogicalHeight + table()->vBorderSpacing());
1281 // Border spacing from the previous row has pushed this row just past the top
1282 // of the page, so we must reposition it to the top of the page and avoid any
1283 // repeating header.
1284 if (offsetForBorderSpacing < 0)
1285 return offsetForBorderSpacing.toInt();
1286
1272 if (remainingLogicalHeight >= rowLogicalHeight) 1287 if (remainingLogicalHeight >= rowLogicalHeight)
1273 return 0; // It fits fine where it is. No need to break. 1288 return 0; // It fits fine where it is. No need to break.
1274 LayoutUnit paginationStrut = calculatePaginationStrutToFitContent( 1289 LayoutUnit paginationStrut = calculatePaginationStrutToFitContent(
1275 logicalOffset, remainingLogicalHeight, rowLogicalHeight); 1290 logicalOffset, remainingLogicalHeight, rowLogicalHeight);
1276 if (paginationStrut == remainingLogicalHeight && 1291 if (paginationStrut == remainingLogicalHeight &&
1277 remainingLogicalHeight == pageLogicalHeight) { 1292 remainingLogicalHeight == pageLogicalHeight) {
1278 // Don't break if we were at the top of a page, and we failed to fit the con tent 1293 // Don't break if we were at the top of a page, and we failed to fit the con tent
1279 // completely. No point in leaving a page completely blank. 1294 // completely. No point in leaving a page completely blank.
1280 return 0; 1295 return 0;
1281 } 1296 }
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 // Repeating table headers are painted once per fragmentation page/column. Thi s does not go through the regular fragmentation machinery, 1947 // Repeating table headers are painted once per fragmentation page/column. Thi s does not go through the regular fragmentation machinery,
1933 // so we need special code to expand the invalidation rect to contain all posi tions of the header in all columns. 1948 // so we need special code to expand the invalidation rect to contain all posi tions of the header in all columns.
1934 // Note that this is in flow thread coordinates, not visual coordinates. The e nclosing LayoutFlowThread will convert to visual coordinates. 1949 // Note that this is in flow thread coordinates, not visual coordinates. The e nclosing LayoutFlowThread will convert to visual coordinates.
1935 if (table()->header() == this && isRepeatingHeaderGroup()) 1950 if (table()->header() == this && isRepeatingHeaderGroup())
1936 rect.setHeight(table()->logicalHeight()); 1951 rect.setHeight(table()->logicalHeight());
1937 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect, 1952 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect,
1938 flags); 1953 flags);
1939 } 1954 }
1940 1955
1941 } // namespace blink 1956 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fragmentation/single-line-cells-repeating-thead-starts-middle-of-page-break-after-avoid-3-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698