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

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

Issue 2434543004: Specified row height should be applied during initial section layout. (Closed)
Patch Set: Code review. 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fragmentation/table-row-with-specified-height.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after
1958 if (cell.isBaselineAligned()) { 1958 if (cell.isBaselineAligned()) {
1959 int baseline = cell.cellBaselinePosition(); 1959 int baseline = cell.cellBaselinePosition();
1960 if (baseline > cell.borderBefore() + cell.paddingBefore()) 1960 if (baseline > cell.borderBefore() + cell.paddingBefore())
1961 m_grid[rowIndex].baseline = std::max(m_grid[rowIndex].baseline, baseline); 1961 m_grid[rowIndex].baseline = std::max(m_grid[rowIndex].baseline, baseline);
1962 } 1962 }
1963 } 1963 }
1964 1964
1965 int LayoutTableSection::logicalHeightForRow( 1965 int LayoutTableSection::logicalHeightForRow(
1966 const LayoutTableRow& rowObject) const { 1966 const LayoutTableRow& rowObject) const {
1967 unsigned rowIndex = rowObject.rowIndex(); 1967 unsigned rowIndex = rowObject.rowIndex();
1968 DCHECK(rowIndex < m_grid.size());
1968 int logicalHeight = 0; 1969 int logicalHeight = 0;
1969 const Row& row = m_grid[rowIndex].row; 1970 const Row& row = m_grid[rowIndex].row;
1970 unsigned cols = row.size(); 1971 unsigned cols = row.size();
1971 for (unsigned colIndex = 0; colIndex < cols; colIndex++) { 1972 for (unsigned colIndex = 0; colIndex < cols; colIndex++) {
1972 const CellStruct& cellStruct = cellAt(rowIndex, colIndex); 1973 const CellStruct& cellStruct = cellAt(rowIndex, colIndex);
1973 const LayoutTableCell* cell = cellStruct.primaryCell(); 1974 const LayoutTableCell* cell = cellStruct.primaryCell();
1974 if (!cell || cellStruct.inColSpan) 1975 if (!cell || cellStruct.inColSpan)
1975 continue; 1976 continue;
1976 // TODO(mstensho): Rowspanned cells also need to contribute to row heights 1977 // TODO(mstensho): Rowspanned cells also need to contribute to row heights
1977 // during the first layout pass, in order to get fragmentation right. 1978 // during the first layout pass, in order to get fragmentation right.
1978 if (cell->rowSpan() == 1) { 1979 if (cell->rowSpan() == 1) {
1979 logicalHeight = 1980 logicalHeight =
1980 std::max(logicalHeight, cell->logicalHeightForRowSizing()); 1981 std::max(logicalHeight, cell->logicalHeightForRowSizing());
1981 } 1982 }
1982 } 1983 }
1984
1985 if (m_grid[rowIndex].logicalHeight.isSpecified()) {
1986 LayoutUnit specifiedLogicalHeight =
1987 minimumValueForLength(m_grid[rowIndex].logicalHeight, LayoutUnit());
1988 logicalHeight = std::max(logicalHeight, specifiedLogicalHeight.toInt());
1989 }
1983 return logicalHeight; 1990 return logicalHeight;
1984 } 1991 }
1985 1992
1986 void LayoutTableSection::adjustRowForPagination(LayoutTableRow& rowObject, 1993 void LayoutTableSection::adjustRowForPagination(LayoutTableRow& rowObject,
1987 SubtreeLayoutScope& layouter) { 1994 SubtreeLayoutScope& layouter) {
1988 LayoutState& state = *view()->layoutState(); 1995 LayoutState& state = *view()->layoutState();
1989 rowObject.setPaginationStrut(LayoutUnit()); 1996 rowObject.setPaginationStrut(LayoutUnit());
1990 rowObject.setLogicalHeight(LayoutUnit(logicalHeightForRow(rowObject))); 1997 rowObject.setLogicalHeight(LayoutUnit(logicalHeightForRow(rowObject)));
1991 int paginationStrut = 1998 int paginationStrut =
1992 paginationStrutForRow(&rowObject, rowObject.logicalTop()); 1999 paginationStrutForRow(&rowObject, rowObject.logicalTop());
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2067 // the header in all columns. 2074 // the header in all columns.
2068 // Note that this is in flow thread coordinates, not visual coordinates. The 2075 // Note that this is in flow thread coordinates, not visual coordinates. The
2069 // enclosing LayoutFlowThread will convert to visual coordinates. 2076 // enclosing LayoutFlowThread will convert to visual coordinates.
2070 if (table()->header() == this && isRepeatingHeaderGroup()) 2077 if (table()->header() == this && isRepeatingHeaderGroup())
2071 rect.setHeight(table()->logicalHeight()); 2078 rect.setHeight(table()->logicalHeight());
2072 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect, 2079 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rect,
2073 flags); 2080 flags);
2074 } 2081 }
2075 2082
2076 } // namespace blink 2083 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fragmentation/table-row-with-specified-height.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698