Commit b411b603 authored by trchen@chromium.org's avatar trchen@chromium.org

Correct line width calculation with inline-block induced word spacing

A previous CL allowed word spacing to be added around inline-blocks.
However the line width calculation wasn't consistent with children placement,
and contents will overflow on the right side of the line if there was
inline-block induced word spacing.

This CL makes RenderBlockFlow::computeInlineDirectionPositionsForSegment to be
consistent with InlineFlowBox::placeBoxRangeInInlineDirection.

BUG=429655

Review URL: https://codereview.chromium.org/704693003

git-svn-id: svn://svn.chromium.org/blink/trunk@184853 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 309cd39e
<!DOCTYPE html>
<style>
#container {
position: relative;
width: 300px;
height: 300px;
border: solid 1px red;
}
#right-align-block {
position: absolute;
right: 0;
word-spacing: 10px;
}
</style>
<div id="container">
<div id="right-align-block">
<span>AAAAA</span>
<span style="display:inline-block">BBBBB</span>
<span>CCCCC</span>
</div>
</div>
This test passes if the texts are aligned right, without overflowing.
<!DOCTYPE html>
<style>
#container {
width: 300px;
height: 300px;
border: solid 1px red;
text-align: end;
word-spacing: 10px;
}
</style>
<div id="container">
<span>AAAAA</span>
<span style="display:inline-block">BBBBB</span>
<span>CCCCC</span>
</div>
This test passes if the texts are aligned right, without overflowing.
......@@ -624,6 +624,7 @@ BidiRun* RenderBlockFlow::computeInlineDirectionPositionsForSegment(RootInlineBo
setMarginsForRubyRun(r, toRenderRubyRun(renderBox), previousObject, lineInfo);
r->m_box->setLogicalWidth(logicalWidthForChild(renderBox).toFloat());
totalLogicalWidth += marginStartForChild(renderBox) + marginEndForChild(renderBox);
needsWordSpacing = true;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment