Chromium Code Reviews| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 // and will confuse and cause problems in other parts of the code. | 273 // and will confuse and cause problems in other parts of the code. |
| 274 if (!m_columnHeight) | 274 if (!m_columnHeight) |
| 275 return 1; | 275 return 1; |
| 276 | 276 |
| 277 // Our flow thread portion determines our column count. We have as many colu mns as needed to fit | 277 // Our flow thread portion determines our column count. We have as many colu mns as needed to fit |
| 278 // all the content. | 278 // all the content. |
| 279 LayoutUnit flowThreadPortionHeight = logicalHeightInFlowThread(); | 279 LayoutUnit flowThreadPortionHeight = logicalHeightInFlowThread(); |
| 280 if (!flowThreadPortionHeight) | 280 if (!flowThreadPortionHeight) |
| 281 return 1; | 281 return 1; |
| 282 | 282 |
| 283 unsigned count = ceil(flowThreadPortionHeight.toFloat() / m_columnHeight.toF loat()); | 283 unsigned count = (flowThreadPortionHeight / m_columnHeight).floor(); |
| 284 // flowThreadPortionHeight may be saturated, so detect the remainder manuall y. | |
| 285 if (count * m_columnHeight < flowThreadPortionHeight) | |
|
mstensho (USE GERRIT)
2015/08/17 11:18:00
If you can suggest something that looks less silly
eae
2015/08/17 21:34:53
We could check if the value is LayoutUnit::max but
| |
| 286 count++; | |
| 284 ASSERT(count >= 1); | 287 ASSERT(count >= 1); |
| 285 return count; | 288 return count; |
| 286 } | 289 } |
| 287 | 290 |
| 288 LayoutUnit MultiColumnFragmentainerGroup::heightAdjustedForRowOffset(LayoutUnit height) const | 291 LayoutUnit MultiColumnFragmentainerGroup::heightAdjustedForRowOffset(LayoutUnit height) const |
| 289 { | 292 { |
| 290 // Adjust for the top offset within the content box of the multicol containe r (containing | 293 // Adjust for the top offset within the content box of the multicol containe r (containing |
| 291 // block), unless we're in the first set. We know that the top offset for th e first set will be | 294 // block), unless we're in the first set. We know that the top offset for th e first set will be |
| 292 // zero, but if the multicol container has non-zero top border or padding, t he set's top offset | 295 // zero, but if the multicol container has non-zero top border or padding, t he set's top offset |
| 293 // (initially being 0 and relative to the border box) will be negative until it has been laid | 296 // (initially being 0 and relative to the border box) will be negative until it has been laid |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 append(MultiColumnFragmentainerGroup(m_columnSet)); | 589 append(MultiColumnFragmentainerGroup(m_columnSet)); |
| 587 return last(); | 590 return last(); |
| 588 } | 591 } |
| 589 | 592 |
| 590 void MultiColumnFragmentainerGroupList::deleteExtraGroups() | 593 void MultiColumnFragmentainerGroupList::deleteExtraGroups() |
| 591 { | 594 { |
| 592 shrink(1); | 595 shrink(1); |
| 593 } | 596 } |
| 594 | 597 |
| 595 } // namespace blink | 598 } // namespace blink |
| OLD | NEW |