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

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

Powered by Google App Engine
This is Rietveld 408576698