OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "core/layout/MultiColumnFragmentainerGroup.h" | 7 #include "core/layout/MultiColumnFragmentainerGroup.h" |
8 | 8 |
9 #include "core/layout/LayoutMultiColumnSet.h" | 9 #include "core/layout/LayoutMultiColumnSet.h" |
10 | 10 |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 return m_columnSet.isHorizontalWritingMode() ? offset : offset.transposedSiz
e(); | 455 return m_columnSet.isHorizontalWritingMode() ? offset : offset.transposedSiz
e(); |
456 } | 456 } |
457 | 457 |
458 LayoutRect MultiColumnFragmentainerGroup::columnRectAt(unsigned columnIndex) con
st | 458 LayoutRect MultiColumnFragmentainerGroup::columnRectAt(unsigned columnIndex) con
st |
459 { | 459 { |
460 LayoutUnit columnLogicalWidth = m_columnSet.pageLogicalWidth(); | 460 LayoutUnit columnLogicalWidth = m_columnSet.pageLogicalWidth(); |
461 LayoutUnit columnLogicalHeight = m_columnHeight; | 461 LayoutUnit columnLogicalHeight = m_columnHeight; |
462 LayoutUnit columnLogicalTop; | 462 LayoutUnit columnLogicalTop; |
463 LayoutUnit columnLogicalLeft; | 463 LayoutUnit columnLogicalLeft; |
464 LayoutUnit columnGap = m_columnSet.columnGap(); | 464 LayoutUnit columnGap = m_columnSet.columnGap(); |
| 465 LayoutUnit portionOutsideFlowThread = logicalTopInFlowThread() + (columnInde
x + 1) * columnLogicalHeight - logicalBottomInFlowThread(); |
| 466 if (portionOutsideFlowThread > 0) { |
| 467 // The last column may not be using all available space. |
| 468 ASSERT(columnIndex + 1 == actualColumnCount()); |
| 469 columnLogicalHeight -= portionOutsideFlowThread; |
| 470 ASSERT(columnLogicalHeight >= 0); |
| 471 } |
465 | 472 |
466 if (m_columnSet.multiColumnFlowThread()->progressionIsInline()) { | 473 if (m_columnSet.multiColumnFlowThread()->progressionIsInline()) { |
467 if (m_columnSet.style()->isLeftToRightDirection()) | 474 if (m_columnSet.style()->isLeftToRightDirection()) |
468 columnLogicalLeft += columnIndex * (columnLogicalWidth + columnGap); | 475 columnLogicalLeft += columnIndex * (columnLogicalWidth + columnGap); |
469 else | 476 else |
470 columnLogicalLeft += m_columnSet.contentLogicalWidth() - columnLogic
alWidth - columnIndex * (columnLogicalWidth + columnGap); | 477 columnLogicalLeft += m_columnSet.contentLogicalWidth() - columnLogic
alWidth - columnIndex * (columnLogicalWidth + columnGap); |
471 } else { | 478 } else { |
472 columnLogicalTop += columnIndex * (columnLogicalHeight + columnGap); | 479 columnLogicalTop += columnIndex * (m_columnHeight + columnGap); |
473 } | 480 } |
474 | 481 |
475 LayoutRect columnRect(columnLogicalLeft, columnLogicalTop, columnLogicalWidt
h, columnLogicalHeight); | 482 LayoutRect columnRect(columnLogicalLeft, columnLogicalTop, columnLogicalWidt
h, columnLogicalHeight); |
476 if (!m_columnSet.isHorizontalWritingMode()) | 483 if (!m_columnSet.isHorizontalWritingMode()) |
477 return columnRect.transposedRect(); | 484 return columnRect.transposedRect(); |
478 return columnRect; | 485 return columnRect; |
479 } | 486 } |
480 | 487 |
481 LayoutRect MultiColumnFragmentainerGroup::flowThreadPortionRectAt(unsigned colum
nIndex) const | 488 LayoutRect MultiColumnFragmentainerGroup::flowThreadPortionRectAt(unsigned colum
nIndex) const |
482 { | 489 { |
483 LayoutUnit logicalTop = logicalTopInFlowThreadAt(columnIndex); | 490 LayoutUnit logicalTop = logicalTopInFlowThreadAt(columnIndex); |
| 491 LayoutUnit logicalBottom = logicalTop + m_columnHeight; |
| 492 if (logicalBottom > logicalBottomInFlowThread()) { |
| 493 // The last column may not be using all available space. |
| 494 ASSERT(columnIndex + 1 == actualColumnCount()); |
| 495 logicalBottom = logicalBottomInFlowThread(); |
| 496 ASSERT(logicalBottom >= logicalTop); |
| 497 } |
| 498 LayoutUnit portionLogicalHeight = logicalBottom - logicalTop; |
484 if (m_columnSet.isHorizontalWritingMode()) | 499 if (m_columnSet.isHorizontalWritingMode()) |
485 return LayoutRect(LayoutUnit(), logicalTop, m_columnSet.pageLogicalWidth
(), m_columnHeight); | 500 return LayoutRect(LayoutUnit(), logicalTop, m_columnSet.pageLogicalWidth
(), portionLogicalHeight); |
486 return LayoutRect(logicalTop, LayoutUnit(), m_columnHeight, m_columnSet.page
LogicalWidth()); | 501 return LayoutRect(logicalTop, LayoutUnit(), portionLogicalHeight, m_columnSe
t.pageLogicalWidth()); |
487 } | 502 } |
488 | 503 |
489 LayoutRect MultiColumnFragmentainerGroup::flowThreadPortionOverflowRect(const La
youtRect& portionRect, unsigned columnIndex, unsigned columnCount, LayoutUnit co
lumnGap) const | 504 LayoutRect MultiColumnFragmentainerGroup::flowThreadPortionOverflowRect(const La
youtRect& portionRect, unsigned columnIndex, unsigned columnCount, LayoutUnit co
lumnGap) const |
490 { | 505 { |
491 // This function determines the portion of the flow thread that paints for t
he column. Along the inline axis, columns are | 506 // This function determines the portion of the flow thread that paints for t
he column. Along the inline axis, columns are |
492 // unclipped at outside edges (i.e., the first and last column in the set),
and they clip to half the column | 507 // unclipped at outside edges (i.e., the first and last column in the set),
and they clip to half the column |
493 // gap along interior edges. | 508 // gap along interior edges. |
494 // | 509 // |
495 // In the block direction, we will not clip overflow out of the top of the f
irst column, or out of the bottom of | 510 // In the block direction, we will not clip overflow out of the top of the f
irst column, or out of the bottom of |
496 // the last column. This applies only to the true first column and last colu
mn across all column sets. | 511 // the last column. This applies only to the true first column and last colu
mn across all column sets. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 append(MultiColumnFragmentainerGroup(m_columnSet)); | 593 append(MultiColumnFragmentainerGroup(m_columnSet)); |
579 return last(); | 594 return last(); |
580 } | 595 } |
581 | 596 |
582 void MultiColumnFragmentainerGroupList::deleteExtraGroups() | 597 void MultiColumnFragmentainerGroupList::deleteExtraGroups() |
583 { | 598 { |
584 shrink(1); | 599 shrink(1); |
585 } | 600 } |
586 | 601 |
587 } // namespace blink | 602 } // namespace blink |
OLD | NEW |