void InitialColumnHeightFinder::examineBoxAfterEntering(const LayoutBox& box) { ASSERT(isFirstAfterBreak(flowThreadOffset()) || !box.paginationStrut()); if (box.hasForcedBreakBefore()) { addContentRun(flowThreadOffset()); } else if (isFirstAfterBreak(flowThreadOffset())) { // This box is first after a soft break. recordStrutBeforeOffset(flowThreadOffset(), box.paginationStrut()); } if (box.hasForcedBreakAfter()) addContentRun(flowThreadOffset() + box.logicalHeight()); if (box.paginationBreakability() != LayoutBox::AllowAnyBreaks) { LayoutUnit unsplittableLogicalHeight = box.logicalHeight(); if (box.isFloating()) unsplittableLogicalHeight += box.marginBefore() + box.marginAfter(); m_tallestUnbreakableLogicalHeight = std::max(m_tallestUnbreakableLogicalHeight, unsplittableLogicalHeight); } else if (box.isLayoutBlockFlow()) { if (LayoutMultiColumnFlowThread* innerFlowThread = toLayoutBlockFlow(box).multiColumnFlowThread()) { LayoutUnit offsetInInnerFlowThread = flowThreadOffset() - innerFlowThread->blockOffsetInEnclosingFlowThread(); LayoutUnit innerUnbreakableHeight = innerFlowThread->tallestUnbreakableLogicalHeight(offsetInInnerFlowThread); m_tallestUnbreakableLogicalHeight = std::max(m_tallestUnbreakableLogicalHeight, innerUnbreakableHeight); } } }
void MultiColumnFragmentainerGroup::distributeImplicitBreaks() { #if ENABLE(ASSERT) // There should be no implicit breaks assumed at this point. for (unsigned i = 0; i < m_contentRuns.size(); i++) ASSERT(!m_contentRuns[i].assumedImplicitBreaks()); #endif // ENABLE(ASSERT) // Insert a final content run to encompass all content. This will include overflow if this is // the last set. addContentRun(m_logicalBottomInFlowThread); unsigned columnCount = m_contentRuns.size(); // If there is room for more breaks (to reach the used value of column-count), imagine that we // insert implicit breaks at suitable locations. At any given time, the content run with the // currently tallest columns will get another implicit break "inserted", which will increase its // column count by one and shrink its columns' height. Repeat until we have the desired total // number of breaks. The largest column height among the runs will then be the initial column // height for the balancer to use. while (columnCount < m_columnSet.usedColumnCount()) { unsigned index = findRunWithTallestColumns(); m_contentRuns[index].assumeAnotherImplicitBreak(); columnCount++; } }
void InitialColumnHeightFinder::distributeImplicitBreaks() { // Insert a final content run to encompass all content. This will include // overflow if we're at the end of the multicol container. addContentRun(logicalBottomInFlowThread()); unsigned columnCount = m_contentRuns.size(); // If there is room for more breaks (to reach the used value of column-count), // imagine that we insert implicit breaks at suitable locations. At any given // time, the content run with the currently tallest columns will get another // implicit break "inserted", which will increase its column count by one and // shrink its columns' height. Repeat until we have the desired total number // of breaks. The largest column height among the runs will then be the // initial column height for the balancer to use. if (columnCount > columnSet().usedColumnCount()) { // If we exceed used column-count (which we are allowed to do if we're at // the initial balancing pass for a multicol that lives inside another // to-be-balanced outer multicol container), we only care about content that // could end up in the last row. We need to pad up the number of columns, so // that all rows will contain as many columns as used column-count dictates. columnCount %= columnSet().usedColumnCount(); // If there are just enough explicit breaks to fill all rows with the right // amount of columns, we won't be needing any implicit breaks. if (!columnCount) return; } while (columnCount < columnSet().usedColumnCount()) { unsigned index = contentRunIndexWithTallestColumns(); m_contentRuns[index].assumeAnotherImplicitBreak(); columnCount++; } }
void InitialColumnHeightFinder::examineBoxAfterEntering(const LayoutBox& box) { ASSERT(isFirstAfterBreak(flowThreadOffset()) || !box.paginationStrut()); if (box.hasForcedBreakBefore()) { addContentRun(flowThreadOffset()); } else if (isFirstAfterBreak(flowThreadOffset())) { // This box is first after a soft break. recordStrutBeforeOffset(flowThreadOffset(), box.paginationStrut()); } if (box.hasForcedBreakAfter()) addContentRun(flowThreadOffset() + box.logicalHeight()); if (box.paginationBreakability() != LayoutBox::AllowAnyBreaks) { LayoutUnit unsplittableLogicalHeight = box.logicalHeight(); if (box.isFloating()) unsplittableLogicalHeight += box.marginBefore() + box.marginAfter(); if (m_minimumColumnLogicalHeight < unsplittableLogicalHeight) m_minimumColumnLogicalHeight = unsplittableLogicalHeight; } }
void InitialColumnHeightFinder::distributeImplicitBreaks() { // Insert a final content run to encompass all content. This will include // overflow if we're at the end of the multicol container. addContentRun(logicalBottomInFlowThread()); unsigned columnCount = m_contentRuns.size(); // If there is room for more breaks (to reach the used value of column-count), // imagine that we insert implicit breaks at suitable locations. At any given // time, the content run with the currently tallest columns will get another // implicit break "inserted", which will increase its column count by one and // shrink its columns' height. Repeat until we have the desired total number // of breaks. The largest column height among the runs will then be the // initial column height for the balancer to use. while (columnCount < columnSet().usedColumnCount()) { unsigned index = contentRunIndexWithTallestColumns(); m_contentRuns[index].assumeAnotherImplicitBreak(); columnCount++; } }
void InitialColumnHeightFinder::examineBoxAfterEntering( const LayoutBox& box, LayoutUnit childLogicalHeight, EBreak previousBreakAfterValue) { if (m_lastBreakSeen > flowThreadOffset()) { // We have moved backwards. We're probably in a parallel flow, caused by // floats, sibling table cells, etc. m_lastBreakSeen = LayoutUnit(); } if (isLogicalTopWithinBounds(flowThreadOffset() - box.paginationStrut())) { if (box.needsForcedBreakBefore(previousBreakAfterValue)) { addContentRun(flowThreadOffset()); } else if (isFirstAfterBreak(flowThreadOffset()) && m_lastBreakSeen != flowThreadOffset()) { // This box is first after a soft break. m_lastBreakSeen = flowThreadOffset(); recordStrutBeforeOffset(flowThreadOffset(), box.paginationStrut()); } } if (box.getPaginationBreakability() != LayoutBox::AllowAnyBreaks) { m_tallestUnbreakableLogicalHeight = std::max(m_tallestUnbreakableLogicalHeight, childLogicalHeight); return; } // Need to examine inner multicol containers to find their tallest unbreakable // piece of content. if (!box.isLayoutBlockFlow()) return; LayoutMultiColumnFlowThread* innerFlowThread = toLayoutBlockFlow(box).multiColumnFlowThread(); if (!innerFlowThread || innerFlowThread->isLayoutPagedFlowThread()) return; LayoutUnit offsetInInnerFlowThread = flowThreadOffset() - innerFlowThread->blockOffsetInEnclosingFragmentationContext(); LayoutUnit innerUnbreakableHeight = innerFlowThread->tallestUnbreakableLogicalHeight(offsetInInnerFlowThread); m_tallestUnbreakableLogicalHeight = std::max(m_tallestUnbreakableLogicalHeight, innerUnbreakableHeight); }
void InitialColumnHeightFinder::examineBoxAfterEntering( const LayoutBox& box, EBreak previousBreakAfterValue) { if (isLogicalTopWithinBounds(flowThreadOffset() - box.paginationStrut())) { if (box.needsForcedBreakBefore(previousBreakAfterValue)) { addContentRun(flowThreadOffset()); } else { ASSERT(isFirstAfterBreak(flowThreadOffset()) || !box.paginationStrut()); if (isFirstAfterBreak(flowThreadOffset())) { // This box is first after a soft break. recordStrutBeforeOffset(flowThreadOffset(), box.paginationStrut()); } } } if (box.getPaginationBreakability() != LayoutBox::AllowAnyBreaks) { LayoutUnit unsplittableLogicalHeight = box.logicalHeight(); if (box.isFloating()) unsplittableLogicalHeight += box.marginBefore() + box.marginAfter(); m_tallestUnbreakableLogicalHeight = std::max(m_tallestUnbreakableLogicalHeight, unsplittableLogicalHeight); return; } // Need to examine inner multicol containers to find their tallest unbreakable // piece of content. if (!box.isLayoutBlockFlow()) return; LayoutMultiColumnFlowThread* innerFlowThread = toLayoutBlockFlow(box).multiColumnFlowThread(); if (!innerFlowThread || innerFlowThread->isLayoutPagedFlowThread()) return; LayoutUnit offsetInInnerFlowThread = flowThreadOffset() - innerFlowThread->blockOffsetInEnclosingFragmentationContext(); LayoutUnit innerUnbreakableHeight = innerFlowThread->tallestUnbreakableLogicalHeight(offsetInInnerFlowThread); m_tallestUnbreakableLogicalHeight = std::max(m_tallestUnbreakableLogicalHeight, innerUnbreakableHeight); }