Chromium Code Reviews| 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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 578 LayoutUnit availableWidth = columnBlock->contentLogicalWidth(); | 578 LayoutUnit availableWidth = columnBlock->contentLogicalWidth(); |
| 579 LayoutUnit columnGap = LayoutUnit(columnBlock->columnGap()); | 579 LayoutUnit columnGap = LayoutUnit(columnBlock->columnGap()); |
| 580 LayoutUnit computedColumnWidth = max(LayoutUnit(1), LayoutUnit(columnStyle-> columnWidth())); | 580 LayoutUnit computedColumnWidth = max(LayoutUnit(1), LayoutUnit(columnStyle-> columnWidth())); |
| 581 unsigned computedColumnCount = max<int>(1, columnStyle->columnCount()); | 581 unsigned computedColumnCount = max<int>(1, columnStyle->columnCount()); |
| 582 | 582 |
| 583 ASSERT(!columnStyle->hasAutoColumnCount() || !columnStyle->hasAutoColumnWidt h()); | 583 ASSERT(!columnStyle->hasAutoColumnCount() || !columnStyle->hasAutoColumnWidt h()); |
| 584 if (columnStyle->hasAutoColumnWidth() && !columnStyle->hasAutoColumnCount()) { | 584 if (columnStyle->hasAutoColumnWidth() && !columnStyle->hasAutoColumnCount()) { |
| 585 count = computedColumnCount; | 585 count = computedColumnCount; |
| 586 width = ((availableWidth - ((count - 1) * columnGap)) / count).clampNega tiveToZero(); | 586 width = ((availableWidth - ((count - 1) * columnGap)) / count).clampNega tiveToZero(); |
| 587 } else if (!columnStyle->hasAutoColumnWidth() && columnStyle->hasAutoColumnC ount()) { | 587 } else if (!columnStyle->hasAutoColumnWidth() && columnStyle->hasAutoColumnC ount()) { |
| 588 count = std::max(LayoutUnit(1), (availableWidth + columnGap) / (computed ColumnWidth + columnGap)); | 588 count = std::max(LayoutUnit(1), (availableWidth + columnGap) / (computed ColumnWidth + columnGap)).toUnsigned(); |
| 589 width = ((availableWidth + columnGap) / count) - columnGap; | 589 width = ((availableWidth + columnGap) / count) - columnGap; |
| 590 } else { | 590 } else { |
| 591 count = std::max(std::min(LayoutUnit(computedColumnCount), (availableWid th + columnGap) / (computedColumnWidth + columnGap)), LayoutUnit(1)); | 591 count = std::max(std::min(LayoutUnit(computedColumnCount), (availableWid th + columnGap) / (computedColumnWidth + columnGap)), LayoutUnit(1)).toUnsigned( ); |
| 592 count = std::max(count, 1u); | |
|
mstensho (USE GERRIT)
2016/08/22 18:05:17
What's this for? The line above already makes sure
Xianzhu
2016/08/22 18:15:37
Thanks for the catch. This is garbage left from pr
| |
| 592 width = ((availableWidth + columnGap) / count) - columnGap; | 593 width = ((availableWidth + columnGap) / count) - columnGap; |
| 593 } | 594 } |
| 594 } | 595 } |
| 595 | 596 |
| 596 void LayoutMultiColumnFlowThread::createAndInsertMultiColumnSet(LayoutBox* inser tBefore) | 597 void LayoutMultiColumnFlowThread::createAndInsertMultiColumnSet(LayoutBox* inser tBefore) |
| 597 { | 598 { |
| 598 LayoutBlockFlow* multicolContainer = multiColumnBlockFlow(); | 599 LayoutBlockFlow* multicolContainer = multiColumnBlockFlow(); |
| 599 LayoutMultiColumnSet* newSet = LayoutMultiColumnSet::createAnonymous(*this, multicolContainer->styleRef()); | 600 LayoutMultiColumnSet* newSet = LayoutMultiColumnSet::createAnonymous(*this, multicolContainer->styleRef()); |
| 600 multicolContainer->LayoutBlock::addChild(newSet, insertBefore); | 601 multicolContainer->LayoutBlock::addChild(newSet, insertBefore); |
| 601 invalidateColumnSets(); | 602 invalidateColumnSets(); |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1051 { | 1052 { |
| 1052 return MultiColumnLayoutState(m_lastSetWorkedOn); | 1053 return MultiColumnLayoutState(m_lastSetWorkedOn); |
| 1053 } | 1054 } |
| 1054 | 1055 |
| 1055 void LayoutMultiColumnFlowThread::restoreMultiColumnLayoutState(const MultiColum nLayoutState& state) | 1056 void LayoutMultiColumnFlowThread::restoreMultiColumnLayoutState(const MultiColum nLayoutState& state) |
| 1056 { | 1057 { |
| 1057 m_lastSetWorkedOn = state.columnSet(); | 1058 m_lastSetWorkedOn = state.columnSet(); |
| 1058 } | 1059 } |
| 1059 | 1060 |
| 1060 } // namespace blink | 1061 } // namespace blink |
| OLD | NEW |