Commit c1ccb26c authored by eae@chromium.org's avatar eae@chromium.org

Fix trailing space handling for complex text

Fix bug in line layout where it was incorrectly assumed that trailing
spaces would always be measured with the simple font code path.

R=chrishtr@chromium.org
BUG=423274
TEST=fast/text/international/complex-text-trailing-space.html

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

git-svn-id: svn://svn.chromium.org/blink/trunk@183716 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b8d7c09e
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
li, a {
display: inline;
float: left;
font-family: Tunga;
font-size: 12px;
border: 1px solid black;
/* optimizeLegibility forces complex text */
text-rendering: optimizeLegibility;
}
div {
clear: both;
}
</style>
</head>
<body>
<ul>
<li><a href="#">ಅಡುಗೆ-ಆಹಾರ </a></li>
</ul>
<div>&nbsp;</div>
<p>
Complex text with trailing space test.
<br>
Element above should not wrap and should render the same when
forced to use the complex path.
</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
li, a {
display: inline;
float: left;
font-family: Tunga;
font-size: 12px;
border: 1px solid black;
}
div {
clear: both;
}
</style>
</head>
<body>
<ul>
<li><a href="#">ಅಡುಗೆ-ಆಹಾರ </a></li>
</ul>
<div>&nbsp;</div>
<p>
Complex text with trailing space test.
<br>
Element above should not wrap and should render the same when
forced to use the complex path.
</p>
</body>
</html>
......@@ -1166,11 +1166,16 @@ static LayoutUnit getBorderPaddingMargin(RenderBoxModelObject* child, bool endOf
static inline void stripTrailingSpace(float& inlineMax, float& inlineMin, RenderObject* trailingSpaceChild)
{
if (trailingSpaceChild && trailingSpaceChild->isText()) {
bool useComplexCodePath = !toRenderText(trailingSpaceChild)->
canUseSimpleFontCodePath();
// Collapse away the trailing space at the end of a block.
RenderText* t = toRenderText(trailingSpaceChild);
const UChar space = ' ';
const Font& font = t->style()->font(); // FIXME: This ignores first-line.
float spaceWidth = font.width(constructTextRun(t, font, &space, 1, t->style(), LTR));
TextRun run = constructTextRun(t, font, &space, 1, t->style(), LTR);
if (useComplexCodePath)
run.setUseComplexCodePath(true);
float spaceWidth = font.width(run);
inlineMax -= spaceWidth + font.fontDescription().wordSpacing();
if (inlineMin > inlineMax)
inlineMin = inlineMax;
......
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