diff options
Diffstat (limited to 'WebCore/rendering/RootInlineBox.cpp')
-rw-r--r-- | WebCore/rendering/RootInlineBox.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/WebCore/rendering/RootInlineBox.cpp b/WebCore/rendering/RootInlineBox.cpp index 3e5b6c7..cdc6525 100644 --- a/WebCore/rendering/RootInlineBox.cpp +++ b/WebCore/rendering/RootInlineBox.cpp @@ -47,6 +47,7 @@ RootInlineBox::RootInlineBox(RenderBlock* block) , m_lineBottom(0) , m_paginationStrut(0) , m_blockLogicalHeight(0) + , m_baselineType(AlphabeticBaseline) { setIsHorizontal(block->style()->isHorizontalWritingMode()); } @@ -214,7 +215,7 @@ void RootInlineBox::childRemoved(InlineBox* box) } } -int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap) +int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache) { #if ENABLE(SVG) // SVG will handle vertical alignment on its own. @@ -226,11 +227,16 @@ int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAn int 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(); - computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, noQuirksMode, textBoxDataMap); + m_baselineType = requiresIdeographicBaseline(textBoxDataMap) ? IdeographicBaseline : AlphabeticBaseline; + + computeLogicalBoxHeights(maxPositionTop, maxPositionBottom, maxAscent, maxDescent, setMaxAscent, setMaxDescent, noQuirksMode, + textBoxDataMap, m_baselineType, verticalPositionCache); if (maxAscent + maxDescent < max(maxPositionTop, maxPositionBottom)) adjustMaxAscentAndDescent(maxAscent, maxDescent, maxPositionTop, maxPositionBottom); @@ -239,7 +245,7 @@ int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAn int lineTop = heightOfBlock; int lineBottom = heightOfBlock; bool setLineTop = false; - placeBoxesInBlockDirection(heightOfBlock, maxHeight, maxAscent, noQuirksMode, lineTop, lineBottom, setLineTop); + placeBoxesInBlockDirection(heightOfBlock, maxHeight, maxAscent, noQuirksMode, lineTop, lineBottom, setLineTop, m_baselineType); computeBlockDirectionOverflow(lineTop, lineBottom, noQuirksMode, textBoxDataMap); setLineTopBottomPositions(lineTop, lineBottom); @@ -403,7 +409,7 @@ static bool isEditableLeaf(InlineBox* leaf) return leaf && leaf->renderer() && leaf->renderer()->node() && leaf->renderer()->node()->isContentEditable(); } -InlineBox* RootInlineBox::closestLeafChildForXPos(int x, bool onlyEditableLeaves) +InlineBox* RootInlineBox::closestLeafChildForLogicalLeftPosition(int leftPosition, bool onlyEditableLeaves) { InlineBox* firstLeaf = firstLeafChild(); InlineBox* lastLeaf = lastLeafChild(); @@ -411,13 +417,13 @@ InlineBox* RootInlineBox::closestLeafChildForXPos(int x, bool onlyEditableLeaves return firstLeaf; // Avoid returning a list marker when possible. - if (x <= firstLeaf->m_x && !firstLeaf->renderer()->isListMarker() && (!onlyEditableLeaves || isEditableLeaf(firstLeaf))) - // The x coordinate is less or equal to left edge of the firstLeaf. + if (leftPosition <= firstLeaf->logicalLeft() && !firstLeaf->renderer()->isListMarker() && (!onlyEditableLeaves || isEditableLeaf(firstLeaf))) + // The leftPosition coordinate is less or equal to left edge of the firstLeaf. // Return it. return firstLeaf; - if (x >= lastLeaf->m_x + lastLeaf->m_logicalWidth && !lastLeaf->renderer()->isListMarker() && (!onlyEditableLeaves || isEditableLeaf(lastLeaf))) - // The x coordinate is greater or equal to right edge of the lastLeaf. + if (leftPosition >= lastLeaf->logicalRight() && !lastLeaf->renderer()->isListMarker() && (!onlyEditableLeaves || isEditableLeaf(lastLeaf))) + // The leftPosition coordinate is greater or equal to right edge of the lastLeaf. // Return it. return lastLeaf; @@ -425,7 +431,7 @@ InlineBox* RootInlineBox::closestLeafChildForXPos(int x, bool onlyEditableLeaves for (InlineBox* leaf = firstLeaf; leaf; leaf = leaf->nextLeafChild()) { if (!leaf->renderer()->isListMarker() && (!onlyEditableLeaves || isEditableLeaf(leaf))) { closestLeaf = leaf; - if (x < leaf->m_x + leaf->m_logicalWidth) + if (leftPosition < leaf->logicalRight()) // The x coordinate is less than the right edge of the box. // Return it. return leaf; |