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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 spanningRowsHeight.rowHeight[row] = calcRowHeightHavingOnlySpanningC
ells(actualRow, accumulatedPositionIncrease, rowIndex + rowSpan, extraHeightToPr
opagate, rowsCountWithOnlySpanningCells); | 555 spanningRowsHeight.rowHeight[row] = calcRowHeightHavingOnlySpanningC
ells(actualRow, accumulatedPositionIncrease, rowIndex + rowSpan, extraHeightToPr
opagate, rowsCountWithOnlySpanningCells); |
556 accumulatedPositionIncrease += spanningRowsHeight.rowHeight[row]; | 556 accumulatedPositionIncrease += spanningRowsHeight.rowHeight[row]; |
557 } | 557 } |
558 m_rowPos[actualRow + 1] += accumulatedPositionIncrease; | 558 m_rowPos[actualRow + 1] += accumulatedPositionIncrease; |
559 } | 559 } |
560 | 560 |
561 spanningRowsHeight.totalRowsHeight += accumulatedPositionIncrease; | 561 spanningRowsHeight.totalRowsHeight += accumulatedPositionIncrease; |
562 } | 562 } |
563 | 563 |
564 // Distribute rowSpan cell height in rows those comes in rowSpan cell based on t
he ratio of row's height if | 564 // Distribute rowSpan cell height in rows those comes in rowSpan cell based on t
he ratio of row's height if |
565 // 1. RowSpan cell height is greater then the total height of rows in rowSpan ce
ll | 565 // 1. RowSpan cell height is greater than the total height of rows in rowSpan ce
ll |
566 void LayoutTableSection::distributeRowSpanHeightToRows(SpanningLayoutTableCells&
rowSpanCells) | 566 void LayoutTableSection::distributeRowSpanHeightToRows(SpanningLayoutTableCells&
rowSpanCells) |
567 { | 567 { |
568 ASSERT(rowSpanCells.size()); | 568 ASSERT(rowSpanCells.size()); |
569 | 569 |
570 // 'rowSpanCells' list is already sorted based on the cells rowIndex in asce
nding order | 570 // 'rowSpanCells' list is already sorted based on the cells rowIndex in asce
nding order |
571 // Arrange row spanning cell in the order in which we need to process first. | 571 // Arrange row spanning cell in the order in which we need to process first. |
572 std::sort(rowSpanCells.begin(), rowSpanCells.end(), compareRowSpanCellsInHei
ghtDistributionOrder); | 572 std::sort(rowSpanCells.begin(), rowSpanCells.end(), compareRowSpanCellsInHei
ghtDistributionOrder); |
573 | 573 |
574 unsigned extraHeightToPropagate = 0; | 574 unsigned extraHeightToPropagate = 0; |
575 unsigned lastRowIndex = 0; | 575 unsigned lastRowIndex = 0; |
(...skipping 12 matching lines...) Expand all Loading... |
588 for (unsigned i = 0; i < rowSpanCells.size(); i++) { | 588 for (unsigned i = 0; i < rowSpanCells.size(); i++) { |
589 LayoutTableCell* cell = rowSpanCells[i]; | 589 LayoutTableCell* cell = rowSpanCells[i]; |
590 | 590 |
591 unsigned rowIndex = cell->rowIndex(); | 591 unsigned rowIndex = cell->rowIndex(); |
592 | 592 |
593 unsigned rowSpan = cell->rowSpan(); | 593 unsigned rowSpan = cell->rowSpan(); |
594 | 594 |
595 unsigned spanningCellEndIndex = rowIndex + rowSpan; | 595 unsigned spanningCellEndIndex = rowIndex + rowSpan; |
596 unsigned lastSpanningCellEndIndex = lastRowIndex + lastRowSpan; | 596 unsigned lastSpanningCellEndIndex = lastRowIndex + lastRowSpan; |
597 | 597 |
598 // Only heightest spanning cell will distribute it's extra height in row
if more then one spanning cells | 598 // Only the highest spanning cell will distribute its extra height in a
row if more than one spanning cell |
599 // present at same level. | 599 // is present at the same level. |
600 if (rowIndex == lastRowIndex && rowSpan == lastRowSpan) | 600 if (rowIndex == lastRowIndex && rowSpan == lastRowSpan) |
601 continue; | 601 continue; |
602 | 602 |
603 int originalBeforePosition = m_rowPos[spanningCellEndIndex]; | 603 int originalBeforePosition = m_rowPos[spanningCellEndIndex]; |
604 | 604 |
605 // When 2 spanning cells are ending at same row index then while extra h
eight distribution of first spanning | 605 // When 2 spanning cells are ending at same row index then while extra h
eight distribution of first spanning |
606 // cell updates position of the last row so getting the original positio
n of the last row in second spanning | 606 // cell updates position of the last row so getting the original positio
n of the last row in second spanning |
607 // cell need to reduce the height changed by first spanning cell. | 607 // cell need to reduce the height changed by first spanning cell. |
608 if (spanningCellEndIndex == lastSpanningCellEndIndex) | 608 if (spanningCellEndIndex == lastSpanningCellEndIndex) |
609 originalBeforePosition -= extraHeightToPropagate; | 609 originalBeforePosition -= extraHeightToPropagate; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 } | 681 } |
682 | 682 |
683 if (extraHeightToPropagate) { | 683 if (extraHeightToPropagate) { |
684 // Apply changed height by rowSpan cells to rows present at the end of t
he table | 684 // Apply changed height by rowSpan cells to rows present at the end of t
he table |
685 for (unsigned row = lastRowIndex + lastRowSpan + 1; row <= m_grid.size()
; row++) | 685 for (unsigned row = lastRowIndex + lastRowSpan + 1; row <= m_grid.size()
; row++) |
686 m_rowPos[row] += extraHeightToPropagate; | 686 m_rowPos[row] += extraHeightToPropagate; |
687 } | 687 } |
688 } | 688 } |
689 | 689 |
690 // Find out the baseline of the cell | 690 // Find out the baseline of the cell |
691 // If the cell's baseline is more then the row's baseline then the cell's baseli
ne become the row's baseline | 691 // If the cell's baseline is more than the row's baseline then the cell's baseli
ne become the row's baseline |
692 // and if the row's baseline goes out of the row's boundries then adjust row hei
ght accordingly. | 692 // and if the row's baseline goes out of the row's boundaries then adjust row he
ight accordingly. |
693 void LayoutTableSection::updateBaselineForCell(LayoutTableCell* cell, unsigned r
ow, int& baselineDescent) | 693 void LayoutTableSection::updateBaselineForCell(LayoutTableCell* cell, unsigned r
ow, int& baselineDescent) |
694 { | 694 { |
695 if (!cell->isBaselineAligned()) | 695 if (!cell->isBaselineAligned()) |
696 return; | 696 return; |
697 | 697 |
698 // Ignoring the intrinsic padding as it depends on knowing the row's baselin
e, which won't be accurate | 698 // Ignoring the intrinsic padding as it depends on knowing the row's baselin
e, which won't be accurate |
699 // until the end of this function. | 699 // until the end of this function. |
700 int baselinePosition = cell->cellBaselinePosition() - cell->intrinsicPadding
Before(); | 700 int baselinePosition = cell->cellBaselinePosition() - cell->intrinsicPadding
Before(); |
701 if (baselinePosition > cell->borderBefore() + (cell->paddingBefore() - cell-
>intrinsicPaddingBefore())) { | 701 if (baselinePosition > cell->borderBefore() + (cell->paddingBefore() - cell-
>intrinsicPaddingBefore())) { |
702 m_grid[row].baseline = std::max(m_grid[row].baseline, baselinePosition); | 702 m_grid[row].baseline = std::max(m_grid[row].baseline, baselinePosition); |
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1725 // Repeating table headers are painted once per fragmentation page/column. T
his does not go through the regular fragmentation machinery, | 1725 // Repeating table headers are painted once per fragmentation page/column. T
his does not go through the regular fragmentation machinery, |
1726 // so we need special code to expand the invalidation rect to contain all po
sitions of the header in all columns. | 1726 // so we need special code to expand the invalidation rect to contain all po
sitions of the header in all columns. |
1727 // Note that this is in flow thread coordinates, not visual coordinates. The
enclosing LayoutFlowThread will convert to visual coordinates. | 1727 // Note that this is in flow thread coordinates, not visual coordinates. The
enclosing LayoutFlowThread will convert to visual coordinates. |
1728 if (table()->header() == this && hasRepeatingHeaderGroup()) | 1728 if (table()->header() == this && hasRepeatingHeaderGroup()) |
1729 rect.setHeight(table()->logicalHeight()); | 1729 rect.setHeight(table()->logicalHeight()); |
1730 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rec
t, flags); | 1730 return LayoutTableBoxComponent::mapToVisualRectInAncestorSpace(ancestor, rec
t, flags); |
1731 } | 1731 } |
1732 | 1732 |
1733 | 1733 |
1734 } // namespace blink | 1734 } // namespace blink |
OLD | NEW |