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

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

Issue 2458823002: Don't establish LayoutState for LayoutTableRow objects. (Closed)
Patch Set: Created 4 years, 1 month 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. 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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 int LayoutTableSection::calcRowLogicalHeight() { 831 int LayoutTableSection::calcRowLogicalHeight() {
832 #if ENABLE(ASSERT) 832 #if ENABLE(ASSERT)
833 SetLayoutNeededForbiddenScope layoutForbiddenScope(*this); 833 SetLayoutNeededForbiddenScope layoutForbiddenScope(*this);
834 #endif 834 #endif
835 835
836 ASSERT(!needsLayout()); 836 ASSERT(!needsLayout());
837 837
838 LayoutTableCell* cell; 838 LayoutTableCell* cell;
839 839
840 // We may have to forcefully lay out cells here, in which case we need a 840 // We may have to forcefully lay out cells here, in which case we need a
841 // layout state. Technically, we should also push state for the row, but since 841 // layout state.
842 // rows don't push a coordinate transform, that's not necessary. 842 LayoutState state(*this);
843 LayoutState state(*this, locationOffset());
844 843
845 m_rowPos.resize(m_grid.size() + 1); 844 m_rowPos.resize(m_grid.size() + 1);
846 845
847 // We ignore the border-spacing on any non-top section as it is already 846 // We ignore the border-spacing on any non-top section as it is already
848 // included in the previous section's last row position. 847 // included in the previous section's last row position.
849 if (this == table()->topSection()) 848 if (this == table()->topSection())
850 m_rowPos[0] = table()->vBorderSpacing(); 849 m_rowPos[0] = table()->vBorderSpacing();
851 else 850 else
852 m_rowPos[0] = 0; 851 m_rowPos[0] = 0;
853 852
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 ASSERT(needsLayout()); 952 ASSERT(needsLayout());
954 LayoutAnalyzer::Scope analyzer(*this); 953 LayoutAnalyzer::Scope analyzer(*this);
955 RELEASE_ASSERT(!needsCellRecalc()); 954 RELEASE_ASSERT(!needsCellRecalc());
956 ASSERT(!table()->needsSectionRecalc()); 955 ASSERT(!table()->needsSectionRecalc());
957 956
958 // addChild may over-grow m_grid but we don't want to throw away the memory 957 // addChild may over-grow m_grid but we don't want to throw away the memory
959 // too early as addChild can be called in a loop (e.g during parsing). Doing 958 // too early as addChild can be called in a loop (e.g during parsing). Doing
960 // it now ensures we have a stable-enough structure. 959 // it now ensures we have a stable-enough structure.
961 m_grid.shrinkToFit(); 960 m_grid.shrinkToFit();
962 961
963 LayoutState state(*this, locationOffset()); 962 LayoutState state(*this);
964 963
965 const Vector<int>& columnPos = table()->effectiveColumnPositions(); 964 const Vector<int>& columnPos = table()->effectiveColumnPositions();
966 LayoutUnit rowLogicalTop; 965 LayoutUnit rowLogicalTop;
967 966
968 SubtreeLayoutScope layouter(*this); 967 SubtreeLayoutScope layouter(*this);
969 for (unsigned r = 0; r < m_grid.size(); ++r) { 968 for (unsigned r = 0; r < m_grid.size(); ++r) {
970 Row& row = m_grid[r].row; 969 Row& row = m_grid[r].row;
971 unsigned cols = row.size(); 970 unsigned cols = row.size();
972 // First, propagate our table layout's information to the cells. This will 971 // First, propagate our table layout's information to the cells. This will
973 // mark the row as needing layout if there was a column logical width 972 // mark the row as needing layout if there was a column logical width
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 // FIXME: Changing the height without a layout can change the overflow so it 1129 // FIXME: Changing the height without a layout can change the overflow so it
1131 // seems wrong. 1130 // seems wrong.
1132 1131
1133 unsigned totalRows = m_grid.size(); 1132 unsigned totalRows = m_grid.size();
1134 1133
1135 // Set the width of our section now. The rows will also be this width. 1134 // Set the width of our section now. The rows will also be this width.
1136 setLogicalWidth(table()->contentLogicalWidth()); 1135 setLogicalWidth(table()->contentLogicalWidth());
1137 1136
1138 int vspacing = table()->vBorderSpacing(); 1137 int vspacing = table()->vBorderSpacing();
1139 unsigned nEffCols = table()->numEffectiveColumns(); 1138 unsigned nEffCols = table()->numEffectiveColumns();
1140 LayoutState state(*this, locationOffset()); 1139 LayoutState state(*this);
1141 1140
1142 // Set the rows' location and size. 1141 // Set the rows' location and size.
1143 for (unsigned r = 0; r < totalRows; r++) { 1142 for (unsigned r = 0; r < totalRows; r++) {
1144 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject; 1143 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject;
1145 if (rowLayoutObject) { 1144 if (rowLayoutObject) {
1146 rowLayoutObject->setLogicalLocation(LayoutPoint(0, m_rowPos[r])); 1145 rowLayoutObject->setLogicalLocation(LayoutPoint(0, m_rowPos[r]));
1147 rowLayoutObject->setLogicalWidth(logicalWidth()); 1146 rowLayoutObject->setLogicalWidth(logicalWidth());
1148 LayoutUnit rowLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspacing); 1147 LayoutUnit rowLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspacing);
1149 if (state.isPaginated() && r + 1 < totalRows) { 1148 if (state.isPaginated() && r + 1 < totalRows) {
1150 // If the next row has a pagination strut, we need to subtract it. It 1149 // If the next row has a pagination strut, we need to subtract it. It
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 // the header in all columns. 2078 // the header in all columns.
2080 // Note that this is in flow thread coordinates, not visual coordinates. The 2079 // Note that this is in flow thread coordinates, not visual coordinates. The
2081 // enclosing LayoutFlowThread will convert to visual coordinates. 2080 // enclosing LayoutFlowThread will convert to visual coordinates.
2082 if (table()->header() == this && isRepeatingHeaderGroup()) 2081 if (table()->header() == this && isRepeatingHeaderGroup())
2083 rect.setHeight(table()->logicalHeight()); 2082 rect.setHeight(table()->logicalHeight());
2084 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect, 2083 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect,
2085 flags); 2084 flags);
2086 } 2085 }
2087 2086
2088 } // namespace blink 2087 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableRow.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutVTTCue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698