Chromium Code Reviews| OLD | NEW |
|---|---|
| 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, 2007, 2008, 2009, 2010, 2013 Apple Inc. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 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 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1438 if (section) { | 1438 if (section) { |
| 1439 ASSERT(section->numRows()); | 1439 ASSERT(section->numRows()); |
| 1440 rAbove = section->numRows() - 1; | 1440 rAbove = section->numRows() - 1; |
| 1441 } | 1441 } |
| 1442 } | 1442 } |
| 1443 | 1443 |
| 1444 // Look up the cell in the section's grid, which requires effective col index | 1444 // Look up the cell in the section's grid, which requires effective col index |
| 1445 if (section) { | 1445 if (section) { |
| 1446 unsigned effCol = | 1446 unsigned effCol = |
| 1447 absoluteColumnToEffectiveColumn(cell->absoluteColumnIndex()); | 1447 absoluteColumnToEffectiveColumn(cell->absoluteColumnIndex()); |
| 1448 return section->primaryCellAt(rAbove, effCol); | 1448 return effCol < section->numCols(rAbove) |
| 1449 ? section->primaryCellAt(rAbove, effCol) | |
| 1450 : nullptr; | |
| 1449 } | 1451 } |
| 1450 return nullptr; | 1452 return nullptr; |
| 1451 } | 1453 } |
| 1452 | 1454 |
| 1453 LayoutTableCell* LayoutTable::cellBelow(const LayoutTableCell* cell) const { | 1455 LayoutTableCell* LayoutTable::cellBelow(const LayoutTableCell* cell) const { |
| 1454 recalcSectionsIfNeeded(); | 1456 recalcSectionsIfNeeded(); |
| 1455 | 1457 |
| 1456 // Find the section and row to look in | 1458 // Find the section and row to look in |
| 1457 unsigned r = cell->rowIndex() + cell->rowSpan() - 1; | 1459 unsigned r = cell->rowIndex() + cell->rowSpan() - 1; |
| 1458 LayoutTableSection* section = nullptr; | 1460 LayoutTableSection* section = nullptr; |
| 1459 unsigned rBelow = 0; | 1461 unsigned rBelow = 0; |
| 1460 if (r < cell->section()->numRows() - 1) { | 1462 if (r < cell->section()->numRows() - 1) { |
| 1461 // The cell is not in the last row, so use the next row in the section. | 1463 // The cell is not in the last row, so use the next row in the section. |
| 1462 section = cell->section(); | 1464 section = cell->section(); |
| 1463 rBelow = r + 1; | 1465 rBelow = r + 1; |
| 1464 } else { | 1466 } else { |
| 1465 section = sectionBelow(cell->section(), SkipEmptySections); | 1467 section = sectionBelow(cell->section(), SkipEmptySections); |
| 1466 if (section) | 1468 if (section) |
| 1467 rBelow = 0; | 1469 rBelow = 0; |
| 1468 } | 1470 } |
| 1469 | 1471 |
| 1470 // Look up the cell in the section's grid, which requires effective col index | 1472 // Look up the cell in the section's grid, which requires effective col index |
| 1471 if (section) { | 1473 if (section) { |
| 1472 unsigned effCol = | 1474 unsigned effCol = |
| 1473 absoluteColumnToEffectiveColumn(cell->absoluteColumnIndex()); | 1475 absoluteColumnToEffectiveColumn(cell->absoluteColumnIndex()); |
| 1474 return section->primaryCellAt(rBelow, effCol); | 1476 return effCol < section->numCols(rBelow) |
| 1477 ? section->primaryCellAt(rBelow, effCol) | |
| 1478 : nullptr; | |
| 1475 } | 1479 } |
| 1476 return nullptr; | 1480 return nullptr; |
| 1477 } | 1481 } |
| 1478 | 1482 |
| 1479 LayoutTableCell* LayoutTable::cellBefore(const LayoutTableCell* cell) const { | 1483 LayoutTableCell* LayoutTable::cellBefore(const LayoutTableCell* cell) const { |
| 1480 recalcSectionsIfNeeded(); | 1484 recalcSectionsIfNeeded(); |
| 1481 | 1485 |
| 1482 LayoutTableSection* section = cell->section(); | 1486 LayoutTableSection* section = cell->section(); |
| 1483 unsigned effCol = | 1487 unsigned effCol = |
| 1484 absoluteColumnToEffectiveColumn(cell->absoluteColumnIndex()); | 1488 absoluteColumnToEffectiveColumn(cell->absoluteColumnIndex()); |
| 1485 if (!effCol) | 1489 if (!effCol) |
| 1486 return nullptr; | 1490 return nullptr; |
| 1487 | 1491 |
| 1488 // If we hit a colspan back up to a real cell. | 1492 // If we hit a colspan back up to a real cell. |
| 1489 LayoutTableSection::CellStruct& prevCell = | 1493 return section->primaryCellAt(cell->rowIndex(), effCol - 1); |
|
mstensho (USE GERRIT)
2017/01/20 10:02:04
This is just clean-up, right?
a.suchit
2017/01/23 06:35:32
yes
| |
| 1490 section->cellAt(cell->rowIndex(), effCol - 1); | |
| 1491 return prevCell.primaryCell(); | |
| 1492 } | 1494 } |
| 1493 | 1495 |
| 1494 LayoutTableCell* LayoutTable::cellAfter(const LayoutTableCell* cell) const { | 1496 LayoutTableCell* LayoutTable::cellAfter(const LayoutTableCell* cell) const { |
| 1495 recalcSectionsIfNeeded(); | 1497 recalcSectionsIfNeeded(); |
| 1496 | 1498 |
| 1497 unsigned effCol = absoluteColumnToEffectiveColumn( | 1499 unsigned effCol = absoluteColumnToEffectiveColumn( |
| 1498 cell->absoluteColumnIndex() + cell->colSpan()); | 1500 cell->absoluteColumnIndex() + cell->colSpan()); |
| 1499 return cell->section()->primaryCellAt(cell->rowIndex(), effCol); | 1501 unsigned row = cell->rowIndex(); |
| 1502 LayoutTableSection* section = cell->section(); | |
| 1503 return effCol < section->numCols(row) ? section->primaryCellAt(row, effCol) | |
| 1504 : nullptr; | |
| 1500 } | 1505 } |
| 1501 | 1506 |
| 1502 int LayoutTable::baselinePosition(FontBaseline baselineType, | 1507 int LayoutTable::baselinePosition(FontBaseline baselineType, |
| 1503 bool firstLine, | 1508 bool firstLine, |
| 1504 LineDirectionMode direction, | 1509 LineDirectionMode direction, |
| 1505 LinePositionMode linePositionMode) const { | 1510 LinePositionMode linePositionMode) const { |
| 1506 ASSERT(linePositionMode == PositionOnContainingLine); | 1511 ASSERT(linePositionMode == PositionOnContainingLine); |
| 1507 int baseline = firstLineBoxBaseline(); | 1512 int baseline = firstLineBoxBaseline(); |
| 1508 if (baseline != -1) { | 1513 if (baseline != -1) { |
| 1509 if (isInline()) | 1514 if (isInline()) |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1688 } | 1693 } |
| 1689 | 1694 |
| 1690 LayoutUnit LayoutTable::paddingRight() const { | 1695 LayoutUnit LayoutTable::paddingRight() const { |
| 1691 if (collapseBorders()) | 1696 if (collapseBorders()) |
| 1692 return LayoutUnit(); | 1697 return LayoutUnit(); |
| 1693 | 1698 |
| 1694 return LayoutBlock::paddingRight(); | 1699 return LayoutBlock::paddingRight(); |
| 1695 } | 1700 } |
| 1696 | 1701 |
| 1697 } // namespace blink | 1702 } // namespace blink |
| OLD | NEW |