summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/RootInlineBox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/rendering/RootInlineBox.cpp')
-rw-r--r--WebCore/rendering/RootInlineBox.cpp39
1 files changed, 35 insertions, 4 deletions
diff --git a/WebCore/rendering/RootInlineBox.cpp b/WebCore/rendering/RootInlineBox.cpp
index cdc6525..da7d037 100644
--- a/WebCore/rendering/RootInlineBox.cpp
+++ b/WebCore/rendering/RootInlineBox.cpp
@@ -48,6 +48,7 @@ RootInlineBox::RootInlineBox(RenderBlock* block)
, m_paginationStrut(0)
, m_blockLogicalHeight(0)
, m_baselineType(AlphabeticBaseline)
+ , m_containsRuby(false)
{
setIsHorizontal(block->style()->isHorizontalWritingMode());
}
@@ -199,9 +200,10 @@ bool RootInlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
void RootInlineBox::adjustPosition(int dx, int dy)
{
InlineFlowBox::adjustPosition(dx, dy);
- m_lineTop += dy;
- m_lineBottom += dy;
- m_blockLogicalHeight += dy;
+ int blockDirectionDelta = isHorizontal() ? dy : dx;
+ m_lineTop += blockDirectionDelta;
+ m_lineBottom += blockDirectionDelta;
+ m_blockLogicalHeight += blockDirectionDelta;
}
void RootInlineBox::childRemoved(InlineBox* box)
@@ -244,11 +246,25 @@ int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAn
int maxHeight = maxAscent + maxDescent;
int lineTop = heightOfBlock;
int lineBottom = heightOfBlock;
+ int lineTopIncludingMargins = heightOfBlock;
+ int lineBottomIncludingMargins = heightOfBlock;
bool setLineTop = false;
- placeBoxesInBlockDirection(heightOfBlock, maxHeight, maxAscent, noQuirksMode, lineTop, lineBottom, setLineTop, m_baselineType);
+ bool containsRuby = false;
+ placeBoxesInBlockDirection(heightOfBlock, maxHeight, maxAscent, noQuirksMode, lineTop, lineBottom, setLineTop,
+ lineTopIncludingMargins, lineBottomIncludingMargins, containsRuby, m_baselineType);
computeBlockDirectionOverflow(lineTop, lineBottom, noQuirksMode, textBoxDataMap);
setLineTopBottomPositions(lineTop, lineBottom);
+ m_containsRuby = containsRuby;
+
+ int rubyAdjustment = blockDirectionRubyAdjustment();
+ if (rubyAdjustment) {
+ // FIXME: Need to handle pagination here. We might have to move to the next page/column as a result of the
+ // ruby expansion.
+ adjustBlockDirectionPosition(rubyAdjustment);
+ heightOfBlock += rubyAdjustment;
+ }
+
// Detect integer overflow.
if (heightOfBlock > numeric_limits<int>::max() - maxHeight)
return numeric_limits<int>::max();
@@ -256,6 +272,21 @@ int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAn
return heightOfBlock + maxHeight;
}
+int RootInlineBox::blockDirectionRubyAdjustment() const
+{
+ if (!renderer()->style()->isFlippedLinesWritingMode()) {
+ if (!containsRuby())
+ return 0;
+ int highestAllowedPosition = prevRootBox() ? min(prevRootBox()->lineBottom(), lineTop()) : block()->borderBefore();
+ return computeBlockDirectionRubyAdjustment(highestAllowedPosition);
+ } else if (prevRootBox() && prevRootBox()->containsRuby()) {
+ // We have to compute the Ruby expansion for the previous line to see how much we should move.
+ int lowestAllowedPosition = max(prevRootBox()->lineBottom(), lineTop());
+ return prevRootBox()->computeBlockDirectionRubyAdjustment(lowestAllowedPosition);
+ }
+ return 0;
+}
+
GapRects RootInlineBox::lineSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
int selTop, int selHeight, const PaintInfo* paintInfo)
{