| Index: Source/core/rendering/RenderText.cpp
|
| diff --git a/Source/core/rendering/RenderText.cpp b/Source/core/rendering/RenderText.cpp
|
| index b89ddc756ba895becf08f1e0450384710bd4f2af..494b34d3d383ee4c161cdcac5b7ad4406e901b27 100644
|
| --- a/Source/core/rendering/RenderText.cpp
|
| +++ b/Source/core/rendering/RenderText.cpp
|
| @@ -720,7 +720,7 @@ LayoutRect RenderText::localCaretRect(InlineBox* inlineBox, int caretOffset, Lay
|
| return style()->isHorizontalWritingMode() ? IntRect(left, top, caretWidth, height) : IntRect(top, left, height, caretWidth);
|
| }
|
|
|
| -ALWAYS_INLINE float RenderText::widthFromCache(const Font& f, int start, int len, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
|
| +ALWAYS_INLINE float RenderText::widthFromCache(const Font& f, int start, int len, float xPos, TextDirection textDirection, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
|
| {
|
| if (style()->hasTextCombine() && isCombineText()) {
|
| const RenderCombineText* combineText = toRenderCombineText(this);
|
| @@ -760,7 +760,7 @@ ALWAYS_INLINE float RenderText::widthFromCache(const Font& f, int start, int len
|
| return w;
|
| }
|
|
|
| - TextRun run = RenderBlockFlow::constructTextRun(const_cast<RenderText*>(this), f, this, start, len, style());
|
| + TextRun run = RenderBlockFlow::constructTextRun(const_cast<RenderText*>(this), f, this, start, len, style(), textDirection);
|
| run.setCharactersLength(textLength() - start);
|
| ASSERT(run.charactersLength() >= run.length());
|
|
|
| @@ -839,7 +839,7 @@ void RenderText::trimmedPrefWidths(float leadWidth,
|
| linelen++;
|
|
|
| if (linelen) {
|
| - lastLineMaxWidth = widthFromCache(f, i, linelen, leadWidth + lastLineMaxWidth, 0, 0);
|
| + lastLineMaxWidth = widthFromCache(f, i, linelen, leadWidth + lastLineMaxWidth, LTR, 0, 0);
|
| if (firstLine) {
|
| firstLine = false;
|
| leadWidth = 0;
|
| @@ -881,7 +881,7 @@ void RenderText::computePreferredLogicalWidths(float leadWidth)
|
| {
|
| HashSet<const SimpleFontData*> fallbackFonts;
|
| GlyphOverflow glyphOverflow;
|
| - computePreferredLogicalWidths(leadWidth, fallbackFonts, glyphOverflow);
|
| + computePreferredLogicalWidths(leadWidth, LTR, fallbackFonts, glyphOverflow);
|
| if (fallbackFonts.isEmpty() && !glyphOverflow.left && !glyphOverflow.right && !glyphOverflow.top && !glyphOverflow.bottom)
|
| m_knownToHaveNoOverflowAndNoFallbackFonts = true;
|
| }
|
| @@ -892,7 +892,7 @@ static inline float hyphenWidth(RenderText* renderer, const Font& font)
|
| return font.width(RenderBlockFlow::constructTextRun(renderer, font, style->hyphenString().string(), style));
|
| }
|
|
|
| -void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow)
|
| +void RenderText::computePreferredLogicalWidths(float leadWidth, TextDirection textDirection, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow)
|
| {
|
| ASSERT(m_hasTab || preferredLogicalWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts);
|
|
|
| @@ -979,7 +979,7 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
|
| lastWordBoundary++;
|
| continue;
|
| } else if (c == softHyphen) {
|
| - currMaxWidth += widthFromCache(f, lastWordBoundary, i - lastWordBoundary, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow);
|
| + currMaxWidth += widthFromCache(f, lastWordBoundary, i - lastWordBoundary, leadWidth + currMaxWidth, textDirection, &fallbackFonts, &glyphOverflow);
|
| if (firstGlyphLeftOverflow < 0)
|
| firstGlyphLeftOverflow = glyphOverflow.left;
|
| lastWordBoundary = i + 1;
|
| @@ -1007,9 +1007,9 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
|
| bool isSpace = (j < len) && c == ' ';
|
| float w;
|
| if (wordTrailingSpaceWidth && isSpace)
|
| - w = widthFromCache(f, i, wordLen + 1, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow) - wordTrailingSpaceWidth;
|
| + w = widthFromCache(f, i, wordLen + 1, leadWidth + currMaxWidth, textDirection, &fallbackFonts, &glyphOverflow) - wordTrailingSpaceWidth;
|
| else {
|
| - w = widthFromCache(f, i, wordLen, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow);
|
| + w = widthFromCache(f, i, wordLen, leadWidth + currMaxWidth, textDirection, &fallbackFonts, &glyphOverflow);
|
| if (c == softHyphen)
|
| currMinWidth += hyphenWidth(this, f);
|
| }
|
| @@ -1023,7 +1023,7 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
|
| if (lastWordBoundary == i)
|
| currMaxWidth += w;
|
| else
|
| - currMaxWidth += widthFromCache(f, lastWordBoundary, j - lastWordBoundary, leadWidth + currMaxWidth, &fallbackFonts, &glyphOverflow);
|
| + currMaxWidth += widthFromCache(f, lastWordBoundary, j - lastWordBoundary, leadWidth + currMaxWidth, textDirection, &fallbackFonts, &glyphOverflow);
|
| lastWordBoundary = j;
|
| }
|
|
|
| @@ -1445,7 +1445,7 @@ void RenderText::positionLineBox(InlineBox* box)
|
| m_containsReversedText |= !s->isLeftToRightDirection();
|
| }
|
|
|
| -float RenderText::width(unsigned from, unsigned len, float xPos, bool firstLine, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
|
| +float RenderText::width(unsigned from, unsigned len, float xPos, TextDirection textDirection, bool firstLine, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
|
| {
|
| if (from >= textLength())
|
| return 0;
|
| @@ -1453,10 +1453,10 @@ float RenderText::width(unsigned from, unsigned len, float xPos, bool firstLine,
|
| if (from + len > textLength())
|
| len = textLength() - from;
|
|
|
| - return width(from, len, style(firstLine)->font(), xPos, fallbackFonts, glyphOverflow);
|
| + return width(from, len, style(firstLine)->font(), xPos, textDirection, fallbackFonts, glyphOverflow);
|
| }
|
|
|
| -float RenderText::width(unsigned from, unsigned len, const Font& f, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
|
| +float RenderText::width(unsigned from, unsigned len, const Font& f, float xPos, TextDirection textDirection, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
|
| {
|
| ASSERT(from + len <= textLength());
|
| if (!textLength())
|
| @@ -1468,17 +1468,18 @@ float RenderText::width(unsigned from, unsigned len, const Font& f, float xPos,
|
| if (fallbackFonts) {
|
| ASSERT(glyphOverflow);
|
| if (preferredLogicalWidthsDirty() || !m_knownToHaveNoOverflowAndNoFallbackFonts) {
|
| - const_cast<RenderText*>(this)->computePreferredLogicalWidths(0, *fallbackFonts, *glyphOverflow);
|
| + const_cast<RenderText*>(this)->computePreferredLogicalWidths(0, textDirection, *fallbackFonts, *glyphOverflow);
|
| if (fallbackFonts->isEmpty() && !glyphOverflow->left && !glyphOverflow->right && !glyphOverflow->top && !glyphOverflow->bottom)
|
| m_knownToHaveNoOverflowAndNoFallbackFonts = true;
|
| }
|
| w = m_maxWidth;
|
| } else
|
| w = maxLogicalWidth();
|
| - } else
|
| - w = widthFromCache(f, from, len, xPos, fallbackFonts, glyphOverflow);
|
| + } else {
|
| + w = widthFromCache(f, from, len, xPos, textDirection, fallbackFonts, glyphOverflow);
|
| + }
|
| } else {
|
| - TextRun run = RenderBlockFlow::constructTextRun(const_cast<RenderText*>(this), f, this, from, len, style());
|
| + TextRun run = RenderBlockFlow::constructTextRun(const_cast<RenderText*>(this), f, this, from, len, style(), textDirection);
|
| run.setCharactersLength(textLength() - from);
|
| ASSERT(run.charactersLength() >= run.length());
|
|
|
|
|