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

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

Issue 2261663002: Disallow cast/implicit conversion from LayoutUnit to int/unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 3 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 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 cell->markForPaginationRelayoutIfNeeded(layouter); 1089 cell->markForPaginationRelayoutIfNeeded(layouter);
1090 1090
1091 cell->layoutIfNeeded(); 1091 cell->layoutIfNeeded();
1092 1092
1093 // FIXME: Make pagination work with vertical tables. 1093 // FIXME: Make pagination work with vertical tables.
1094 if (view()->layoutState()->pageLogicalHeight() && cell->logicalHeigh t() != rHeight) { 1094 if (view()->layoutState()->pageLogicalHeight() && cell->logicalHeigh t() != rHeight) {
1095 // FIXME: Pagination might have made us change size. For now jus t shrink or grow the cell to fit without doing a relayout. 1095 // FIXME: Pagination might have made us change size. For now jus t shrink or grow the cell to fit without doing a relayout.
1096 // 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 1096 // 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
1097 // either. It's at least stable though and won't result in an in finite # of relayouts that may never stabilize. 1097 // either. It's at least stable though and won't result in an in finite # of relayouts that may never stabilize.
1098 LayoutUnit oldLogicalHeight = cell->logicalHeight(); 1098 LayoutUnit oldLogicalHeight = cell->logicalHeight();
1099 rowHeightIncreaseForPagination = std::max<int>(rowHeightIncrease ForPagination, oldLogicalHeight - rHeight); 1099 rowHeightIncreaseForPagination = std::max<int>(rowHeightIncrease ForPagination, (oldLogicalHeight - rHeight).toInt());
1100 cell->setLogicalHeight(LayoutUnit(rHeight)); 1100 cell->setLogicalHeight(LayoutUnit(rHeight));
1101 cell->computeOverflow(oldLogicalHeight, false); 1101 cell->computeOverflow(oldLogicalHeight, false);
1102 } 1102 }
1103 1103
1104 LayoutSize childOffset(cell->location() - oldCellRect.location()); 1104 LayoutSize childOffset(cell->location() - oldCellRect.location());
1105 if (childOffset.width() || childOffset.height()) { 1105 if (childOffset.width() || childOffset.height()) {
1106 // If the child moved, we have to issue paint invalidations to i t as well as any floating/positioned 1106 // If the child moved, we have to issue paint invalidations to i t as well as any floating/positioned
1107 // descendants. An exception is if we need a layout. In this cas e, we know we're going to 1107 // descendants. An exception is if we need a layout. In this cas e, we know we're going to
1108 // issue paint invalidations ourselves (and the child) anyway. 1108 // issue paint invalidations ourselves (and the child) anyway.
1109 if (!table()->selfNeedsLayout()) 1109 if (!table()->selfNeedsLayout())
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 return 0; 1150 return 0;
1151 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, LayoutBlock::AssociateWithLatterPage); 1151 LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logi calOffset, LayoutBlock::AssociateWithLatterPage);
1152 if (remainingLogicalHeight >= rowLogicalHeight) 1152 if (remainingLogicalHeight >= rowLogicalHeight)
1153 return 0; // It fits fine where it is. No need to break. 1153 return 0; // It fits fine where it is. No need to break.
1154 LayoutUnit paginationStrut = calculatePaginationStrutToFitContent(logicalOff set, remainingLogicalHeight, rowLogicalHeight); 1154 LayoutUnit paginationStrut = calculatePaginationStrutToFitContent(logicalOff set, remainingLogicalHeight, rowLogicalHeight);
1155 if (paginationStrut == remainingLogicalHeight && remainingLogicalHeight == p ageLogicalHeight) { 1155 if (paginationStrut == remainingLogicalHeight && remainingLogicalHeight == p ageLogicalHeight) {
1156 // Don't break if we were at the top of a page, and we failed to fit the content 1156 // Don't break if we were at the top of a page, and we failed to fit the content
1157 // completely. No point in leaving a page completely blank. 1157 // completely. No point in leaving a page completely blank.
1158 return 0; 1158 return 0;
1159 } 1159 }
1160 return paginationStrut; 1160 return paginationStrut.toInt();
1161 } 1161 }
1162 1162
1163 void LayoutTableSection::computeOverflowFromCells() 1163 void LayoutTableSection::computeOverflowFromCells()
1164 { 1164 {
1165 unsigned totalRows = m_grid.size(); 1165 unsigned totalRows = m_grid.size();
1166 unsigned nEffCols = table()->numEffectiveColumns(); 1166 unsigned nEffCols = table()->numEffectiveColumns();
1167 computeOverflowFromCells(totalRows, nEffCols); 1167 computeOverflowFromCells(totalRows, nEffCols);
1168 } 1168 }
1169 1169
1170 void LayoutTableSection::computeOverflowFromCells(unsigned totalRows, unsigned n EffCols) 1170 void LayoutTableSection::computeOverflowFromCells(unsigned totalRows, unsigned n EffCols)
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 1365
1366 int firstLineBaseline = m_grid[0].baseline; 1366 int firstLineBaseline = m_grid[0].baseline;
1367 if (firstLineBaseline >= 0) 1367 if (firstLineBaseline >= 0)
1368 return firstLineBaseline + m_rowPos[0]; 1368 return firstLineBaseline + m_rowPos[0];
1369 1369
1370 const Row& firstRow = m_grid[0].row; 1370 const Row& firstRow = m_grid[0].row;
1371 for (size_t i = 0; i < firstRow.size(); ++i) { 1371 for (size_t i = 0; i < firstRow.size(); ++i) {
1372 const CellStruct& cs = firstRow.at(i); 1372 const CellStruct& cs = firstRow.at(i);
1373 const LayoutTableCell* cell = cs.primaryCell(); 1373 const LayoutTableCell* cell = cs.primaryCell();
1374 if (cell) 1374 if (cell)
1375 firstLineBaseline = std::max<int>(firstLineBaseline, cell->logicalTo p() + cell->borderBefore() + cell->paddingBefore() + cell->contentLogicalHeight( )); 1375 firstLineBaseline = std::max<int>(firstLineBaseline, (cell->logicalT op() + cell->borderBefore() + cell->paddingBefore() + cell->contentLogicalHeight ()).toInt());
1376 } 1376 }
1377 1377
1378 return firstLineBaseline; 1378 return firstLineBaseline;
1379 } 1379 }
1380 1380
1381 void LayoutTableSection::paint(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const 1381 void LayoutTableSection::paint(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const
1382 { 1382 {
1383 TableSectionPainter(*this).paint(paintInfo, paintOffset); 1383 TableSectionPainter(*this).paint(paintInfo, paintOffset);
1384 } 1384 }
1385 1385
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 // Repeating table headers are painted once per fragmentation page/column. T his does not go through the regular fragmentation machinery, 1746 // Repeating table headers are painted once per fragmentation page/column. T his does not go through the regular fragmentation machinery,
1747 // so we need special code to expand the invalidation rect to contain all po sitions of the header in all columns. 1747 // so we need special code to expand the invalidation rect to contain all po sitions of the header in all columns.
1748 // Note that this is in flow thread coordinates, not visual coordinates. The enclosing LayoutFlowThread will convert to visual coordinates. 1748 // Note that this is in flow thread coordinates, not visual coordinates. The enclosing LayoutFlowThread will convert to visual coordinates.
1749 if (table()->header() == this && hasRepeatingHeaderGroup()) 1749 if (table()->header() == this && hasRepeatingHeaderGroup())
1750 rect.setHeight(table()->logicalHeight()); 1750 rect.setHeight(table()->logicalHeight());
1751 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rec t, flags); 1751 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rec t, flags);
1752 } 1752 }
1753 1753
1754 1754
1755 } // namespace blink 1755 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableCell.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698