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

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 state.heightOffsetForTableHeaders() &&
1107 pageRemainingLogicalHeightForOffset(LayoutUnit(m_rowPos[r]),
1108 AssociateWithLatterPage) ==
1109 pageLogicalHeightForOffset(LayoutUnit(m_rowPos[r]));
1110 if (paginationStrutOnRow || rowIsAtTopOfColumn) {
1106 // If there isn't room for at least one content row on a page with a h eader group, then 1111 // 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. 1112 // we won't repeat the header on each page.
1108 if (!r && table()->header() && 1113 if (!r && table()->header() &&
1109 table()->sectionAbove(this) == table()->header() && 1114 table()->sectionAbove(this) == table()->header() &&
1110 table()->header()->getPaginationBreakability() != AllowAnyBreaks) 1115 table()->header()->getPaginationBreakability() != AllowAnyBreaks)
1111 state.setHeightOffsetForTableHeaders( 1116 state.setHeightOffsetForTableHeaders(
1112 state.heightOffsetForTableHeaders() - 1117 state.heightOffsetForTableHeaders() -
1113 table()->header()->logicalHeight()); 1118 table()->header()->logicalHeight());
1114 // If we have a header group we will paint it at the top of each page, move the rows 1119 // If we have a header group we will paint it at the top of each page, move the rows
1115 // down to accomodate it. 1120 // down to accomodate it.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 if (row->getPaginationBreakability() == AllowAnyBreaks && 1265 if (row->getPaginationBreakability() == AllowAnyBreaks &&
1261 !tableHeaderForcesStrut) 1266 !tableHeaderForcesStrut)
1262 return 0; 1267 return 0;
1263 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); 1268 LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset);
1264 if (!pageLogicalHeight) 1269 if (!pageLogicalHeight)
1265 return 0; 1270 return 0;
1266 // If the row is too tall for the page don't insert a strut. 1271 // If the row is too tall for the page don't insert a strut.
1267 LayoutUnit rowLogicalHeight = row->logicalHeight(); 1272 LayoutUnit rowLogicalHeight = row->logicalHeight();
1268 if (rowLogicalHeight > pageLogicalHeight) 1273 if (rowLogicalHeight > pageLogicalHeight)
1269 return 0; 1274 return 0;
1275
1270 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset( 1276 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(
1271 logicalOffset, LayoutBlock::AssociateWithLatterPage); 1277 logicalOffset, LayoutBlock::AssociateWithLatterPage);
1278 LayoutUnit offsetForBorderSpacing =
1279 pageLogicalHeight - (remainingLogicalHeight + table()->vBorderSpacing());
1280 // Border spacing from the previous row has pushed this row just past the top
1281 // of the page, so we must reposition it to the top of the page and avoid any
1282 // repeating header.
1283 if (offsetForBorderSpacing < 0)
1284 return offsetForBorderSpacing.toInt();
1285
1272 if (remainingLogicalHeight >= rowLogicalHeight) 1286 if (remainingLogicalHeight >= rowLogicalHeight)
1273 return 0; // It fits fine where it is. No need to break. 1287 return 0; // It fits fine where it is. No need to break.
1274 LayoutUnit paginationStrut = calculatePaginationStrutToFitContent( 1288 LayoutUnit paginationStrut = calculatePaginationStrutToFitContent(
1275 logicalOffset, remainingLogicalHeight, rowLogicalHeight); 1289 logicalOffset, remainingLogicalHeight, rowLogicalHeight);
1276 if (paginationStrut == remainingLogicalHeight && 1290 if (paginationStrut == remainingLogicalHeight &&
1277 remainingLogicalHeight == pageLogicalHeight) { 1291 remainingLogicalHeight == pageLogicalHeight) {
1278 // Don't break if we were at the top of a page, and we failed to fit the con tent 1292 // 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. 1293 // completely. No point in leaving a page completely blank.
1280 return 0; 1294 return 0;
1281 } 1295 }
(...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, 1946 // 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. 1947 // 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. 1948 // 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()) 1949 if (table()->header() == this && isRepeatingHeaderGroup())
1936 rect.setHeight(table()->logicalHeight()); 1950 rect.setHeight(table()->logicalHeight());
1937 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect, 1951 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect,
1938 flags); 1952 flags);
1939 } 1953 }
1940 1954
1941 } // namespace blink 1955 } // 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