| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool LayoutMultiColumnSet::isPageLogicalHeightKnown() const | 96 bool LayoutMultiColumnSet::isPageLogicalHeightKnown() const |
| 97 { | 97 { |
| 98 return firstFragmentainerGroup().logicalHeight(); | 98 return firstFragmentainerGroup().logicalHeight(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 LayoutUnit LayoutMultiColumnSet::nextLogicalTopForUnbreakableContent(LayoutUnit
flowThreadOffset, LayoutUnit contentLogicalHeight) const | 101 LayoutUnit LayoutMultiColumnSet::nextLogicalTopForUnbreakableContent(LayoutUnit
flowThreadOffset, LayoutUnit contentLogicalHeight) const |
| 102 { | 102 { |
| 103 ASSERT(pageLogicalTopForOffset(flowThreadOffset) == flowThreadOffset); | 103 ASSERT(pageLogicalTopForOffset(flowThreadOffset) == flowThreadOffset); |
| 104 LayoutMultiColumnFlowThread* enclosingFlowThread = multiColumnFlowThread()->
enclosingFlowThread(); | 104 FragmentationContext* enclosingFragmentationContext = multiColumnFlowThread(
)->enclosingFragmentationContext(); |
| 105 if (!enclosingFlowThread) { | 105 if (!enclosingFragmentationContext) { |
| 106 // If there's no enclosing fragmentation context, there'll ever be only
one row, and all | 106 // If there's no enclosing fragmentation context, there'll ever be only
one row, and all |
| 107 // columns there will have the same height. | 107 // columns there will have the same height. |
| 108 return flowThreadOffset; | 108 return flowThreadOffset; |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Assert the problematic situation. If we have no problem with the column h
eight, why are we | 111 // Assert the problematic situation. If we have no problem with the column h
eight, why are we |
| 112 // even here? | 112 // even here? |
| 113 ASSERT(pageLogicalHeightForOffset(flowThreadOffset) < contentLogicalHeight); | 113 ASSERT(pageLogicalHeightForOffset(flowThreadOffset) < contentLogicalHeight); |
| 114 | 114 |
| 115 // There's a likelihood for subsequent rows to be taller than the first one. | 115 // There's a likelihood for subsequent rows to be taller than the first one. |
| 116 // TODO(mstensho): if we're doubly nested (e.g. multicol in multicol in mult
icol), we need to | 116 // TODO(mstensho): if we're doubly nested (e.g. multicol in multicol in mult
icol), we need to |
| 117 // look beyond the first row here. | 117 // look beyond the first row here. |
| 118 const MultiColumnFragmentainerGroup& firstRow = firstFragmentainerGroup(); | 118 const MultiColumnFragmentainerGroup& firstRow = firstFragmentainerGroup(); |
| 119 LayoutUnit firstRowLogicalBottomInFlowThread = firstRow.logicalTopInFlowThre
ad() + firstRow.logicalHeight() * usedColumnCount(); | 119 LayoutUnit firstRowLogicalBottomInFlowThread = firstRow.logicalTopInFlowThre
ad() + firstRow.logicalHeight() * usedColumnCount(); |
| 120 if (flowThreadOffset >= firstRowLogicalBottomInFlowThread) | 120 if (flowThreadOffset >= firstRowLogicalBottomInFlowThread) |
| 121 return flowThreadOffset; // We're not in the first row. Give up. | 121 return flowThreadOffset; // We're not in the first row. Give up. |
| 122 LayoutUnit newLogicalHeight = enclosingFlowThread->pageLogicalHeightForOffse
t(firstRowLogicalBottomInFlowThread); | 122 LayoutUnit newLogicalHeight = enclosingFragmentationContext->fragmentainerLo
gicalHeightAt(firstRowLogicalBottomInFlowThread); |
| 123 if (contentLogicalHeight > newLogicalHeight) { | 123 if (contentLogicalHeight > newLogicalHeight) { |
| 124 // The next outer column or page doesn't have enough space either. Give
up and stay where | 124 // The next outer column or page doesn't have enough space either. Give
up and stay where |
| 125 // we are. | 125 // we are. |
| 126 return flowThreadOffset; | 126 return flowThreadOffset; |
| 127 } | 127 } |
| 128 return firstRowLogicalBottomInFlowThread; | 128 return firstRowLogicalBottomInFlowThread; |
| 129 } | 129 } |
| 130 | 130 |
| 131 LayoutMultiColumnSet* LayoutMultiColumnSet::nextSiblingMultiColumnSet() const | 131 LayoutMultiColumnSet* LayoutMultiColumnSet::nextSiblingMultiColumnSet() const |
| 132 { | 132 { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 return row.visualPointToFlowThreadPoint(visualPoint - row.offsetFromColumnSe
t()); | 248 return row.visualPointToFlowThreadPoint(visualPoint - row.offsetFromColumnSe
t()); |
| 249 } | 249 } |
| 250 | 250 |
| 251 LayoutUnit LayoutMultiColumnSet::pageLogicalTopForOffset(LayoutUnit offset) cons
t | 251 LayoutUnit LayoutMultiColumnSet::pageLogicalTopForOffset(LayoutUnit offset) cons
t |
| 252 { | 252 { |
| 253 return fragmentainerGroupAtFlowThreadOffset(offset).columnLogicalTopForOffse
t(offset); | 253 return fragmentainerGroupAtFlowThreadOffset(offset).columnLogicalTopForOffse
t(offset); |
| 254 } | 254 } |
| 255 | 255 |
| 256 bool LayoutMultiColumnSet::recalculateColumnHeight() | 256 bool LayoutMultiColumnSet::recalculateColumnHeight() |
| 257 { | 257 { |
| 258 if (m_oldLogicalTop != logicalTop() && multiColumnFlowThread()->enclosingFlo
wThread()) { | 258 if (m_oldLogicalTop != logicalTop() && multiColumnFlowThread()->enclosingFra
gmentationContext()) { |
| 259 // Preceding spanners or column sets have been moved or resized. This me
ans that the | 259 // Preceding spanners or column sets have been moved or resized. This me
ans that the |
| 260 // fragmentainer groups that we have inserted need to be re-inserted. Re
start column | 260 // fragmentainer groups that we have inserted need to be re-inserted. Re
start column |
| 261 // balancing. | 261 // balancing. |
| 262 resetColumnHeight(); | 262 resetColumnHeight(); |
| 263 return true; | 263 return true; |
| 264 } | 264 } |
| 265 | 265 |
| 266 bool changed = false; | 266 bool changed = false; |
| 267 for (auto& group : m_fragmentainerGroups) | 267 for (auto& group : m_fragmentainerGroups) |
| 268 changed = group.recalculateColumnHeight() || changed; | 268 changed = group.recalculateColumnHeight() || changed; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 398 |
| 399 LayoutRect LayoutMultiColumnSet::flowThreadPortionRect() const | 399 LayoutRect LayoutMultiColumnSet::flowThreadPortionRect() const |
| 400 { | 400 { |
| 401 LayoutRect portionRect(LayoutUnit(), logicalTopInFlowThread(), pageLogicalWi
dth(), logicalHeightInFlowThread()); | 401 LayoutRect portionRect(LayoutUnit(), logicalTopInFlowThread(), pageLogicalWi
dth(), logicalHeightInFlowThread()); |
| 402 if (!isHorizontalWritingMode()) | 402 if (!isHorizontalWritingMode()) |
| 403 return portionRect.transposedRect(); | 403 return portionRect.transposedRect(); |
| 404 return portionRect; | 404 return portionRect; |
| 405 } | 405 } |
| 406 | 406 |
| 407 } | 407 } |
| OLD | NEW |