| Index: third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBuffer.cpp
 | 
| diff --git a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBuffer.cpp b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBuffer.cpp
 | 
| index 82b6917ae754808671abf75175140911282aea72..c75d18caeddd36d9e9f498ab54c945c3764b35e3 100644
 | 
| --- a/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBuffer.cpp
 | 
| +++ b/third_party/WebKit/Source/platform/fonts/shaping/ShapeResultBuffer.cpp
 | 
| @@ -90,11 +90,13 @@ float ShapeResultBuffer::fillGlyphBufferForRun(GlyphBuffer* glyphBuffer,
 | 
|      const HarfBuzzRunGlyphData& glyphData = run->m_glyphData[i];
 | 
|      uint16_t currentCharacterIndex =
 | 
|          run->m_startIndex + glyphData.characterIndex + runOffset;
 | 
| -    if ((direction == RTL && currentCharacterIndex >= to) ||
 | 
| -        (direction == LTR && currentCharacterIndex < from)) {
 | 
| +    if ((direction == TextDirection::Rtl && currentCharacterIndex >= to) ||
 | 
| +        (direction == TextDirection::Ltr && currentCharacterIndex < from)) {
 | 
|        advanceSoFar += glyphData.advance;
 | 
| -    } else if ((direction == RTL && currentCharacterIndex >= from) ||
 | 
| -               (direction == LTR && currentCharacterIndex < to)) {
 | 
| +    } else if ((direction == TextDirection::Rtl &&
 | 
| +                currentCharacterIndex >= from) ||
 | 
| +               (direction == TextDirection::Ltr &&
 | 
| +                currentCharacterIndex < to)) {
 | 
|        addGlyphToBuffer(glyphBuffer, advanceSoFar, run->m_direction,
 | 
|                         run->m_fontData.get(), glyphData);
 | 
|        advanceSoFar += glyphData.advance;
 | 
| @@ -131,8 +133,9 @@ float ShapeResultBuffer::fillGlyphBufferForTextEmphasisRun(
 | 
|    // linearly split the sum of corresponding glyph advances by the number of
 | 
|    // grapheme clusters in order to find positions for emphasis mark drawing.
 | 
|    uint16_t clusterStart = static_cast<uint16_t>(
 | 
| -      direction == RTL ? run->m_startIndex + run->m_numCharacters + runOffset
 | 
| -                       : run->glyphToCharacterIndex(0) + runOffset);
 | 
| +      direction == TextDirection::Rtl
 | 
| +          ? run->m_startIndex + run->m_numCharacters + runOffset
 | 
| +          : run->glyphToCharacterIndex(0) + runOffset);
 | 
|  
 | 
|    float advanceSoFar = initialAdvance;
 | 
|    const unsigned numGlyphs = run->m_glyphData.size();
 | 
| @@ -145,10 +148,10 @@ float ShapeResultBuffer::fillGlyphBufferForTextEmphasisRun(
 | 
|          isRunEnd || (run->glyphToCharacterIndex(i + 1) + runOffset !=
 | 
|                       currentCharacterIndex);
 | 
|  
 | 
| -    if ((direction == RTL && currentCharacterIndex >= to) ||
 | 
| -        (direction != RTL && currentCharacterIndex < from)) {
 | 
| +    if ((direction == TextDirection::Rtl && currentCharacterIndex >= to) ||
 | 
| +        (direction != TextDirection::Rtl && currentCharacterIndex < from)) {
 | 
|        advanceSoFar += glyphData.advance;
 | 
| -      direction == RTL ? --clusterStart : ++clusterStart;
 | 
| +      direction == TextDirection::Rtl ? --clusterStart : ++clusterStart;
 | 
|        continue;
 | 
|      }
 | 
|  
 | 
| @@ -163,7 +166,7 @@ float ShapeResultBuffer::fillGlyphBufferForTextEmphasisRun(
 | 
|        advanceSoFar += glyphAdvanceX;
 | 
|      } else if (isClusterEnd) {
 | 
|        uint16_t clusterEnd;
 | 
| -      if (direction == RTL)
 | 
| +      if (direction == TextDirection::Rtl)
 | 
|          clusterEnd = currentCharacterIndex;
 | 
|        else
 | 
|          clusterEnd = static_cast<uint16_t>(
 | 
| @@ -240,7 +243,7 @@ float ShapeResultBuffer::fillGlyphBuffer(GlyphBuffer* glyphBuffer,
 | 
|        unsigned resolvedIndex = m_results.size() - 1 - j;
 | 
|        const RefPtr<const ShapeResult>& wordResult = m_results[resolvedIndex];
 | 
|        for (unsigned i = 0; i < wordResult->m_runs.size(); i++) {
 | 
| -        advance += fillGlyphBufferForRun<RTL>(
 | 
| +        advance += fillGlyphBufferForRun<TextDirection::Rtl>(
 | 
|              glyphBuffer, wordResult->m_runs[i].get(), advance, from, to,
 | 
|              wordOffset - wordResult->numCharacters());
 | 
|        }
 | 
| @@ -251,9 +254,9 @@ float ShapeResultBuffer::fillGlyphBuffer(GlyphBuffer* glyphBuffer,
 | 
|      for (unsigned j = 0; j < m_results.size(); j++) {
 | 
|        const RefPtr<const ShapeResult>& wordResult = m_results[j];
 | 
|        for (unsigned i = 0; i < wordResult->m_runs.size(); i++) {
 | 
| -        advance +=
 | 
| -            fillGlyphBufferForRun<LTR>(glyphBuffer, wordResult->m_runs[i].get(),
 | 
| -                                       advance, from, to, wordOffset);
 | 
| +        advance += fillGlyphBufferForRun<TextDirection::Ltr>(
 | 
| +            glyphBuffer, wordResult->m_runs[i].get(), advance, from, to,
 | 
| +            wordOffset);
 | 
|        }
 | 
|        wordOffset += wordResult->numCharacters();
 | 
|      }
 | 
| @@ -297,7 +300,7 @@ CharacterRange ShapeResultBuffer::getCharacterRange(TextDirection direction,
 | 
|    bool foundFromX = false;
 | 
|    bool foundToX = false;
 | 
|  
 | 
| -  if (direction == RTL)
 | 
| +  if (direction == TextDirection::Rtl)
 | 
|      currentX = totalWidth;
 | 
|  
 | 
|    // The absoluteFrom and absoluteTo arguments represent the start/end offset
 | 
| @@ -309,7 +312,7 @@ CharacterRange ShapeResultBuffer::getCharacterRange(TextDirection direction,
 | 
|    unsigned totalNumCharacters = 0;
 | 
|    for (unsigned j = 0; j < m_results.size(); j++) {
 | 
|      const RefPtr<const ShapeResult> result = m_results[j];
 | 
| -    if (direction == RTL) {
 | 
| +    if (direction == TextDirection::Rtl) {
 | 
|        // Convert logical offsets to visual offsets, because results are in
 | 
|        // logical order while runs are in visual order.
 | 
|        if (!foundFromX && from >= 0 &&
 | 
| @@ -323,7 +326,7 @@ CharacterRange ShapeResultBuffer::getCharacterRange(TextDirection direction,
 | 
|      for (unsigned i = 0; i < result->m_runs.size(); i++) {
 | 
|        if (!result->m_runs[i])
 | 
|          continue;
 | 
| -      ASSERT((direction == RTL) == result->m_runs[i]->rtl());
 | 
| +      DCHECK_EQ(direction == TextDirection::Rtl, result->m_runs[i]->rtl());
 | 
|        int numCharacters = result->m_runs[i]->m_numCharacters;
 | 
|        if (!foundFromX && from >= 0 && from < numCharacters) {
 | 
|          fromX =
 | 
| @@ -346,24 +349,24 @@ CharacterRange ShapeResultBuffer::getCharacterRange(TextDirection direction,
 | 
|          break;
 | 
|        currentX += result->m_runs[i]->m_width;
 | 
|      }
 | 
| -    if (direction == RTL)
 | 
| +    if (direction == TextDirection::Rtl)
 | 
|        currentX -= result->width();
 | 
|      totalNumCharacters += result->numCharacters();
 | 
|    }
 | 
|  
 | 
|    // The position in question might be just after the text.
 | 
|    if (!foundFromX && absoluteFrom == totalNumCharacters) {
 | 
| -    fromX = direction == RTL ? 0 : totalWidth;
 | 
| +    fromX = direction == TextDirection::Rtl ? 0 : totalWidth;
 | 
|      foundFromX = true;
 | 
|    }
 | 
|    if (!foundToX && absoluteTo == totalNumCharacters) {
 | 
| -    toX = direction == RTL ? 0 : totalWidth;
 | 
| +    toX = direction == TextDirection::Rtl ? 0 : totalWidth;
 | 
|      foundToX = true;
 | 
|    }
 | 
|    if (!foundFromX)
 | 
|      fromX = 0;
 | 
|    if (!foundToX)
 | 
| -    toX = direction == RTL ? 0 : totalWidth;
 | 
| +    toX = direction == TextDirection::Rtl ? 0 : totalWidth;
 | 
|  
 | 
|    // None of our runs is part of the selection, possibly invalid arguments.
 | 
|    if (!foundToX && !foundFromX)
 | 
| @@ -398,17 +401,18 @@ Vector<CharacterRange> ShapeResultBuffer::individualCharacterRanges(
 | 
|      TextDirection direction,
 | 
|      float totalWidth) const {
 | 
|    Vector<CharacterRange> ranges;
 | 
| -  float currentX = direction == RTL ? totalWidth : 0;
 | 
| +  float currentX = direction == TextDirection::Rtl ? totalWidth : 0;
 | 
|    for (const RefPtr<const ShapeResult> result : m_results) {
 | 
| -    if (direction == RTL)
 | 
| +    if (direction == TextDirection::Rtl)
 | 
|        currentX -= result->width();
 | 
|      unsigned runCount = result->m_runs.size();
 | 
|      for (unsigned index = 0; index < runCount; index++) {
 | 
| -      unsigned runIndex = direction == RTL ? runCount - 1 - index : index;
 | 
| +      unsigned runIndex =
 | 
| +          direction == TextDirection::Rtl ? runCount - 1 - index : index;
 | 
|        addRunInfoRanges(*result->m_runs[runIndex], currentX, ranges);
 | 
|        currentX += result->m_runs[runIndex]->m_width;
 | 
|      }
 | 
| -    if (direction == RTL)
 | 
| +    if (direction == TextDirection::Rtl)
 | 
|        currentX -= result->width();
 | 
|    }
 | 
|    return ranges;
 | 
| 
 |