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 LayoutTableSection::CellStruct& aboveCell = section->cellAt(rAbove, effCol); | 1448 return section->primaryCellAt(rAbove, effCol); |
1449 return aboveCell.primaryCell(); | |
1450 } | 1449 } |
1451 return nullptr; | 1450 return nullptr; |
1452 } | 1451 } |
1453 | 1452 |
1454 LayoutTableCell* LayoutTable::cellBelow(const LayoutTableCell* cell) const { | 1453 LayoutTableCell* LayoutTable::cellBelow(const LayoutTableCell* cell) const { |
1455 recalcSectionsIfNeeded(); | 1454 recalcSectionsIfNeeded(); |
1456 | 1455 |
1457 // Find the section and row to look in | 1456 // Find the section and row to look in |
1458 unsigned r = cell->rowIndex() + cell->rowSpan() - 1; | 1457 unsigned r = cell->rowIndex() + cell->rowSpan() - 1; |
1459 LayoutTableSection* section = nullptr; | 1458 LayoutTableSection* section = nullptr; |
1460 unsigned rBelow = 0; | 1459 unsigned rBelow = 0; |
1461 if (r < cell->section()->numRows() - 1) { | 1460 if (r < cell->section()->numRows() - 1) { |
1462 // The cell is not in the last row, so use the next row in the section. | 1461 // The cell is not in the last row, so use the next row in the section. |
1463 section = cell->section(); | 1462 section = cell->section(); |
1464 rBelow = r + 1; | 1463 rBelow = r + 1; |
1465 } else { | 1464 } else { |
1466 section = sectionBelow(cell->section(), SkipEmptySections); | 1465 section = sectionBelow(cell->section(), SkipEmptySections); |
1467 if (section) | 1466 if (section) |
1468 rBelow = 0; | 1467 rBelow = 0; |
1469 } | 1468 } |
1470 | 1469 |
1471 // Look up the cell in the section's grid, which requires effective col index | 1470 // Look up the cell in the section's grid, which requires effective col index |
1472 if (section) { | 1471 if (section) { |
1473 unsigned effCol = | 1472 unsigned effCol = |
1474 absoluteColumnToEffectiveColumn(cell->absoluteColumnIndex()); | 1473 absoluteColumnToEffectiveColumn(cell->absoluteColumnIndex()); |
1475 LayoutTableSection::CellStruct& belowCell = section->cellAt(rBelow, effCol); | 1474 return section->primaryCellAt(rBelow, effCol); |
1476 return belowCell.primaryCell(); | |
1477 } | 1475 } |
1478 return nullptr; | 1476 return nullptr; |
1479 } | 1477 } |
1480 | 1478 |
1481 LayoutTableCell* LayoutTable::cellBefore(const LayoutTableCell* cell) const { | 1479 LayoutTableCell* LayoutTable::cellBefore(const LayoutTableCell* cell) const { |
1482 recalcSectionsIfNeeded(); | 1480 recalcSectionsIfNeeded(); |
1483 | 1481 |
1484 LayoutTableSection* section = cell->section(); | 1482 LayoutTableSection* section = cell->section(); |
1485 unsigned effCol = | 1483 unsigned effCol = |
1486 absoluteColumnToEffectiveColumn(cell->absoluteColumnIndex()); | 1484 absoluteColumnToEffectiveColumn(cell->absoluteColumnIndex()); |
1487 if (!effCol) | 1485 if (!effCol) |
1488 return nullptr; | 1486 return nullptr; |
1489 | 1487 |
1490 // If we hit a colspan back up to a real cell. | 1488 // If we hit a colspan back up to a real cell. |
1491 LayoutTableSection::CellStruct& prevCell = | 1489 LayoutTableSection::CellStruct& prevCell = |
1492 section->cellAt(cell->rowIndex(), effCol - 1); | 1490 section->cellAt(cell->rowIndex(), effCol - 1); |
1493 return prevCell.primaryCell(); | 1491 return prevCell.primaryCell(); |
1494 } | 1492 } |
1495 | 1493 |
1496 LayoutTableCell* LayoutTable::cellAfter(const LayoutTableCell* cell) const { | 1494 LayoutTableCell* LayoutTable::cellAfter(const LayoutTableCell* cell) const { |
1497 recalcSectionsIfNeeded(); | 1495 recalcSectionsIfNeeded(); |
1498 | 1496 |
1499 unsigned effCol = absoluteColumnToEffectiveColumn( | 1497 unsigned effCol = absoluteColumnToEffectiveColumn( |
1500 cell->absoluteColumnIndex() + cell->colSpan()); | 1498 cell->absoluteColumnIndex() + cell->colSpan()); |
1501 if (effCol >= numEffectiveColumns()) | |
1502 return nullptr; | |
1503 return cell->section()->primaryCellAt(cell->rowIndex(), effCol); | 1499 return cell->section()->primaryCellAt(cell->rowIndex(), effCol); |
1504 } | 1500 } |
1505 | 1501 |
1506 int LayoutTable::baselinePosition(FontBaseline baselineType, | 1502 int LayoutTable::baselinePosition(FontBaseline baselineType, |
1507 bool firstLine, | 1503 bool firstLine, |
1508 LineDirectionMode direction, | 1504 LineDirectionMode direction, |
1509 LinePositionMode linePositionMode) const { | 1505 LinePositionMode linePositionMode) const { |
1510 ASSERT(linePositionMode == PositionOnContainingLine); | 1506 ASSERT(linePositionMode == PositionOnContainingLine); |
1511 int baseline = firstLineBoxBaseline(); | 1507 int baseline = firstLineBoxBaseline(); |
1512 if (baseline != -1) { | 1508 if (baseline != -1) { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 } | 1688 } |
1693 | 1689 |
1694 LayoutUnit LayoutTable::paddingRight() const { | 1690 LayoutUnit LayoutTable::paddingRight() const { |
1695 if (collapseBorders()) | 1691 if (collapseBorders()) |
1696 return LayoutUnit(); | 1692 return LayoutUnit(); |
1697 | 1693 |
1698 return LayoutBlock::paddingRight(); | 1694 return LayoutBlock::paddingRight(); |
1699 } | 1695 } |
1700 | 1696 |
1701 } // namespace blink | 1697 } // namespace blink |
OLD | NEW |