OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 } | 65 } |
66 | 66 |
67 const MultiColumnFragmentainerGroup& LayoutMultiColumnSet::fragmentainerGroupAtV isualPoint(const LayoutPoint&) const | 67 const MultiColumnFragmentainerGroup& LayoutMultiColumnSet::fragmentainerGroupAtV isualPoint(const LayoutPoint&) const |
68 { | 68 { |
69 // FIXME: implement this, once we have support for multiple rows. | 69 // FIXME: implement this, once we have support for multiple rows. |
70 return m_fragmentainerGroups.first(); | 70 return m_fragmentainerGroups.first(); |
71 } | 71 } |
72 | 72 |
73 LayoutUnit LayoutMultiColumnSet::pageLogicalHeightForOffset(LayoutUnit offsetInF lowThread) const | 73 LayoutUnit LayoutMultiColumnSet::pageLogicalHeightForOffset(LayoutUnit offsetInF lowThread) const |
74 { | 74 { |
75 const MultiColumnFragmentainerGroup &lastRow = lastFragmentainerGroup(); | |
76 if (!lastRow.logicalHeight()) { | |
77 // In the first layout pass of an auto-height multicol container, height isn't set. No need | |
78 // to perform the series of complicated dance steps below to figure out that we should | |
79 // simply return 0. Bail now. | |
80 ASSERT(m_fragmentainerGroups.size() == 1); | |
81 return LayoutUnit(); | |
82 } | |
83 if (offsetInFlowThread >= lastRow.logicalTopInFlowThread() + lastRow.logical Height() * usedColumnCount()) { | |
84 // The offset is outside the bounds of the fragmentainer groups that we have established at | |
85 // this point. If we're nested inside another fragmentation context, we need to calculate | |
86 // the height on our own. | |
87 const LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread(); | |
88 if (FragmentationContext* enclosingFragmentationContext = flowThread->en closingFragmentationContext()) { | |
89 // We'd ideally like to translate |offsetInFlowThread| to an offset in the coordinate | |
90 // space of the enclosing fragmentation context here, but that's har d, since the offset | |
leviw_travelin_and_unemployed
2016/02/23 18:56:17
Ugh.
| |
91 // is out of bounds. So just use the bottom we have found so far. | |
92 LayoutUnit enclosingContextBottom = lastRow.blockOffsetInEnclosingFr agmentationContext() + lastRow.logicalHeight(); | |
93 LayoutUnit enclosingFragmentainerHeight = enclosingFragmentationCont ext->fragmentainerLogicalHeightAt(enclosingContextBottom); | |
94 // Constrain against specified height / max-height. | |
95 LayoutUnit currentMulticolHeight = logicalTopFromMulticolContentEdge () + lastRow.logicalTop() + lastRow.logicalHeight(); | |
96 LayoutUnit multicolHeightWithExtraRow = currentMulticolHeight + encl osingFragmentainerHeight; | |
97 multicolHeightWithExtraRow = std::min(multicolHeightWithExtraRow, fl owThread->maxColumnLogicalHeight()); | |
98 return std::max(LayoutUnit(1), multicolHeightWithExtraRow - currentM ulticolHeight); | |
99 } | |
100 } | |
75 return fragmentainerGroupAtFlowThreadOffset(offsetInFlowThread).logicalHeigh t(); | 101 return fragmentainerGroupAtFlowThreadOffset(offsetInFlowThread).logicalHeigh t(); |
76 } | 102 } |
77 | 103 |
78 LayoutUnit LayoutMultiColumnSet::pageRemainingLogicalHeightForOffset(LayoutUnit offsetInFlowThread, PageBoundaryRule pageBoundaryRule) const | 104 LayoutUnit LayoutMultiColumnSet::pageRemainingLogicalHeightForOffset(LayoutUnit offsetInFlowThread, PageBoundaryRule pageBoundaryRule) const |
79 { | 105 { |
80 const MultiColumnFragmentainerGroup& row = fragmentainerGroupAtFlowThreadOff set(offsetInFlowThread); | 106 const MultiColumnFragmentainerGroup& row = fragmentainerGroupAtFlowThreadOff set(offsetInFlowThread); |
81 LayoutUnit pageLogicalHeight = row.logicalHeight(); | 107 LayoutUnit pageLogicalHeight = row.logicalHeight(); |
82 ASSERT(pageLogicalHeight); // It's not allowed to call this method if the he ight is unknown. | 108 ASSERT(pageLogicalHeight); // It's not allowed to call this method if the he ight is unknown. |
83 LayoutUnit pageLogicalBottom = row.columnLogicalTopForOffset(offsetInFlowThr ead) + pageLogicalHeight; | 109 LayoutUnit pageLogicalBottom = row.columnLogicalTopForOffset(offsetInFlowThr ead) + pageLogicalHeight; |
84 LayoutUnit remainingLogicalHeight = pageLogicalBottom - offsetInFlowThread; | 110 LayoutUnit remainingLogicalHeight = pageLogicalBottom - offsetInFlowThread; |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 | 452 |
427 LayoutRect LayoutMultiColumnSet::flowThreadPortionRect() const | 453 LayoutRect LayoutMultiColumnSet::flowThreadPortionRect() const |
428 { | 454 { |
429 LayoutRect portionRect(LayoutUnit(), logicalTopInFlowThread(), pageLogicalWi dth(), logicalHeightInFlowThread()); | 455 LayoutRect portionRect(LayoutUnit(), logicalTopInFlowThread(), pageLogicalWi dth(), logicalHeightInFlowThread()); |
430 if (!isHorizontalWritingMode()) | 456 if (!isHorizontalWritingMode()) |
431 return portionRect.transposedRect(); | 457 return portionRect.transposedRect(); |
432 return portionRect; | 458 return portionRect; |
433 } | 459 } |
434 | 460 |
435 } // namespace blink | 461 } // namespace blink |
OLD | NEW |