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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 // If there were no adjacent spanners, it has to mean that there's only
one column set, | 573 // If there were no adjacent spanners, it has to mean that there's only
one column set, |
574 // since it's only spanners that may cause creation of multiple sets. | 574 // since it's only spanners that may cause creation of multiple sets. |
575 columnSetToRemove = firstMultiColumnSet(); | 575 columnSetToRemove = firstMultiColumnSet(); |
576 ASSERT(columnSetToRemove); | 576 ASSERT(columnSetToRemove); |
577 ASSERT(!columnSetToRemove->nextSiblingMultiColumnSet()); | 577 ASSERT(!columnSetToRemove->nextSiblingMultiColumnSet()); |
578 } | 578 } |
579 ASSERT(columnSetToRemove); | 579 ASSERT(columnSetToRemove); |
580 columnSetToRemove->destroy(); | 580 columnSetToRemove->destroy(); |
581 } | 581 } |
582 | 582 |
| 583 void RenderMultiColumnFlowThread::computePreferredLogicalWidths() |
| 584 { |
| 585 RenderFlowThread::computePreferredLogicalWidths(); |
| 586 |
| 587 // The min/max intrinsic widths calculated really tell how much space elemen
ts need when |
| 588 // laid out inside the columns. In order to eventually end up with the desir
ed column width, |
| 589 // we need to convert them to values pertaining to the multicol container. |
| 590 const RenderBlockFlow* multicolContainer = multiColumnBlockFlow(); |
| 591 const RenderStyle* multicolStyle = multicolContainer->style(); |
| 592 int columnCount = multicolStyle->hasAutoColumnCount() ? 1 : multicolStyle->c
olumnCount(); |
| 593 LayoutUnit columnWidth; |
| 594 LayoutUnit gapExtra = (columnCount - 1) * multicolContainer->columnGap(); |
| 595 if (multicolStyle->hasAutoColumnWidth()) { |
| 596 m_minPreferredLogicalWidth = m_minPreferredLogicalWidth * columnCount +
gapExtra; |
| 597 } else { |
| 598 columnWidth = multicolStyle->columnWidth(); |
| 599 m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, column
Width); |
| 600 } |
| 601 // Note that if column-count is auto here, we should resolve it to calculate
the maximum |
| 602 // intrinsic width, instead of pretending that it's 1. The only way to do th
at is by performing |
| 603 // a layout pass, but this is not an appropriate time or place for layout. T
he good news is that |
| 604 // if height is unconstrained and there are no explicit breaks, the resolved
column-count really |
| 605 // should be 1. |
| 606 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, columnWidt
h) * columnCount + gapExtra; |
| 607 } |
| 608 |
583 void RenderMultiColumnFlowThread::computeLogicalHeight(LayoutUnit logicalHeight,
LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const | 609 void RenderMultiColumnFlowThread::computeLogicalHeight(LayoutUnit logicalHeight,
LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const |
584 { | 610 { |
585 // We simply remain at our intrinsic height. | 611 // We simply remain at our intrinsic height. |
586 computedValues.m_extent = logicalHeight; | 612 computedValues.m_extent = logicalHeight; |
587 computedValues.m_position = logicalTop; | 613 computedValues.m_position = logicalTop; |
588 } | 614 } |
589 | 615 |
590 void RenderMultiColumnFlowThread::updateLogicalWidth() | 616 void RenderMultiColumnFlowThread::updateLogicalWidth() |
591 { | 617 { |
592 LayoutUnit columnWidth; | 618 LayoutUnit columnWidth; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 } | 668 } |
643 | 669 |
644 bool RenderMultiColumnFlowThread::isPageLogicalHeightKnown() const | 670 bool RenderMultiColumnFlowThread::isPageLogicalHeightKnown() const |
645 { | 671 { |
646 if (RenderMultiColumnSet* columnSet = lastMultiColumnSet()) | 672 if (RenderMultiColumnSet* columnSet = lastMultiColumnSet()) |
647 return columnSet->pageLogicalHeight(); | 673 return columnSet->pageLogicalHeight(); |
648 return false; | 674 return false; |
649 } | 675 } |
650 | 676 |
651 } | 677 } |
OLD | NEW |