Commit 42c888f2 authored by eae@chromium.org's avatar eae@chromium.org

Split words on text direction boundaries when computing preffered width

Change RenderText::computePreferredLogicalWidths to split "words" (i.e.
strings without spaces) at text direction boundaries to ensure accurate
measurements as text direction can effect text metrics.

BUG=333004
R=leviw@chromium.org
TEST=fast/text/international/inline-block-with-mixed-direction-words.html

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

git-svn-id: svn://svn.chromium.org/blink/trunk@165125 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 5a2d5efc
<!DOCTYPE html>
<html>
<head>
<style>
span {
display: inline-block;
font: menu;
background: pink;
line-height: 1.5em;
overflow: hidden;
position: absolute;
top: 50px;
}
</style>
</head>
<body>
<p>
The pink background should extend the full width of the
two blocks.
</p>
<span>AB&#x0627;&#x0628;</span> <span>12&#x0627;|&#x0628;:</span>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
span {
display: inline-block;
font: menu;
background: pink;
line-height: 1.5em;
position: absolute;
top: 50px;
}
</style>
</head>
<body>
<p>
The pink background should extend the full width of the
two blocks.
</p>
<span>AB&#x0627;&#x0628;</span>
<span>12&#x0627;|&#x0628;:</span>
</body>
</html>
...@@ -1020,6 +1020,8 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si ...@@ -1020,6 +1020,8 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
} }
} }
// Terminate word boundary at bidi run boundary.
j = min(j, run->stop());
int wordLen = j - i; int wordLen = j - i;
if (wordLen) { if (wordLen) {
bool isSpace = (j < len) && c == ' '; bool isSpace = (j < len) && c == ' ';
......
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