LayoutUnit RootInlineBox::alignBoxesInBlockDirection(LayoutUnit heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache) { // SVG will handle vertical alignment on its own. if (isSVGRootInlineBox()) return 0; LayoutUnit maxPositionTop = 0; LayoutUnit maxPositionBottom = 0; int maxAscent = 0; int maxDescent = 0; bool setMaxAscent = false; bool setMaxDescent = false; // Figure out if we're in no-quirks mode. bool noQuirksMode = renderer().document().inNoQuirksMode(); m_baselineType = requiresIdeographicBaseline(textBoxDataMap) ? IdeographicBaseline : AlphabeticBaseline; computeLogicalBoxHeights(this, maxPositionTop, maxPositionBottom, maxAscent, maxDescent, setMaxAscent, setMaxDescent, noQuirksMode, textBoxDataMap, baselineType(), verticalPositionCache); if (maxAscent + maxDescent < std::max(maxPositionTop, maxPositionBottom)) adjustMaxAscentAndDescent(maxAscent, maxDescent, maxPositionTop, maxPositionBottom); LayoutUnit maxHeight = maxAscent + maxDescent; LayoutUnit lineTop = heightOfBlock; LayoutUnit lineBottom = heightOfBlock; LayoutUnit lineTopIncludingMargins = heightOfBlock; LayoutUnit lineBottomIncludingMargins = heightOfBlock; bool setLineTop = false; bool hasAnnotationsBefore = false; bool hasAnnotationsAfter = false; placeBoxesInBlockDirection(heightOfBlock, maxHeight, maxAscent, noQuirksMode, lineTop, lineBottom, setLineTop, lineTopIncludingMargins, lineBottomIncludingMargins, hasAnnotationsBefore, hasAnnotationsAfter, baselineType()); m_hasAnnotationsBefore = hasAnnotationsBefore; m_hasAnnotationsAfter = hasAnnotationsAfter; maxHeight = std::max<LayoutUnit>(0, maxHeight); // FIXME: Is this really necessary? setLineTopBottomPositions(lineTop, lineBottom, heightOfBlock, heightOfBlock + maxHeight); setPaginatedLineWidth(blockFlow().availableLogicalWidthForContent(heightOfBlock)); LayoutUnit annotationsAdjustment = beforeAnnotationsAdjustment(); if (annotationsAdjustment) { // FIXME: Need to handle pagination here. We might have to move to the next page/column as a result of the // ruby expansion. adjustBlockDirectionPosition(annotationsAdjustment); heightOfBlock += annotationsAdjustment; } LayoutUnit gridSnapAdjustment = lineSnapAdjustment(); if (gridSnapAdjustment) { adjustBlockDirectionPosition(gridSnapAdjustment); heightOfBlock += gridSnapAdjustment; } return heightOfBlock + maxHeight; }
int RootInlineBox::verticallyAlignBoxes(int heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap) { #if ENABLE(SVG) // SVG will handle vertical alignment on its own. if (isSVGRootInlineBox()) return 0; #endif int maxPositionTop = 0; int maxPositionBottom = 0; int maxAscent = 0; int maxDescent = 0; // Figure out if we're in strict mode. Note that we can't simply use !style()->htmlHacks(), // because that would match almost strict mode as well. RenderObject* curr = renderer(); while (curr && !curr->node()) curr = curr->container(); bool strictMode = (curr && curr->document()->inStrictMode()); computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, strictMode, textBoxDataMap); if (maxAscent + maxDescent < max(maxPositionTop, maxPositionBottom)) adjustMaxAscentAndDescent(maxAscent, maxDescent, maxPositionTop, maxPositionBottom); int maxHeight = maxAscent + maxDescent; int lineTop = heightOfBlock; int lineBottom = heightOfBlock; placeBoxesVertically(heightOfBlock, maxHeight, maxAscent, strictMode, lineTop, lineBottom); computeVerticalOverflow(lineTop, lineBottom, strictMode, textBoxDataMap); setLineTopBottomPositions(lineTop, lineBottom); heightOfBlock += maxHeight; return heightOfBlock; }