| 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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 { | 474 { |
| 475 return pageRemainingLogicalHeightForOffset(blockOffset, AssociateWithLatterP
age); | 475 return pageRemainingLogicalHeightForOffset(blockOffset, AssociateWithLatterP
age); |
| 476 } | 476 } |
| 477 | 477 |
| 478 void LayoutMultiColumnFlowThread::calculateColumnCountAndWidth(LayoutUnit& width
, unsigned& count) const | 478 void LayoutMultiColumnFlowThread::calculateColumnCountAndWidth(LayoutUnit& width
, unsigned& count) const |
| 479 { | 479 { |
| 480 LayoutBlock* columnBlock = multiColumnBlockFlow(); | 480 LayoutBlock* columnBlock = multiColumnBlockFlow(); |
| 481 const ComputedStyle* columnStyle = columnBlock->style(); | 481 const ComputedStyle* columnStyle = columnBlock->style(); |
| 482 LayoutUnit availableWidth = columnBlock->contentLogicalWidth(); | 482 LayoutUnit availableWidth = columnBlock->contentLogicalWidth(); |
| 483 LayoutUnit columnGap = columnBlock->columnGap(); | 483 LayoutUnit columnGap = columnBlock->columnGap(); |
| 484 LayoutUnit computedColumnWidth = max<LayoutUnit>(1, LayoutUnit(columnStyle->
columnWidth())); | 484 LayoutUnit computedColumnWidth = max(LayoutUnit(1), LayoutUnit(columnStyle->
columnWidth())); |
| 485 unsigned computedColumnCount = max<int>(1, columnStyle->columnCount()); | 485 unsigned computedColumnCount = max<int>(1, columnStyle->columnCount()); |
| 486 | 486 |
| 487 ASSERT(!columnStyle->hasAutoColumnCount() || !columnStyle->hasAutoColumnWidt
h()); | 487 ASSERT(!columnStyle->hasAutoColumnCount() || !columnStyle->hasAutoColumnWidt
h()); |
| 488 if (columnStyle->hasAutoColumnWidth() && !columnStyle->hasAutoColumnCount())
{ | 488 if (columnStyle->hasAutoColumnWidth() && !columnStyle->hasAutoColumnCount())
{ |
| 489 count = computedColumnCount; | 489 count = computedColumnCount; |
| 490 width = std::max<LayoutUnit>(0, (availableWidth - ((count - 1) * columnG
ap)) / count); | 490 width = ((availableWidth - ((count - 1) * columnGap)) / count).clampToZe
ro(); |
| 491 } else if (!columnStyle->hasAutoColumnWidth() && columnStyle->hasAutoColumnC
ount()) { | 491 } else if (!columnStyle->hasAutoColumnWidth() && columnStyle->hasAutoColumnC
ount()) { |
| 492 count = std::max<LayoutUnit>(1, (availableWidth + columnGap) / (computed
ColumnWidth + columnGap)); | 492 count = std::max(LayoutUnit(1), (availableWidth + columnGap) / (computed
ColumnWidth + columnGap)); |
| 493 width = ((availableWidth + columnGap) / count) - columnGap; | 493 width = ((availableWidth + columnGap) / count) - columnGap; |
| 494 } else { | 494 } else { |
| 495 count = std::max<LayoutUnit>(std::min<LayoutUnit>(computedColumnCount, (
availableWidth + columnGap) / (computedColumnWidth + columnGap)), 1); | 495 count = std::max(std::min(LayoutUnit(computedColumnCount), (availableWid
th + columnGap) / (computedColumnWidth + columnGap)), LayoutUnit(1)); |
| 496 width = ((availableWidth + columnGap) / count) - columnGap; | 496 width = ((availableWidth + columnGap) / count) - columnGap; |
| 497 } | 497 } |
| 498 } | 498 } |
| 499 | 499 |
| 500 void LayoutMultiColumnFlowThread::createAndInsertMultiColumnSet(LayoutBox* inser
tBefore) | 500 void LayoutMultiColumnFlowThread::createAndInsertMultiColumnSet(LayoutBox* inser
tBefore) |
| 501 { | 501 { |
| 502 LayoutBlockFlow* multicolContainer = multiColumnBlockFlow(); | 502 LayoutBlockFlow* multicolContainer = multiColumnBlockFlow(); |
| 503 LayoutMultiColumnSet* newSet = LayoutMultiColumnSet::createAnonymous(*this,
multicolContainer->styleRef()); | 503 LayoutMultiColumnSet* newSet = LayoutMultiColumnSet::createAnonymous(*this,
multicolContainer->styleRef()); |
| 504 multicolContainer->LayoutBlock::addChild(newSet, insertBefore); | 504 multicolContainer->LayoutBlock::addChild(newSet, insertBefore); |
| 505 invalidateColumnSets(); | 505 invalidateColumnSets(); |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 // the "mayBe"), if we're in an out-of-flow subtree and have an outer multic
ol container that | 925 // the "mayBe"), if we're in an out-of-flow subtree and have an outer multic
ol container that |
| 926 // doesn't affect us, but that's okay. We'll discover that further down the
road when trying to | 926 // doesn't affect us, but that's okay. We'll discover that further down the
road when trying to |
| 927 // locate our enclosing flow thread for real. | 927 // locate our enclosing flow thread for real. |
| 928 bool mayBeNested = multiColumnBlockFlow()->isInsideFlowThread() || view()->f
ragmentationContext(); | 928 bool mayBeNested = multiColumnBlockFlow()->isInsideFlowThread() || view()->f
ragmentationContext(); |
| 929 if (!mayBeNested) | 929 if (!mayBeNested) |
| 930 return; | 930 return; |
| 931 appendNewFragmentainerGroupIfNeeded(logicalBottomInFlowThreadAfterPagination
); | 931 appendNewFragmentainerGroupIfNeeded(logicalBottomInFlowThreadAfterPagination
); |
| 932 } | 932 } |
| 933 | 933 |
| 934 } // namespace blink | 934 } // namespace blink |
| OLD | NEW |