| 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 29 matching lines...) Expand all Loading... |
| 40 , m_progressionIsInline(true) | 40 , m_progressionIsInline(true) |
| 41 , m_isBeingEvacuated(false) | 41 , m_isBeingEvacuated(false) |
| 42 { | 42 { |
| 43 setFlowThreadState(InsideInFlowThread); | 43 setFlowThreadState(InsideInFlowThread); |
| 44 } | 44 } |
| 45 | 45 |
| 46 LayoutMultiColumnFlowThread::~LayoutMultiColumnFlowThread() | 46 LayoutMultiColumnFlowThread::~LayoutMultiColumnFlowThread() |
| 47 { | 47 { |
| 48 } | 48 } |
| 49 | 49 |
| 50 LayoutMultiColumnFlowThread* LayoutMultiColumnFlowThread::createAnonymous(Docume
nt& document, const LayoutStyle& parentStyle) | 50 LayoutMultiColumnFlowThread* LayoutMultiColumnFlowThread::createAnonymous(Docume
nt& document, const ComputedStyle& parentStyle) |
| 51 { | 51 { |
| 52 LayoutMultiColumnFlowThread* renderer = new LayoutMultiColumnFlowThread(); | 52 LayoutMultiColumnFlowThread* renderer = new LayoutMultiColumnFlowThread(); |
| 53 renderer->setDocumentForAnonymous(&document); | 53 renderer->setDocumentForAnonymous(&document); |
| 54 renderer->setStyle(LayoutStyle::createAnonymousStyleWithDisplay(parentStyle,
BLOCK)); | 54 renderer->setStyle(ComputedStyle::createAnonymousStyleWithDisplay(parentStyl
e, BLOCK)); |
| 55 return renderer; | 55 return renderer; |
| 56 } | 56 } |
| 57 | 57 |
| 58 LayoutMultiColumnSet* LayoutMultiColumnFlowThread::firstMultiColumnSet() const | 58 LayoutMultiColumnSet* LayoutMultiColumnFlowThread::firstMultiColumnSet() const |
| 59 { | 59 { |
| 60 for (LayoutObject* sibling = nextSibling(); sibling; sibling = sibling->next
Sibling()) { | 60 for (LayoutObject* sibling = nextSibling(); sibling; sibling = sibling->next
Sibling()) { |
| 61 if (sibling->isLayoutMultiColumnSet()) | 61 if (sibling->isLayoutMultiColumnSet()) |
| 62 return toLayoutMultiColumnSet(sibling); | 62 return toLayoutMultiColumnSet(sibling); |
| 63 } | 63 } |
| 64 return 0; | 64 return 0; |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 307 |
| 308 void LayoutMultiColumnFlowThread::columnRuleStyleDidChange() | 308 void LayoutMultiColumnFlowThread::columnRuleStyleDidChange() |
| 309 { | 309 { |
| 310 for (LayoutMultiColumnSet* columnSet = firstMultiColumnSet(); columnSet; col
umnSet = columnSet->nextSiblingMultiColumnSet()) | 310 for (LayoutMultiColumnSet* columnSet = firstMultiColumnSet(); columnSet; col
umnSet = columnSet->nextSiblingMultiColumnSet()) |
| 311 columnSet->setShouldDoFullPaintInvalidation(PaintInvalidationStyleChange
); | 311 columnSet->setShouldDoFullPaintInvalidation(PaintInvalidationStyleChange
); |
| 312 } | 312 } |
| 313 | 313 |
| 314 void LayoutMultiColumnFlowThread::calculateColumnCountAndWidth(LayoutUnit& width
, unsigned& count) const | 314 void LayoutMultiColumnFlowThread::calculateColumnCountAndWidth(LayoutUnit& width
, unsigned& count) const |
| 315 { | 315 { |
| 316 LayoutBlock* columnBlock = multiColumnBlockFlow(); | 316 LayoutBlock* columnBlock = multiColumnBlockFlow(); |
| 317 const LayoutStyle* columnStyle = columnBlock->style(); | 317 const ComputedStyle* columnStyle = columnBlock->style(); |
| 318 LayoutUnit availableWidth = columnBlock->contentLogicalWidth(); | 318 LayoutUnit availableWidth = columnBlock->contentLogicalWidth(); |
| 319 LayoutUnit columnGap = columnBlock->columnGap(); | 319 LayoutUnit columnGap = columnBlock->columnGap(); |
| 320 LayoutUnit computedColumnWidth = max<LayoutUnit>(1, LayoutUnit(columnStyle->
columnWidth())); | 320 LayoutUnit computedColumnWidth = max<LayoutUnit>(1, LayoutUnit(columnStyle->
columnWidth())); |
| 321 unsigned computedColumnCount = max<int>(1, columnStyle->columnCount()); | 321 unsigned computedColumnCount = max<int>(1, columnStyle->columnCount()); |
| 322 | 322 |
| 323 ASSERT(!columnStyle->hasAutoColumnCount() || !columnStyle->hasAutoColumnWidt
h()); | 323 ASSERT(!columnStyle->hasAutoColumnCount() || !columnStyle->hasAutoColumnWidt
h()); |
| 324 if (columnStyle->hasAutoColumnWidth() && !columnStyle->hasAutoColumnCount())
{ | 324 if (columnStyle->hasAutoColumnWidth() && !columnStyle->hasAutoColumnCount())
{ |
| 325 count = computedColumnCount; | 325 count = computedColumnCount; |
| 326 width = std::max<LayoutUnit>(0, (availableWidth - ((count - 1) * columnG
ap)) / count); | 326 width = std::max<LayoutUnit>(0, (availableWidth - ((count - 1) * columnG
ap)) / count); |
| 327 } else if (!columnStyle->hasAutoColumnWidth() && columnStyle->hasAutoColumnC
ount()) { | 327 } else if (!columnStyle->hasAutoColumnWidth() && columnStyle->hasAutoColumnC
ount()) { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 } | 588 } |
| 589 | 589 |
| 590 void LayoutMultiColumnFlowThread::computePreferredLogicalWidths() | 590 void LayoutMultiColumnFlowThread::computePreferredLogicalWidths() |
| 591 { | 591 { |
| 592 LayoutFlowThread::computePreferredLogicalWidths(); | 592 LayoutFlowThread::computePreferredLogicalWidths(); |
| 593 | 593 |
| 594 // The min/max intrinsic widths calculated really tell how much space elemen
ts need when | 594 // The min/max intrinsic widths calculated really tell how much space elemen
ts need when |
| 595 // laid out inside the columns. In order to eventually end up with the desir
ed column width, | 595 // laid out inside the columns. In order to eventually end up with the desir
ed column width, |
| 596 // we need to convert them to values pertaining to the multicol container. | 596 // we need to convert them to values pertaining to the multicol container. |
| 597 const LayoutBlockFlow* multicolContainer = multiColumnBlockFlow(); | 597 const LayoutBlockFlow* multicolContainer = multiColumnBlockFlow(); |
| 598 const LayoutStyle* multicolStyle = multicolContainer->style(); | 598 const ComputedStyle* multicolStyle = multicolContainer->style(); |
| 599 int columnCount = multicolStyle->hasAutoColumnCount() ? 1 : multicolStyle->c
olumnCount(); | 599 int columnCount = multicolStyle->hasAutoColumnCount() ? 1 : multicolStyle->c
olumnCount(); |
| 600 LayoutUnit columnWidth; | 600 LayoutUnit columnWidth; |
| 601 LayoutUnit gapExtra = (columnCount - 1) * multicolContainer->columnGap(); | 601 LayoutUnit gapExtra = (columnCount - 1) * multicolContainer->columnGap(); |
| 602 if (multicolStyle->hasAutoColumnWidth()) { | 602 if (multicolStyle->hasAutoColumnWidth()) { |
| 603 m_minPreferredLogicalWidth = m_minPreferredLogicalWidth * columnCount +
gapExtra; | 603 m_minPreferredLogicalWidth = m_minPreferredLogicalWidth * columnCount +
gapExtra; |
| 604 } else { | 604 } else { |
| 605 columnWidth = multicolStyle->columnWidth(); | 605 columnWidth = multicolStyle->columnWidth(); |
| 606 m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, column
Width); | 606 m_minPreferredLogicalWidth = std::min(m_minPreferredLogicalWidth, column
Width); |
| 607 } | 607 } |
| 608 // Note that if column-count is auto here, we should resolve it to calculate
the maximum | 608 // Note that if column-count is auto here, we should resolve it to calculate
the maximum |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 } | 675 } |
| 676 | 676 |
| 677 bool LayoutMultiColumnFlowThread::isPageLogicalHeightKnown() const | 677 bool LayoutMultiColumnFlowThread::isPageLogicalHeightKnown() const |
| 678 { | 678 { |
| 679 if (LayoutMultiColumnSet* columnSet = lastMultiColumnSet()) | 679 if (LayoutMultiColumnSet* columnSet = lastMultiColumnSet()) |
| 680 return columnSet->pageLogicalHeight(); | 680 return columnSet->pageLogicalHeight(); |
| 681 return false; | 681 return false; |
| 682 } | 682 } |
| 683 | 683 |
| 684 } | 684 } |
| OLD | NEW |