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

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

Issue 1602773005: Respect break-inside:avoid on table rows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 4 years, 10 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 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 for (unsigned r = 0; r < totalRows; r++) { 965 for (unsigned r = 0; r < totalRows; r++) {
966 // Set the row's x/y position and width/height. 966 // Set the row's x/y position and width/height.
967 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject; 967 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject;
968 if (rowLayoutObject) { 968 if (rowLayoutObject) {
969 rowLayoutObject->setLocation(LayoutPoint(0, m_rowPos[r])); 969 rowLayoutObject->setLocation(LayoutPoint(0, m_rowPos[r]));
970 rowLayoutObject->setLogicalWidth(logicalWidth()); 970 rowLayoutObject->setLogicalWidth(logicalWidth());
971 rowLayoutObject->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vs pacing); 971 rowLayoutObject->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vs pacing);
972 rowLayoutObject->updateLayerTransformAfterLayout(); 972 rowLayoutObject->updateLayerTransformAfterLayout();
973 rowLayoutObject->clearAllOverflows(); 973 rowLayoutObject->clearAllOverflows();
974 rowLayoutObject->addVisualEffectOverflow(); 974 rowLayoutObject->addVisualEffectOverflow();
975 rowLayoutObject->setPaginationStrutPropagatedFromCell(LayoutUnit());
975 } 976 }
976 977
977 int rowHeightIncreaseForPagination = 0;
978
979 for (unsigned c = 0; c < nEffCols; c++) { 978 for (unsigned c = 0; c < nEffCols; c++) {
980 CellStruct& cs = cellAt(r, c); 979 CellStruct& cs = cellAt(r, c);
981 LayoutTableCell* cell = cs.primaryCell(); 980 LayoutTableCell* cell = cs.primaryCell();
982 981
983 if (!cell || cs.inColSpan) 982 if (!cell || cs.inColSpan)
984 continue; 983 continue;
985 984
986 int rowIndex = cell->rowIndex(); 985 int rowIndex = cell->rowIndex();
987 int rHeight = m_rowPos[rowIndex + cell->rowSpan()] - m_rowPos[rowInd ex] - vspacing; 986 int rHeight = m_rowPos[rowIndex + cell->rowSpan()] - m_rowPos[rowInd ex] - vspacing;
988 987
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 1042
1044 LayoutRect oldCellRect = cell->frameRect(); 1043 LayoutRect oldCellRect = cell->frameRect();
1045 1044
1046 setLogicalPositionForCell(cell, c); 1045 setLogicalPositionForCell(cell, c);
1047 1046
1048 if (!cell->needsLayout()) 1047 if (!cell->needsLayout())
1049 cell->markForPaginationRelayoutIfNeeded(layouter); 1048 cell->markForPaginationRelayoutIfNeeded(layouter);
1050 1049
1051 cell->layoutIfNeeded(); 1050 cell->layoutIfNeeded();
1052 1051
1053 // FIXME: Make pagination work with vertical tables.
1054 if (view()->layoutState()->pageLogicalHeight() && cell->logicalHeigh t() != rHeight) {
1055 // FIXME: Pagination might have made us change size. For now jus t shrink or grow the cell to fit without doing a relayout.
1056 // We'll also do a basic increase of the row height to accommoda te the cell if it's bigger, but this isn't quite right
1057 // either. It's at least stable though and won't result in an in finite # of relayouts that may never stabilize.
1058 LayoutUnit oldLogicalHeight = cell->logicalHeight();
1059 if (oldLogicalHeight > rHeight)
1060 rowHeightIncreaseForPagination = std::max<int>(rowHeightIncr easeForPagination, oldLogicalHeight - rHeight);
1061 cell->setLogicalHeight(rHeight);
1062 cell->computeOverflow(oldLogicalHeight, false);
1063 }
1064
1065 if (rowLayoutObject) 1052 if (rowLayoutObject)
1066 rowLayoutObject->addOverflowFromCell(cell); 1053 rowLayoutObject->addOverflowFromCell(cell);
1067 1054
1068 LayoutSize childOffset(cell->location() - oldCellRect.location()); 1055 LayoutSize childOffset(cell->location() - oldCellRect.location());
1069 if (childOffset.width() || childOffset.height()) { 1056 if (childOffset.width() || childOffset.height()) {
1070 // If the child moved, we have to issue paint invalidations to i t as well as any floating/positioned 1057 // If the child moved, we have to issue paint invalidations to i t as well as any floating/positioned
1071 // descendants. An exception is if we need a layout. In this cas e, we know we're going to 1058 // descendants. An exception is if we need a layout. In this cas e, we know we're going to
1072 // issue paint invalidations ourselves (and the child) anyway. 1059 // issue paint invalidations ourselves (and the child) anyway.
1073 if (!table()->selfNeedsLayout()) 1060 if (!table()->selfNeedsLayout())
1074 cell->setMayNeedPaintInvalidation(); 1061 cell->setMayNeedPaintInvalidation();
1075 } 1062 }
1076 } 1063 }
1077 if (rowHeightIncreaseForPagination) { 1064 if (rowLayoutObject && rowLayoutObject->paginationStrutPropagatedFromCel l()) {
mstensho (USE GERRIT) 2016/02/03 14:38:48 I haven't reviewed this yet.
1078 for (unsigned rowIndex = r + 1; rowIndex <= totalRows; rowIndex++) 1065 for (unsigned rowIndex = r; rowIndex <= totalRows; rowIndex++) {
1079 m_rowPos[rowIndex] += rowHeightIncreaseForPagination; 1066 m_rowPos[rowIndex] += rowLayoutObject->paginationStrutPropagated FromCell().toInt();
1080 for (unsigned c = 0; c < nEffCols; ++c) { 1067 if (rowIndex == totalRows)
1081 Vector<LayoutTableCell*, 1>& cells = cellAt(r, c).cells; 1068 continue;
1082 for (size_t i = 0; i < cells.size(); ++i) { 1069 for (unsigned c = 0; c < nEffCols; ++c) {
1083 LayoutUnit oldLogicalHeight = cells[i]->logicalHeight(); 1070 Vector<LayoutTableCell*, 1>& cells = cellAt(rowIndex, c).cel ls;
1084 cells[i]->setLogicalHeight(oldLogicalHeight + rowHeightIncre aseForPagination); 1071 for (size_t i = 0; i < cells.size(); ++i) {
1085 cells[i]->computeOverflow(oldLogicalHeight, false); 1072 setLogicalPositionForCell(cells[i], c);
1073 }
1086 } 1074 }
1087 } 1075 }
1088 } 1076 }
1089 } 1077 }
1090 1078
1091 ASSERT(!needsLayout()); 1079 ASSERT(!needsLayout());
1092 1080
1093 setLogicalHeight(m_rowPos[totalRows]); 1081 setLogicalHeight(m_rowPos[totalRows]);
1094 1082
1095 computeOverflowFromCells(totalRows, nEffCols); 1083 computeOverflowFromCells(totalRows, nEffCols);
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). 1629 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691).
1642 if (!style()->isLeftToRightDirection()) 1630 if (!style()->isLeftToRightDirection())
1643 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); 1631 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing);
1644 else 1632 else
1645 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); 1633 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing);
1646 1634
1647 cell->setLogicalLocation(cellLocation); 1635 cell->setLogicalLocation(cellLocation);
1648 } 1636 }
1649 1637
1650 } // namespace blink 1638 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698