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 "core/layout/MultiColumnFragmentainerGroup.h" | 5 #include "core/layout/MultiColumnFragmentainerGroup.h" |
6 | 6 |
7 #include "core/layout/ColumnBalancer.h" | 7 #include "core/layout/ColumnBalancer.h" |
8 #include "core/layout/FragmentationContext.h" | 8 #include "core/layout/FragmentationContext.h" |
9 #include "core/layout/LayoutMultiColumnSet.h" | 9 #include "core/layout/LayoutMultiColumnSet.h" |
10 | 10 |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 return 0; | 430 return 0; |
431 return std::min(unsigned(index), actualColumnCount() - 1); | 431 return std::min(unsigned(index), actualColumnCount() - 1); |
432 } | 432 } |
433 | 433 |
434 void MultiColumnFragmentainerGroup::columnIntervalForBlockRangeInFlowThread(Layo utUnit logicalTopInFlowThread, LayoutUnit logicalBottomInFlowThread, unsigned& f irstColumn, unsigned& lastColumn) const | 434 void MultiColumnFragmentainerGroup::columnIntervalForBlockRangeInFlowThread(Layo utUnit logicalTopInFlowThread, LayoutUnit logicalBottomInFlowThread, unsigned& f irstColumn, unsigned& lastColumn) const |
435 { | 435 { |
436 logicalTopInFlowThread = std::max(logicalTopInFlowThread, this->logicalTopIn FlowThread()); | 436 logicalTopInFlowThread = std::max(logicalTopInFlowThread, this->logicalTopIn FlowThread()); |
437 logicalBottomInFlowThread = std::min(logicalBottomInFlowThread, this->logica lBottomInFlowThread()); | 437 logicalBottomInFlowThread = std::min(logicalBottomInFlowThread, this->logica lBottomInFlowThread()); |
438 ASSERT(logicalTopInFlowThread <= logicalBottomInFlowThread); | 438 ASSERT(logicalTopInFlowThread <= logicalBottomInFlowThread); |
439 firstColumn = columnIndexAtOffset(logicalTopInFlowThread, LayoutBox::Associa teWithLatterPage); | 439 firstColumn = columnIndexAtOffset(logicalTopInFlowThread, LayoutBox::Associa teWithLatterPage); |
440 lastColumn = columnIndexAtOffset(logicalBottomInFlowThread, LayoutBox::Assoc iateWithFormerPage); | 440 if (logicalBottomInFlowThread == logicalTopInFlowThread) { |
441 // Zero-height block range. There'll be one column in the interval. Set it right away. This | |
442 // is important if we're at a column boundary, since calling columnIndex AtOffset() with the | |
443 // end-exclusive bottom offset would actually give us the *previous* col umn. | |
444 lastColumn = firstColumn; | |
mstensho (USE GERRIT)
2016/09/28 19:58:55
There's something fishy about this whole PageBound
eae
2016/09/28 20:55:17
Yeah, this smells bad. Would you mind filing a bug
mstensho (USE GERRIT)
2016/09/28 21:20:23
Good idea! crbug.com/651213
| |
445 } else { | |
446 lastColumn = columnIndexAtOffset(logicalBottomInFlowThread, LayoutBox::A ssociateWithFormerPage); | |
447 } | |
441 } | 448 } |
442 | 449 |
443 void MultiColumnFragmentainerGroup::columnIntervalForVisualRect(const LayoutRect & rect, unsigned& firstColumn, unsigned& lastColumn) const | 450 void MultiColumnFragmentainerGroup::columnIntervalForVisualRect(const LayoutRect & rect, unsigned& firstColumn, unsigned& lastColumn) const |
444 { | 451 { |
445 bool isColumnProgressionInline = m_columnSet.multiColumnFlowThread()->progre ssionIsInline(); | 452 bool isColumnProgressionInline = m_columnSet.multiColumnFlowThread()->progre ssionIsInline(); |
446 bool isFlippedColumnProgression = !m_columnSet.style()->isLeftToRightDirecti on() && isColumnProgressionInline; | 453 bool isFlippedColumnProgression = !m_columnSet.style()->isLeftToRightDirecti on() && isColumnProgressionInline; |
447 if (m_columnSet.isHorizontalWritingMode() == isColumnProgressionInline) { | 454 if (m_columnSet.isHorizontalWritingMode() == isColumnProgressionInline) { |
448 if (isFlippedColumnProgression) { | 455 if (isFlippedColumnProgression) { |
449 firstColumn = columnIndexAtVisualPoint(rect.maxXMinYCorner()); | 456 firstColumn = columnIndexAtVisualPoint(rect.maxXMinYCorner()); |
450 lastColumn = columnIndexAtVisualPoint(rect.minXMinYCorner()); | 457 lastColumn = columnIndexAtVisualPoint(rect.minXMinYCorner()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
484 append(MultiColumnFragmentainerGroup(m_columnSet)); | 491 append(MultiColumnFragmentainerGroup(m_columnSet)); |
485 return last(); | 492 return last(); |
486 } | 493 } |
487 | 494 |
488 void MultiColumnFragmentainerGroupList::deleteExtraGroups() | 495 void MultiColumnFragmentainerGroupList::deleteExtraGroups() |
489 { | 496 { |
490 shrink(1); | 497 shrink(1); |
491 } | 498 } |
492 | 499 |
493 } // namespace blink | 500 } // namespace blink |
OLD | NEW |