| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 LayoutMultiColumnFlowThread* flowThread = m_columnSet.multiColumnFlowThread(
); | 128 LayoutMultiColumnFlowThread* flowThread = m_columnSet.multiColumnFlowThread(
); |
| 129 LayoutRect layoutRect = flowThread->layoutOverflowRect(); | 129 LayoutRect layoutRect = flowThread->layoutOverflowRect(); |
| 130 m_logicalBottomInFlowThread = flowThread->isHorizontalWritingMode() ? layout
Rect.maxY() : layoutRect.maxX(); | 130 m_logicalBottomInFlowThread = flowThread->isHorizontalWritingMode() ? layout
Rect.maxY() : layoutRect.maxX(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 LayoutSize MultiColumnFragmentainerGroup::flowThreadTranslationAtOffset(LayoutUn
it offsetInFlowThread) const | 133 LayoutSize MultiColumnFragmentainerGroup::flowThreadTranslationAtOffset(LayoutUn
it offsetInFlowThread) const |
| 134 { | 134 { |
| 135 unsigned columnIndex = columnIndexAtOffset(offsetInFlowThread); | 135 unsigned columnIndex = columnIndexAtOffset(offsetInFlowThread); |
| 136 LayoutRect portionRect(flowThreadPortionRectAt(columnIndex)); | 136 LayoutRect portionRect(flowThreadPortionRectAt(columnIndex)); |
| 137 m_columnSet.flipForWritingMode(portionRect); | 137 m_columnSet.flipForWritingMode(portionRect); |
| 138 LayoutRect columnRect(columnRectAt(columnIndex)); | 138 LayoutSize translation(translationAtColumn(columnIndex)); |
| 139 m_columnSet.flipForWritingMode(columnRect); | 139 // TODO(mstensho): need a rectangle (not a point) to flip for writing mode h
ere, once we get support for multiple rows. |
| 140 return columnRect.location() - portionRect.location(); | 140 return toLayoutPoint(translation) - portionRect.location(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 LayoutUnit MultiColumnFragmentainerGroup::columnLogicalTopForOffset(LayoutUnit o
ffsetInFlowThread) const | 143 LayoutUnit MultiColumnFragmentainerGroup::columnLogicalTopForOffset(LayoutUnit o
ffsetInFlowThread) const |
| 144 { | 144 { |
| 145 unsigned columnIndex = columnIndexAtOffset(offsetInFlowThread, AssumeNewColu
mns); | 145 unsigned columnIndex = columnIndexAtOffset(offsetInFlowThread, AssumeNewColu
mns); |
| 146 return logicalTopInFlowThreadAt(columnIndex); | 146 return logicalTopInFlowThreadAt(columnIndex); |
| 147 } | 147 } |
| 148 | 148 |
| 149 LayoutPoint MultiColumnFragmentainerGroup::visualPointToFlowThreadPoint(const La
youtPoint& visualPoint) const | 149 LayoutPoint MultiColumnFragmentainerGroup::visualPointToFlowThreadPoint(const La
youtPoint& visualPoint) const |
| 150 { | 150 { |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 // amount of space shortage found during layout. | 431 // amount of space shortage found during layout. |
| 432 | 432 |
| 433 ASSERT(m_minSpaceShortage > 0); // We should never _shrink_ the height! | 433 ASSERT(m_minSpaceShortage > 0); // We should never _shrink_ the height! |
| 434 ASSERT(m_minSpaceShortage != LayoutFlowThread::maxLogicalHeight()); // If th
is happens, we probably have a bug. | 434 ASSERT(m_minSpaceShortage != LayoutFlowThread::maxLogicalHeight()); // If th
is happens, we probably have a bug. |
| 435 if (m_minSpaceShortage == LayoutFlowThread::maxLogicalHeight()) | 435 if (m_minSpaceShortage == LayoutFlowThread::maxLogicalHeight()) |
| 436 return m_columnHeight; // So bail out rather than looping infinitely. | 436 return m_columnHeight; // So bail out rather than looping infinitely. |
| 437 | 437 |
| 438 return m_columnHeight + m_minSpaceShortage; | 438 return m_columnHeight + m_minSpaceShortage; |
| 439 } | 439 } |
| 440 | 440 |
| 441 LayoutSize MultiColumnFragmentainerGroup::translationAtColumn(unsigned columnInd
ex) const |
| 442 { |
| 443 LayoutUnit logicalTopOffset; |
| 444 LayoutUnit logicalLeftOffset; |
| 445 LayoutUnit columnGap = m_columnSet.columnGap(); |
| 446 if (m_columnSet.multiColumnFlowThread()->progressionIsInline()) { |
| 447 logicalLeftOffset = columnIndex * (m_columnSet.pageLogicalWidth() + colu
mnGap); |
| 448 if (!m_columnSet.style()->isLeftToRightDirection()) |
| 449 logicalLeftOffset = -logicalLeftOffset; |
| 450 } else { |
| 451 logicalTopOffset = columnIndex * (m_columnHeight + columnGap); |
| 452 } |
| 453 |
| 454 LayoutSize offset(logicalLeftOffset, logicalTopOffset); |
| 455 return m_columnSet.isHorizontalWritingMode() ? offset : offset.transposedSiz
e(); |
| 456 } |
| 457 |
| 441 LayoutRect MultiColumnFragmentainerGroup::columnRectAt(unsigned columnIndex) con
st | 458 LayoutRect MultiColumnFragmentainerGroup::columnRectAt(unsigned columnIndex) con
st |
| 442 { | 459 { |
| 443 LayoutUnit columnLogicalWidth = m_columnSet.pageLogicalWidth(); | 460 LayoutUnit columnLogicalWidth = m_columnSet.pageLogicalWidth(); |
| 444 LayoutUnit columnLogicalHeight = m_columnHeight; | 461 LayoutUnit columnLogicalHeight = m_columnHeight; |
| 445 LayoutUnit columnLogicalTop; | 462 LayoutUnit columnLogicalTop; |
| 446 LayoutUnit columnLogicalLeft; | 463 LayoutUnit columnLogicalLeft; |
| 447 LayoutUnit columnGap = m_columnSet.columnGap(); | 464 LayoutUnit columnGap = m_columnSet.columnGap(); |
| 448 | 465 |
| 449 if (m_columnSet.multiColumnFlowThread()->progressionIsInline()) { | 466 if (m_columnSet.multiColumnFlowThread()->progressionIsInline()) { |
| 450 if (m_columnSet.style()->isLeftToRightDirection()) | 467 if (m_columnSet.style()->isLeftToRightDirection()) |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 append(MultiColumnFragmentainerGroup(m_columnSet)); | 570 append(MultiColumnFragmentainerGroup(m_columnSet)); |
| 554 return last(); | 571 return last(); |
| 555 } | 572 } |
| 556 | 573 |
| 557 void MultiColumnFragmentainerGroupList::deleteExtraGroups() | 574 void MultiColumnFragmentainerGroupList::deleteExtraGroups() |
| 558 { | 575 { |
| 559 shrink(1); | 576 shrink(1); |
| 560 } | 577 } |
| 561 | 578 |
| 562 } // namespace blink | 579 } // namespace blink |
| OLD | NEW |