| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 LayoutRect columnRect(columnRectAt(columnIndex)); |
| 139 m_columnSet.flipForWritingMode(columnRect); | 139 m_columnSet.flipForWritingMode(columnRect); |
| 140 return columnRect.location() - portionRect.location(); | 140 return columnRect.location() - 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 m_logicalTopInFlowThread + columnIndex * m_columnHeight; | 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 { |
| 151 unsigned columnIndex = columnIndexAtVisualPoint(visualPoint); | 151 unsigned columnIndex = columnIndexAtVisualPoint(visualPoint); |
| 152 LayoutRect columnRect = columnRectAt(columnIndex); | 152 LayoutRect columnRect = columnRectAt(columnIndex); |
| 153 LayoutPoint localPoint(visualPoint); | 153 LayoutPoint localPoint(visualPoint); |
| 154 localPoint.moveBy(-columnRect.location()); | 154 localPoint.moveBy(-columnRect.location()); |
| 155 // Before converting to a flow thread position, if the block direction coord
inate is outside the | 155 // Before converting to a flow thread position, if the block direction coord
inate is outside the |
| 156 // column, snap to the bounds of the column, and reset the inline direction
coordinate to the | 156 // column, snap to the bounds of the column, and reset the inline direction
coordinate to the |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 } | 449 } |
| 450 | 450 |
| 451 LayoutRect columnRect(columnLogicalLeft, columnLogicalTop, columnLogicalWidt
h, columnLogicalHeight); | 451 LayoutRect columnRect(columnLogicalLeft, columnLogicalTop, columnLogicalWidt
h, columnLogicalHeight); |
| 452 if (!m_columnSet.isHorizontalWritingMode()) | 452 if (!m_columnSet.isHorizontalWritingMode()) |
| 453 return columnRect.transposedRect(); | 453 return columnRect.transposedRect(); |
| 454 return columnRect; | 454 return columnRect; |
| 455 } | 455 } |
| 456 | 456 |
| 457 LayoutRect MultiColumnFragmentainerGroup::flowThreadPortionRectAt(unsigned colum
nIndex) const | 457 LayoutRect MultiColumnFragmentainerGroup::flowThreadPortionRectAt(unsigned colum
nIndex) const |
| 458 { | 458 { |
| 459 LayoutUnit logicalTop = m_logicalTopInFlowThread + columnIndex * m_columnHei
ght; | 459 LayoutUnit logicalTop = logicalTopInFlowThreadAt(columnIndex); |
| 460 if (m_columnSet.isHorizontalWritingMode()) | 460 if (m_columnSet.isHorizontalWritingMode()) |
| 461 return LayoutRect(LayoutUnit(), logicalTop, m_columnSet.pageLogicalWidth
(), m_columnHeight); | 461 return LayoutRect(LayoutUnit(), logicalTop, m_columnSet.pageLogicalWidth
(), m_columnHeight); |
| 462 return LayoutRect(logicalTop, LayoutUnit(), m_columnHeight, m_columnSet.page
LogicalWidth()); | 462 return LayoutRect(logicalTop, LayoutUnit(), m_columnHeight, m_columnSet.page
LogicalWidth()); |
| 463 } | 463 } |
| 464 | 464 |
| 465 LayoutRect MultiColumnFragmentainerGroup::flowThreadPortionOverflowRect(const La
youtRect& portionRect, unsigned columnIndex, unsigned columnCount, LayoutUnit co
lumnGap) const | 465 LayoutRect MultiColumnFragmentainerGroup::flowThreadPortionOverflowRect(const La
youtRect& portionRect, unsigned columnIndex, unsigned columnCount, LayoutUnit co
lumnGap) const |
| 466 { | 466 { |
| 467 // This function determines the portion of the flow thread that paints for t
he column. Along the inline axis, columns are | 467 // This function determines the portion of the flow thread that paints for t
he column. Along the inline axis, columns are |
| 468 // unclipped at outside edges (i.e., the first and last column in the set),
and they clip to half the column | 468 // unclipped at outside edges (i.e., the first and last column in the set),
and they clip to half the column |
| 469 // gap along interior edges. | 469 // gap along interior edges. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 append(MultiColumnFragmentainerGroup(m_columnSet)); | 546 append(MultiColumnFragmentainerGroup(m_columnSet)); |
| 547 return last(); | 547 return last(); |
| 548 } | 548 } |
| 549 | 549 |
| 550 void MultiColumnFragmentainerGroupList::deleteExtraGroups() | 550 void MultiColumnFragmentainerGroupList::deleteExtraGroups() |
| 551 { | 551 { |
| 552 shrink(1); | 552 shrink(1); |
| 553 } | 553 } |
| 554 | 554 |
| 555 } // namespace blink | 555 } // namespace blink |
| OLD | NEW |