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

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

Issue 1651703002: More explicit LayoutUnit conversions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@evenMoarConstructors
Patch Set: More changes 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 m_rowPos[0] = table()->vBorderSpacing(); 718 m_rowPos[0] = table()->vBorderSpacing();
719 else 719 else
720 m_rowPos[0] = 0; 720 m_rowPos[0] = 0;
721 721
722 SpanningLayoutTableCells rowSpanCells; 722 SpanningLayoutTableCells rowSpanCells;
723 #if ENABLE(ASSERT) 723 #if ENABLE(ASSERT)
724 HashSet<const LayoutTableCell*> uniqueCells; 724 HashSet<const LayoutTableCell*> uniqueCells;
725 #endif 725 #endif
726 726
727 for (unsigned r = 0; r < m_grid.size(); r++) { 727 for (unsigned r = 0; r < m_grid.size(); r++) {
728 m_grid[r].baseline = -1; 728 m_grid[r].baseline = LayoutUnit(-1);
729 LayoutUnit baselineDescent; 729 LayoutUnit baselineDescent;
730 730
731 if (m_grid[r].logicalHeight.isSpecified()) { 731 if (m_grid[r].logicalHeight.isSpecified()) {
732 // Our base size is the biggest logical height from our cells' style s (excluding row spanning cells). 732 // Our base size is the biggest logical height from our cells' style s (excluding row spanning cells).
733 m_rowPos[r + 1] = std::max(m_rowPos[r] + minimumValueForLength(m_gri d[r].logicalHeight, 0).round(), 0); 733 m_rowPos[r + 1] = std::max(m_rowPos[r] + minimumValueForLength(m_gri d[r].logicalHeight, LayoutUnit(0)).round(), 0);
eae 2016/01/30 23:58:24 LayoutUnit()
734 } else { 734 } else {
735 // Non-specified lengths are ignored because the row already account s for the cells 735 // Non-specified lengths are ignored because the row already account s for the cells
736 // intrinsic logical height. 736 // intrinsic logical height.
737 m_rowPos[r + 1] = std::max(m_rowPos[r], 0); 737 m_rowPos[r + 1] = std::max(m_rowPos[r], 0);
738 } 738 }
739 739
740 Row& row = m_grid[r].row; 740 Row& row = m_grid[r].row;
741 unsigned totalCols = row.size(); 741 unsigned totalCols = row.size();
742 LayoutTableCell* lastRowSpanCell = nullptr; 742 LayoutTableCell* lastRowSpanCell = nullptr;
743 743
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 unsigned nEffCols = table()->numEffCols(); 961 unsigned nEffCols = table()->numEffCols();
962 962
963 LayoutState state(*this, locationOffset()); 963 LayoutState state(*this, locationOffset());
964 964
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(LayoutUnit(m_rowPos[r + 1] - m_row Pos[r] - vspacing));
972 rowLayoutObject->updateLayerTransformAfterLayout(); 972 rowLayoutObject->updateLayerTransformAfterLayout();
973 rowLayoutObject->clearAllOverflows(); 973 rowLayoutObject->clearAllOverflows();
974 rowLayoutObject->addVisualEffectOverflow(); 974 rowLayoutObject->addVisualEffectOverflow();
975 } 975 }
976 976
977 int rowHeightIncreaseForPagination = 0; 977 int rowHeightIncreaseForPagination = 0;
978 978
979 for (unsigned c = 0; c < nEffCols; c++) { 979 for (unsigned c = 0; c < nEffCols; c++) {
980 CellStruct& cs = cellAt(r, c); 980 CellStruct& cs = cellAt(r, c);
981 LayoutTableCell* cell = cs.primaryCell(); 981 LayoutTableCell* cell = cs.primaryCell();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 break; 1020 break;
1021 } 1021 }
1022 } 1022 }
1023 } 1023 }
1024 } 1024 }
1025 1025
1026 if (cellChildrenFlex) { 1026 if (cellChildrenFlex) {
1027 // Alignment within a cell is based off the calculated 1027 // Alignment within a cell is based off the calculated
1028 // height, which becomes irrelevant once the cell has 1028 // height, which becomes irrelevant once the cell has
1029 // been resized based off its percentage. 1029 // been resized based off its percentage.
1030 cell->setOverrideLogicalContentHeightFromRowHeight(rHeight); 1030 cell->setOverrideLogicalContentHeightFromRowHeight(LayoutUnit(rH eight));
1031 cell->forceChildLayout(); 1031 cell->forceChildLayout();
1032 1032
1033 // If the baseline moved, we may have to update the data for our row. Find out the new baseline. 1033 // If the baseline moved, we may have to update the data for our row. Find out the new baseline.
1034 if (cell->isBaselineAligned()) { 1034 if (cell->isBaselineAligned()) {
1035 LayoutUnit baseline = cell->cellBaselinePosition(); 1035 LayoutUnit baseline = cell->cellBaselinePosition();
1036 if (baseline > cell->borderBefore() + cell->paddingBefore()) 1036 if (baseline > cell->borderBefore() + cell->paddingBefore())
1037 m_grid[r].baseline = std::max(m_grid[r].baseline, baseli ne); 1037 m_grid[r].baseline = std::max(m_grid[r].baseline, baseli ne);
1038 } 1038 }
1039 } 1039 }
1040 1040
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 LayoutUnit oldLogicalHeight = cells[i]->logicalHeight(); 1083 LayoutUnit oldLogicalHeight = cells[i]->logicalHeight();
1084 cells[i]->setLogicalHeight(oldLogicalHeight + rowHeightIncre aseForPagination); 1084 cells[i]->setLogicalHeight(oldLogicalHeight + rowHeightIncre aseForPagination);
1085 cells[i]->computeOverflow(oldLogicalHeight, false); 1085 cells[i]->computeOverflow(oldLogicalHeight, false);
1086 } 1086 }
1087 } 1087 }
1088 } 1088 }
1089 } 1089 }
1090 1090
1091 ASSERT(!needsLayout()); 1091 ASSERT(!needsLayout());
1092 1092
1093 setLogicalHeight(m_rowPos[totalRows]); 1093 setLogicalHeight(LayoutUnit(m_rowPos[totalRows]));
1094 1094
1095 computeOverflowFromCells(totalRows, nEffCols); 1095 computeOverflowFromCells(totalRows, nEffCols);
1096 } 1096 }
1097 1097
1098 void LayoutTableSection::computeOverflowFromCells() 1098 void LayoutTableSection::computeOverflowFromCells()
1099 { 1099 {
1100 unsigned totalRows = m_grid.size(); 1100 unsigned totalRows = m_grid.size();
1101 unsigned nEffCols = table()->numEffCols(); 1101 unsigned nEffCols = table()->numEffCols();
1102 computeOverflowFromCells(totalRows, nEffCols); 1102 computeOverflowFromCells(totalRows, nEffCols);
1103 } 1103 }
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 return newSection; 1633 return newSection;
1634 } 1634 }
1635 1635
1636 void LayoutTableSection::setLogicalPositionForCell(LayoutTableCell* cell, unsign ed effectiveColumn) const 1636 void LayoutTableSection::setLogicalPositionForCell(LayoutTableCell* cell, unsign ed effectiveColumn) const
1637 { 1637 {
1638 LayoutPoint cellLocation(0, m_rowPos[cell->rowIndex()]); 1638 LayoutPoint cellLocation(0, m_rowPos[cell->rowIndex()]);
1639 int horizontalBorderSpacing = table()->hBorderSpacing(); 1639 int horizontalBorderSpacing = table()->hBorderSpacing();
1640 1640
1641 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). 1641 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691).
1642 if (!style()->isLeftToRightDirection()) 1642 if (!style()->isLeftToRightDirection())
1643 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); 1643 cellLocation.setX(LayoutUnit(table()->columnPositions()[table()->numEffC ols()] - table()->columnPositions()[table()->colToEffCol(cell->col() + cell->col Span())] + horizontalBorderSpacing));
1644 else 1644 else
1645 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); 1645 cellLocation.setX(LayoutUnit(table()->columnPositions()[effectiveColumn] + horizontalBorderSpacing));
1646 1646
1647 cell->setLogicalLocation(cellLocation); 1647 cell->setLogicalLocation(cellLocation);
1648 } 1648 }
1649 1649
1650 } // namespace blink 1650 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698