| 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 LayoutUnit logicalTop = logicalTopInFlowThreadAt(columnIndex); | 409 LayoutUnit logicalTop = logicalTopInFlowThreadAt(columnIndex); |
| 410 LayoutUnit portionLogicalHeight = logicalHeightInFlowThreadAt(columnIndex); | 410 LayoutUnit portionLogicalHeight = logicalHeightInFlowThreadAt(columnIndex); |
| 411 if (m_columnSet.isHorizontalWritingMode()) | 411 if (m_columnSet.isHorizontalWritingMode()) |
| 412 return LayoutRect(LayoutUnit(), logicalTop, m_columnSet.pageLogicalWidth(), | 412 return LayoutRect(LayoutUnit(), logicalTop, m_columnSet.pageLogicalWidth(), |
| 413 portionLogicalHeight); | 413 portionLogicalHeight); |
| 414 return LayoutRect(logicalTop, LayoutUnit(), portionLogicalHeight, | 414 return LayoutRect(logicalTop, LayoutUnit(), portionLogicalHeight, |
| 415 m_columnSet.pageLogicalWidth()); | 415 m_columnSet.pageLogicalWidth()); |
| 416 } | 416 } |
| 417 | 417 |
| 418 LayoutRect MultiColumnFragmentainerGroup::flowThreadPortionOverflowRectAt( | 418 LayoutRect MultiColumnFragmentainerGroup::flowThreadPortionOverflowRectAt( |
| 419 unsigned columnIndex) const { | 419 unsigned columnIndex, |
| 420 ClipRectAxesSelector axesSelector) const { |
| 420 // This function determines the portion of the flow thread that paints for the | 421 // This function determines the portion of the flow thread that paints for the |
| 421 // column. Along the inline axis, columns are unclipped at outside edges | 422 // column. Along the inline axis, columns are unclipped at outside edges |
| 422 // (i.e., the first and last column in the set), and they clip to half the | 423 // (i.e., the first and last column in the set), and they clip to half the |
| 423 // column gap along interior edges. | 424 // column gap along interior edges. |
| 424 // | 425 // |
| 425 // In the block direction, we will not clip overflow out of the top of the | 426 // In the block direction, we will not clip overflow out of the top of the |
| 426 // first column, or out of the bottom of the last column. This applies only to | 427 // first column, or out of the bottom of the last column. This applies only to |
| 427 // the true first column and last column across all column sets. | 428 // the true first column and last column across all column sets. |
| 428 // | 429 // |
| 429 // FIXME: Eventually we will know overflow on a per-column basis, but we can't | 430 // FIXME: Eventually we will know overflow on a per-column basis, but we can't |
| (...skipping 17 matching lines...) Expand all Loading... |
| 447 // multicol container, in which case it should allow overflow. It will also | 448 // multicol container, in which case it should allow overflow. It will also |
| 448 // be clipped in the middle of adjacent column gaps. Care is taken here to | 449 // be clipped in the middle of adjacent column gaps. Care is taken here to |
| 449 // avoid rounding errors. | 450 // avoid rounding errors. |
| 450 LayoutRect overflowRect(LayoutRect::infiniteIntRect()); | 451 LayoutRect overflowRect(LayoutRect::infiniteIntRect()); |
| 451 LayoutUnit columnGap = m_columnSet.columnGap(); | 452 LayoutUnit columnGap = m_columnSet.columnGap(); |
| 452 if (m_columnSet.isHorizontalWritingMode()) { | 453 if (m_columnSet.isHorizontalWritingMode()) { |
| 453 if (!isFirstColumnInMulticolContainer) | 454 if (!isFirstColumnInMulticolContainer) |
| 454 overflowRect.shiftYEdgeTo(portionRect.y()); | 455 overflowRect.shiftYEdgeTo(portionRect.y()); |
| 455 if (!isLastColumnInMulticolContainer) | 456 if (!isLastColumnInMulticolContainer) |
| 456 overflowRect.shiftMaxYEdgeTo(portionRect.maxY()); | 457 overflowRect.shiftMaxYEdgeTo(portionRect.maxY()); |
| 457 if (!isLeftmostColumn) | 458 if (axesSelector == BothAxes) { |
| 458 overflowRect.shiftXEdgeTo(portionRect.x() - columnGap / 2); | 459 if (!isLeftmostColumn) |
| 459 if (!isRightmostColumn) | 460 overflowRect.shiftXEdgeTo(portionRect.x() - columnGap / 2); |
| 460 overflowRect.shiftMaxXEdgeTo(portionRect.maxX() + columnGap - | 461 if (!isRightmostColumn) { |
| 461 columnGap / 2); | 462 overflowRect.shiftMaxXEdgeTo(portionRect.maxX() + columnGap - |
| 463 columnGap / 2); |
| 464 } |
| 465 } |
| 462 } else { | 466 } else { |
| 463 if (!isFirstColumnInMulticolContainer) | 467 if (!isFirstColumnInMulticolContainer) |
| 464 overflowRect.shiftXEdgeTo(portionRect.x()); | 468 overflowRect.shiftXEdgeTo(portionRect.x()); |
| 465 if (!isLastColumnInMulticolContainer) | 469 if (!isLastColumnInMulticolContainer) |
| 466 overflowRect.shiftMaxXEdgeTo(portionRect.maxX()); | 470 overflowRect.shiftMaxXEdgeTo(portionRect.maxX()); |
| 467 if (!isLeftmostColumn) | 471 if (axesSelector == BothAxes) { |
| 468 overflowRect.shiftYEdgeTo(portionRect.y() - columnGap / 2); | 472 if (!isLeftmostColumn) |
| 469 if (!isRightmostColumn) | 473 overflowRect.shiftYEdgeTo(portionRect.y() - columnGap / 2); |
| 470 overflowRect.shiftMaxYEdgeTo(portionRect.maxY() + columnGap - | 474 if (!isRightmostColumn) { |
| 471 columnGap / 2); | 475 overflowRect.shiftMaxYEdgeTo(portionRect.maxY() + columnGap - |
| 476 columnGap / 2); |
| 477 } |
| 478 } |
| 472 } | 479 } |
| 473 return overflowRect; | 480 return overflowRect; |
| 474 } | 481 } |
| 475 | 482 |
| 476 unsigned MultiColumnFragmentainerGroup::columnIndexAtOffset( | 483 unsigned MultiColumnFragmentainerGroup::columnIndexAtOffset( |
| 477 LayoutUnit offsetInFlowThread, | 484 LayoutUnit offsetInFlowThread, |
| 478 LayoutBox::PageBoundaryRule pageBoundaryRule) const { | 485 LayoutBox::PageBoundaryRule pageBoundaryRule) const { |
| 479 // Handle the offset being out of range. | 486 // Handle the offset being out of range. |
| 480 if (offsetInFlowThread < m_logicalTopInFlowThread) | 487 if (offsetInFlowThread < m_logicalTopInFlowThread) |
| 481 return 0; | 488 return 0; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 MultiColumnFragmentainerGroupList::addExtraGroup() { | 600 MultiColumnFragmentainerGroupList::addExtraGroup() { |
| 594 append(MultiColumnFragmentainerGroup(m_columnSet)); | 601 append(MultiColumnFragmentainerGroup(m_columnSet)); |
| 595 return last(); | 602 return last(); |
| 596 } | 603 } |
| 597 | 604 |
| 598 void MultiColumnFragmentainerGroupList::deleteExtraGroups() { | 605 void MultiColumnFragmentainerGroupList::deleteExtraGroups() { |
| 599 shrink(1); | 606 shrink(1); |
| 600 } | 607 } |
| 601 | 608 |
| 602 } // namespace blink | 609 } // namespace blink |
| OLD | NEW |