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, 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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 if (extraHeightToPropagate) { | 669 if (extraHeightToPropagate) { |
670 // Apply changed height by rowSpan cells to rows present at the end of t
he table | 670 // Apply changed height by rowSpan cells to rows present at the end of t
he table |
671 for (unsigned row = lastRowIndex + lastRowSpan + 1; row <= m_grid.size()
; row++) | 671 for (unsigned row = lastRowIndex + lastRowSpan + 1; row <= m_grid.size()
; row++) |
672 m_rowPos[row] += extraHeightToPropagate; | 672 m_rowPos[row] += extraHeightToPropagate; |
673 } | 673 } |
674 } | 674 } |
675 | 675 |
676 // Find out the baseline of the cell | 676 // Find out the baseline of the cell |
677 // If the cell's baseline is more then the row's baseline then the cell's baseli
ne become the row's baseline | 677 // If the cell's baseline is more then the row's baseline then the cell's baseli
ne become the row's baseline |
678 // and if the row's baseline goes out of the row's boundries then adjust row hei
ght accordingly. | 678 // and if the row's baseline goes out of the row's boundries then adjust row hei
ght accordingly. |
679 void LayoutTableSection::updateBaselineForCell(LayoutTableCell* cell, unsigned r
ow, LayoutUnit& baselineDescent) | 679 void LayoutTableSection::updateBaselineForCell(LayoutTableCell* cell, unsigned r
ow, int& baselineDescent) |
680 { | 680 { |
681 if (!cell->isBaselineAligned()) | 681 if (!cell->isBaselineAligned()) |
682 return; | 682 return; |
683 | 683 |
684 // Ignoring the intrinsic padding as it depends on knowing the row's baselin
e, which won't be accurate | 684 // Ignoring the intrinsic padding as it depends on knowing the row's baselin
e, which won't be accurate |
685 // until the end of this function. | 685 // until the end of this function. |
686 LayoutUnit baselinePosition = cell->cellBaselinePosition() - cell->intrinsic
PaddingBefore(); | 686 int baselinePosition = cell->cellBaselinePosition() - cell->intrinsicPadding
Before(); |
687 if (baselinePosition > cell->borderBefore() + (cell->paddingBefore() - cell-
>intrinsicPaddingBefore())) { | 687 if (baselinePosition > cell->borderBefore() + (cell->paddingBefore() - cell-
>intrinsicPaddingBefore())) { |
688 m_grid[row].baseline = std::max(m_grid[row].baseline, baselinePosition); | 688 m_grid[row].baseline = std::max(m_grid[row].baseline, baselinePosition); |
689 | 689 |
690 int cellStartRowBaselineDescent = 0; | 690 int cellStartRowBaselineDescent = 0; |
691 if (cell->rowSpan() == 1) { | 691 if (cell->rowSpan() == 1) { |
692 baselineDescent = std::max(baselineDescent, cell->logicalHeightForRo
wSizing() - baselinePosition); | 692 baselineDescent = std::max(baselineDescent, cell->logicalHeightForRo
wSizing() - baselinePosition); |
693 cellStartRowBaselineDescent = baselineDescent; | 693 cellStartRowBaselineDescent = baselineDescent; |
694 } | 694 } |
695 m_rowPos[row + 1] = std::max<int>(m_rowPos[row + 1], m_rowPos[row] + m_g
rid[row].baseline + cellStartRowBaselineDescent); | 695 m_rowPos[row + 1] = std::max<int>(m_rowPos[row + 1], m_rowPos[row] + m_g
rid[row].baseline + cellStartRowBaselineDescent); |
696 } | 696 } |
(...skipping 21 matching lines...) Expand all Loading... |
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 = LayoutUnit(-1); | 728 m_grid[r].baseline = -1; |
729 LayoutUnit baselineDescent; | 729 int baselineDescent = 0; |
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, LayoutUnit()).round(), 0); | 733 m_rowPos[r + 1] = std::max(m_rowPos[r] + minimumValueForLength(m_gri
d[r].logicalHeight, LayoutUnit()).round(), 0); |
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 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(LayoutUnit(rH
eight)); | 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 int 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 |
1041 SubtreeLayoutScope layouter(*cell); | 1041 SubtreeLayoutScope layouter(*cell); |
1042 cell->computeIntrinsicPadding(rHeight, layouter); | 1042 cell->computeIntrinsicPadding(rHeight, layouter); |
1043 | 1043 |
1044 LayoutRect oldCellRect = cell->frameRect(); | 1044 LayoutRect oldCellRect = cell->frameRect(); |
1045 | 1045 |
1046 setLogicalPositionForCell(cell, c); | 1046 setLogicalPositionForCell(cell, c); |
1047 | 1047 |
1048 if (!cell->needsLayout()) | 1048 if (!cell->needsLayout()) |
1049 cell->markForPaginationRelayoutIfNeeded(layouter); | 1049 cell->markForPaginationRelayoutIfNeeded(layouter); |
1050 | 1050 |
1051 cell->layoutIfNeeded(); | 1051 cell->layoutIfNeeded(); |
1052 | 1052 |
1053 // FIXME: Make pagination work with vertical tables. | 1053 // FIXME: Make pagination work with vertical tables. |
1054 if (view()->layoutState()->pageLogicalHeight() && cell->logicalHeigh
t() != rHeight) { | 1054 if (view()->layoutState()->pageLogicalHeight() && cell->logicalHeigh
t() != rHeight) { |
1055 // FIXME: Pagination might have made us change size. For now jus
t shrink or grow the cell to fit without doing a relayout. | 1055 // FIXME: Pagination might have made us change size. For now jus
t shrink or grow the cell to fit without doing a relayout. |
1056 // 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 | 1056 // 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 |
1057 // either. It's at least stable though and won't result in an in
finite # of relayouts that may never stabilize. | 1057 // either. It's at least stable though and won't result in an in
finite # of relayouts that may never stabilize. |
1058 LayoutUnit oldLogicalHeight = cell->logicalHeight(); | 1058 LayoutUnit oldLogicalHeight = cell->logicalHeight(); |
1059 if (oldLogicalHeight > rHeight) | 1059 if (oldLogicalHeight > rHeight) |
1060 rowHeightIncreaseForPagination = std::max<int>(rowHeightIncr
easeForPagination, oldLogicalHeight - rHeight); | 1060 rowHeightIncreaseForPagination = std::max<int>(rowHeightIncr
easeForPagination, oldLogicalHeight - rHeight); |
1061 cell->setLogicalHeight(rHeight); | 1061 cell->setLogicalHeight(LayoutUnit(rHeight)); |
1062 cell->computeOverflow(oldLogicalHeight, false); | 1062 cell->computeOverflow(oldLogicalHeight, false); |
1063 } | 1063 } |
1064 | 1064 |
1065 if (rowLayoutObject) | 1065 if (rowLayoutObject) |
1066 rowLayoutObject->addOverflowFromCell(cell); | 1066 rowLayoutObject->addOverflowFromCell(cell); |
1067 | 1067 |
1068 LayoutSize childOffset(cell->location() - oldCellRect.location()); | 1068 LayoutSize childOffset(cell->location() - oldCellRect.location()); |
1069 if (childOffset.width() || childOffset.height()) { | 1069 if (childOffset.width() || childOffset.height()) { |
1070 // If the child moved, we have to issue paint invalidations to i
t as well as any floating/positioned | 1070 // If the child moved, we have to issue paint invalidations to i
t as well as any floating/positioned |
1071 // descendants. An exception is if we need a layout. In this cas
e, we know we're going to | 1071 // descendants. An exception is if we need a layout. In this cas
e, we know we're going to |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(LayoutUnit(table()->columnPositions()[table()->numEffC
ols()] - table()->columnPositions()[table()->colToEffCol(cell->col() + cell->col
Span())] + 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(LayoutUnit(table()->columnPositions()[effectiveColumn]
+ horizontalBorderSpacing)); | 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 |
OLD | NEW |