inline void RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, SubtreeLayoutScope& layoutScope) { LayoutUnit oldLeft = logicalLeft(); bool logicalWidthChanged = updateLogicalWidthAndColumnWidth(); relayoutChildren |= logicalWidthChanged; LayoutState state(*this, locationOffset(), logicalWidthChanged); LayoutUnit beforeEdge = borderBefore() + paddingBefore(); LayoutUnit afterEdge = borderAfter() + paddingAfter(); LayoutUnit previousHeight = logicalHeight(); setLogicalHeight(beforeEdge); m_paintInvalidationLogicalTop = 0; m_paintInvalidationLogicalBottom = 0; if (!firstChild() && !isAnonymousBlock()) setChildrenInline(true); if (childrenInline()) layoutInlineChildren(relayoutChildren, m_paintInvalidationLogicalTop, m_paintInvalidationLogicalBottom, afterEdge); else layoutBlockChildren(relayoutChildren, layoutScope, beforeEdge, afterEdge); LayoutUnit oldClientAfterEdge = clientLogicalBottom(); updateLogicalHeight(); if (previousHeight != logicalHeight()) relayoutChildren = true; layoutPositionedObjects(relayoutChildren || isDocumentElement(), oldLeft != logicalLeft() ? ForcedLayoutAfterContainingBlockMoved : DefaultLayout); // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway). computeOverflow(oldClientAfterEdge); }
void RenderGrid::layoutBlock(bool relayoutChildren, LayoutUnit) { ASSERT(needsLayout()); if (!relayoutChildren && simplifiedLayout()) return; // FIXME: Much of this method is boiler plate that matches RenderBox::layoutBlock and Render*FlexibleBox::layoutBlock. // It would be nice to refactor some of the duplicate code. LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode()); if (inRenderFlowThread()) { // Regions changing widths can force us to relayout our children. if (logicalWidthChangedInRegions()) relayoutChildren = true; } computeInitialRegionRangeForBlock(); LayoutSize previousSize = size(); setLogicalHeight(0); computeLogicalWidth(); m_overflow.clear(); layoutGridItems(); LayoutUnit oldClientAfterEdge = clientLogicalBottom(); computeLogicalHeight(); if (size() != previousSize) relayoutChildren = true; layoutPositionedObjects(relayoutChildren || isRoot()); computeRegionRangeForBlock(); computeOverflow(oldClientAfterEdge); statePusher.pop(); updateLayerTransform(); // Update our scroll information if we're overflow:auto/scroll/hidden now that we know if // we overflow or not. if (hasOverflowClip()) layer()->updateScrollInfoAfterLayout(); repainter.repaintAfterLayout(); setNeedsLayout(false); }
void RenderRubyRun::layout() { RenderBlock::layout(); RenderRubyText* rt = rubyText(); if (!rt) return; rt->setLogicalLeft(0); // Place the RenderRubyText such that its bottom is flush with the lineTop of the first line of the RenderRubyBase. LayoutUnit lastLineRubyTextBottom = rt->logicalHeight(); LayoutUnit firstLineRubyTextTop = 0; RootInlineBox* rootBox = rt->lastRootBox(); if (rootBox) { // In order to align, we have to ignore negative leading. firstLineRubyTextTop = rt->firstRootBox()->logicalTopLayoutOverflow(); lastLineRubyTextBottom = rootBox->logicalBottomLayoutOverflow(); } if (style()->isFlippedLinesWritingMode() == (style()->rubyPosition() == RubyPositionAfter)) { LayoutUnit firstLineTop = 0; if (RenderRubyBase* rb = rubyBase()) { RootInlineBox* rootBox = rb->firstRootBox(); if (rootBox) firstLineTop = rootBox->logicalTopLayoutOverflow(); firstLineTop += rb->logicalTop(); } rt->setLogicalTop(-lastLineRubyTextBottom + firstLineTop); } else { LayoutUnit lastLineBottom = logicalHeight(); if (RenderRubyBase* rb = rubyBase()) { RootInlineBox* rootBox = rb->lastRootBox(); if (rootBox) lastLineBottom = rootBox->logicalBottomLayoutOverflow(); lastLineBottom += rb->logicalTop(); } rt->setLogicalTop(-firstLineRubyTextTop + lastLineBottom); } // Update our overflow to account for the new RenderRubyText position. computeOverflow(clientLogicalBottom()); }