void ColumnBalancer::traverseLines(const LayoutBlockFlow& blockFlow) { for (const RootInlineBox* line = blockFlow.firstRootBox(); line; line = line->nextRootBox()) { LayoutUnit lineTopInFlowThread = m_flowThreadOffset + line->lineTopWithLeading(); if (lineTopInFlowThread < logicalTopInFlowThread()) continue; if (lineTopInFlowThread >= logicalBottomInFlowThread()) break; examineLine(*line); } }
void ColumnBalancer::traverseSubtree(const LayoutBox& box) { if (box.childrenInline() && box.isLayoutBlockFlow()) { // Look for breaks between lines. for (const RootInlineBox* line = toLayoutBlockFlow(box).firstRootBox(); line; line = line->nextRootBox()) { LayoutUnit lineTopInFlowThread = m_flowThreadOffset + line->lineTopWithLeading(); if (lineTopInFlowThread < group().logicalTopInFlowThread()) continue; if (lineTopInFlowThread >= group().logicalBottomInFlowThread()) break; examineLine(*line); } } const LayoutFlowThread* flowThread = group().columnSet().flowThread(); bool isHorizontalWritingMode = flowThread->isHorizontalWritingMode(); // Look for breaks between and inside block-level children. Even if this is a block flow with // inline children, there may be interesting floats to examine here. for (const LayoutObject* child = box.slowFirstChild(); child; child = child->nextSibling()) { if (!child->isBox() || child->isInline()) continue; const LayoutBox& childBox = toLayoutBox(*child); LayoutRect overflowRect = childBox.layoutOverflowRect(); LayoutUnit childLogicalBottomWithOverflow = childBox.logicalTop() + (isHorizontalWritingMode ? overflowRect.maxY() : overflowRect.maxX()); if (m_flowThreadOffset + childLogicalBottomWithOverflow <= group().logicalTopInFlowThread()) { // This child is fully above the fragmentainer group we're examining. continue; } LayoutUnit childLogicalTopWithOverflow = childBox.logicalTop() + (isHorizontalWritingMode ? overflowRect.y() : overflowRect.x()); if (m_flowThreadOffset + childLogicalTopWithOverflow >= group().logicalBottomInFlowThread()) { // This child is fully below the fragmentainer group we're examining. We cannot just // stop here, though, thanks to negative margins. So keep looking. continue; } if (childBox.isOutOfFlowPositioned() || childBox.isColumnSpanAll()) continue; // Tables are wicked. Both table rows and table cells are relative to their table section. LayoutUnit offsetForThisChild = childBox.isTableRow() ? LayoutUnit() : childBox.logicalTop(); m_flowThreadOffset += offsetForThisChild; examineBoxAfterEntering(childBox); // Unless the child is unsplittable, or if the child establishes an inner multicol // container, we descend into its subtree for further examination. if (childBox.paginationBreakability() != LayoutBox::ForbidBreaks && (!childBox.isLayoutBlockFlow() || !toLayoutBlockFlow(childBox).multiColumnFlowThread())) traverseSubtree(childBox); examineBoxBeforeLeaving(childBox); m_flowThreadOffset -= offsetForThisChild; } }