Word-Spacing in InlineBox RTL scenario not to ignore if first character is space

InlineFlowBox, sets word spacing first if in LTR scenario. In RTL scenario first logicalLeft should be set prior to setting word-spacing length.

RenderBlockLineLayout, sets needsWordSpacing as true to not ignore space if first character.

BUG=344873
R=behdad,eae, aharon
TEST=fast/text/international/bidi-word-spacing.html

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

git-svn-id: svn://svn.chromium.org/blink/trunk@181636 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 089d4746
......@@ -73,6 +73,9 @@ crbug.com/310679 [ Mac ] fast/events/scale-and-scroll-iframe-window.html [ Image
crbug.com/310679 [ Mac ] fast/frames/frame-set-rotation-hit.html [ Failure ImageOnlyFailure Pass ]
crbug.com/310679 [ Mac ] fast/frames/frame-set-scaling-hit.html [ Failure ImageOnlyFailure Pass ]
crbug.com/344873 fast/text/international/bidi-word-spacing-rtl.html [ NeedsRebaseline ]
crbug.com/344873 virtual/antialiasedtext/fast/text/international/bidi-word-spacing-rtl.html [ NeedsRebaseline ]
# Tests failing since applyPageScaleFactorInCompositor enabled
crbug.com/225184 fast/repaint/relayout-fixed-position-after-scale.html [ ImageOnlyFailure ]
......
......@@ -4,8 +4,8 @@ layer at (0,0) size 800x370
RenderBlock {HTML} at (0,0) size 800x370
RenderBody {BODY} at (8,10) size 784x350
RenderBlock {DIV} at (300,0) size 184x50 [border: (1px solid #000000)]
RenderText {#text} at (72,2) size 11x46
text run at (72,2) width 11 RTL: "!"
RenderText {#text} at (172,2) size 11x46
text run at (172,2) width 11 RTL: "!"
RenderInline {SPAN} at (0,0) size 47x46
RenderText {#text} at (25,2) size 47x46
text run at (25,2) width 47 RTL: " @"
......
......@@ -382,12 +382,19 @@ float InlineFlowBox::placeBoxRangeInInlineDirection(InlineBox* firstChild, Inlin
if (curr->renderer().isText()) {
InlineTextBox* text = toInlineTextBox(curr);
RenderText& rt = text->renderer();
float space = 0;
if (rt.textLength()) {
if (needsWordSpacing && isSpaceOrNewline(rt.characterAt(text->start())))
logicalLeft += rt.style(isFirstLineStyle())->font().fontDescription().wordSpacing();
space = rt.style(isFirstLineStyle())->font().fontDescription().wordSpacing();
needsWordSpacing = !isSpaceOrNewline(rt.characterAt(text->end()));
}
text->setLogicalLeft(logicalLeft);
if (isLeftToRightDirection()) {
logicalLeft += space;
text->setLogicalLeft(logicalLeft);
} else {
text->setLogicalLeft(logicalLeft);
logicalLeft += space;
}
if (knownToHaveNoOverflow())
minLogicalLeft = std::min(logicalLeft, minLogicalLeft);
logicalLeft += text->logicalWidth();
......
......@@ -568,7 +568,7 @@ void RenderBlockFlow::computeInlineDirectionPositionsForLine(RootInlineBox* line
computeInlineDirectionPositionsForSegment(lineBox, lineInfo, textAlign, lineLogicalLeft, availableLogicalWidth, firstRun, trailingSpaceRun, textBoxDataMap, verticalPositionCache, wordMeasurements);
// The widths of all runs are now known. We can now place every inline box (and
// compute accurate widths for the inline flow boxes).
needsWordSpacing = false;
needsWordSpacing = lineBox->isLeftToRightDirection() ? false: true;
lineBox->placeBoxesInInlineDirection(lineLogicalLeft, needsWordSpacing);
}
......
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