| 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 bool isLeftmostColumn = isLTR ? isFirstColumnInRow : isLastColumnInRow; | 439 bool isLeftmostColumn = isLTR ? isFirstColumnInRow : isLastColumnInRow; |
| 440 bool isRightmostColumn = isLTR ? isLastColumnInRow : isFirstColumnInRow; | 440 bool isRightmostColumn = isLTR ? isLastColumnInRow : isFirstColumnInRow; |
| 441 | 441 |
| 442 LayoutRect portionRect = flowThreadPortionRectAt(columnIndex); | 442 LayoutRect portionRect = flowThreadPortionRectAt(columnIndex); |
| 443 bool isFirstColumnInMulticolContainer = | 443 bool isFirstColumnInMulticolContainer = |
| 444 isFirstColumnInRow && this == &m_columnSet.firstFragmentainerGroup() && | 444 isFirstColumnInRow && this == &m_columnSet.firstFragmentainerGroup() && |
| 445 !m_columnSet.previousSiblingMultiColumnSet(); | 445 !m_columnSet.previousSiblingMultiColumnSet(); |
| 446 bool isLastColumnInMulticolContainer = | 446 bool isLastColumnInMulticolContainer = |
| 447 isLastColumnInRow && this == &m_columnSet.lastFragmentainerGroup() && | 447 isLastColumnInRow && this == &m_columnSet.lastFragmentainerGroup() && |
| 448 !m_columnSet.nextSiblingMultiColumnSet(); | 448 !m_columnSet.nextSiblingMultiColumnSet(); |
| 449 // Calculate the overflow rectangle, based on the flow thread's, clipped at | 449 // Calculate the overflow rectangle. It will be clipped at the logical top |
| 450 // column logical top/bottom unless it's the first/last column. | 450 // and bottom of the column box, unless it's the first or last column in the |
| 451 LayoutRect overflowRect = m_columnSet.overflowRectForFlowThreadPortion( | 451 // multicol container, in which case it should allow overflow. It will also |
| 452 portionRect, isFirstColumnInMulticolContainer, | 452 // be clipped in the middle of adjacent column gaps. Care is taken here to |
| 453 isLastColumnInMulticolContainer); | 453 // avoid rounding errors. |
| 454 | 454 LayoutRect overflowRect(LayoutRect::infiniteIntRect()); |
| 455 // Avoid overflowing into neighboring columns, by clipping in the middle of | |
| 456 // adjacent column gaps. Also make sure that we avoid rounding errors. | |
| 457 LayoutUnit columnGap = m_columnSet.columnGap(); | 455 LayoutUnit columnGap = m_columnSet.columnGap(); |
| 458 if (m_columnSet.isHorizontalWritingMode()) { | 456 if (m_columnSet.isHorizontalWritingMode()) { |
| 457 if (!isFirstColumnInMulticolContainer) |
| 458 overflowRect.shiftYEdgeTo(portionRect.y()); |
| 459 if (!isLastColumnInMulticolContainer) |
| 460 overflowRect.shiftMaxYEdgeTo(portionRect.maxY()); |
| 459 if (!isLeftmostColumn) | 461 if (!isLeftmostColumn) |
| 460 overflowRect.shiftXEdgeTo(portionRect.x() - columnGap / 2); | 462 overflowRect.shiftXEdgeTo(portionRect.x() - columnGap / 2); |
| 461 if (!isRightmostColumn) | 463 if (!isRightmostColumn) |
| 462 overflowRect.shiftMaxXEdgeTo(portionRect.maxX() + columnGap - | 464 overflowRect.shiftMaxXEdgeTo(portionRect.maxX() + columnGap - |
| 463 columnGap / 2); | 465 columnGap / 2); |
| 464 } else { | 466 } else { |
| 467 if (!isFirstColumnInMulticolContainer) |
| 468 overflowRect.shiftXEdgeTo(portionRect.x()); |
| 469 if (!isLastColumnInMulticolContainer) |
| 470 overflowRect.shiftMaxXEdgeTo(portionRect.maxX()); |
| 465 if (!isLeftmostColumn) | 471 if (!isLeftmostColumn) |
| 466 overflowRect.shiftYEdgeTo(portionRect.y() - columnGap / 2); | 472 overflowRect.shiftYEdgeTo(portionRect.y() - columnGap / 2); |
| 467 if (!isRightmostColumn) | 473 if (!isRightmostColumn) |
| 468 overflowRect.shiftMaxYEdgeTo(portionRect.maxY() + columnGap - | 474 overflowRect.shiftMaxYEdgeTo(portionRect.maxY() + columnGap - |
| 469 columnGap / 2); | 475 columnGap / 2); |
| 470 } | 476 } |
| 471 return overflowRect; | 477 return overflowRect; |
| 472 } | 478 } |
| 473 | 479 |
| 474 unsigned MultiColumnFragmentainerGroup::columnIndexAtOffset( | 480 unsigned MultiColumnFragmentainerGroup::columnIndexAtOffset( |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 MultiColumnFragmentainerGroupList::addExtraGroup() { | 598 MultiColumnFragmentainerGroupList::addExtraGroup() { |
| 593 append(MultiColumnFragmentainerGroup(m_columnSet)); | 599 append(MultiColumnFragmentainerGroup(m_columnSet)); |
| 594 return last(); | 600 return last(); |
| 595 } | 601 } |
| 596 | 602 |
| 597 void MultiColumnFragmentainerGroupList::deleteExtraGroups() { | 603 void MultiColumnFragmentainerGroupList::deleteExtraGroups() { |
| 598 shrink(1); | 604 shrink(1); |
| 599 } | 605 } |
| 600 | 606 |
| 601 } // namespace blink | 607 } // namespace blink |
| OLD | NEW |