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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 LayoutUnit blockOffsetInFlowThread = previousGroup.logicalTopInFlowThrea
d() + previousGroup.logicalHeight() * usedColumnCount(); | 163 LayoutUnit blockOffsetInFlowThread = previousGroup.logicalTopInFlowThrea
d() + previousGroup.logicalHeight() * usedColumnCount(); |
164 previousGroup.setLogicalBottomInFlowThread(blockOffsetInFlowThread); | 164 previousGroup.setLogicalBottomInFlowThread(blockOffsetInFlowThread); |
165 newGroup.setLogicalTopInFlowThread(blockOffsetInFlowThread); | 165 newGroup.setLogicalTopInFlowThread(blockOffsetInFlowThread); |
166 newGroup.setLogicalTop(previousGroup.logicalTop() + previousGroup.logica
lHeight()); | 166 newGroup.setLogicalTop(previousGroup.logicalTop() + previousGroup.logica
lHeight()); |
167 newGroup.resetColumnHeight(); | 167 newGroup.resetColumnHeight(); |
168 } | 168 } |
169 m_fragmentainerGroups.append(newGroup); | 169 m_fragmentainerGroups.append(newGroup); |
170 return m_fragmentainerGroups.last(); | 170 return m_fragmentainerGroups.last(); |
171 } | 171 } |
172 | 172 |
| 173 LayoutUnit LayoutMultiColumnSet::logicalTopFromMulticolContentEdge() const |
| 174 { |
| 175 // We subtract the position of the first column set or spanner placeholder,
rather than the |
| 176 // "before" border+padding of the multicol container. This distinction doesn
't matter after |
| 177 // layout, but during layout it does: The flow thread (i.e. the multicol con
tents) is laid out |
| 178 // before the column sets and spanner placeholders, which means that compesa
ting for a top |
| 179 // border+padding that hasn't yet been baked into the offset will produce th
e wrong results in |
| 180 // the first layout pass, and we'd end up performing a wasted layout pass in
many cases. |
| 181 const LayoutBox& firstColumnBox = *multiColumnFlowThread()->firstMultiColumn
Box(); |
| 182 // The top margin edge of the first column set or spanner placeholder is flu
sh with the top |
| 183 // content edge of the multicol container. The margin here never collapses w
ith other margins, |
| 184 // so we can just subtract it. Column sets never have margins, but spanner p
laceholders may. |
| 185 LayoutUnit firstColumnBoxMarginEdge = firstColumnBox.logicalTop() - multiCol
umnBlockFlow()->marginBeforeForChild(firstColumnBox); |
| 186 return logicalTop() - firstColumnBoxMarginEdge; |
| 187 } |
| 188 |
173 LayoutUnit LayoutMultiColumnSet::logicalTopInFlowThread() const | 189 LayoutUnit LayoutMultiColumnSet::logicalTopInFlowThread() const |
174 { | 190 { |
175 return firstFragmentainerGroup().logicalTopInFlowThread(); | 191 return firstFragmentainerGroup().logicalTopInFlowThread(); |
176 } | 192 } |
177 | 193 |
178 LayoutUnit LayoutMultiColumnSet::logicalBottomInFlowThread() const | 194 LayoutUnit LayoutMultiColumnSet::logicalBottomInFlowThread() const |
179 { | 195 { |
180 return lastFragmentainerGroup().logicalBottomInFlowThread(); | 196 return lastFragmentainerGroup().logicalBottomInFlowThread(); |
181 } | 197 } |
182 | 198 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 419 |
404 LayoutRect LayoutMultiColumnSet::flowThreadPortionRect() const | 420 LayoutRect LayoutMultiColumnSet::flowThreadPortionRect() const |
405 { | 421 { |
406 LayoutRect portionRect(LayoutUnit(), logicalTopInFlowThread(), pageLogicalWi
dth(), logicalHeightInFlowThread()); | 422 LayoutRect portionRect(LayoutUnit(), logicalTopInFlowThread(), pageLogicalWi
dth(), logicalHeightInFlowThread()); |
407 if (!isHorizontalWritingMode()) | 423 if (!isHorizontalWritingMode()) |
408 return portionRect.transposedRect(); | 424 return portionRect.transposedRect(); |
409 return portionRect; | 425 return portionRect; |
410 } | 426 } |
411 | 427 |
412 } | 428 } |
OLD | NEW |