| Index: Source/core/dom/Position.cpp
 | 
| diff --git a/Source/core/dom/Position.cpp b/Source/core/dom/Position.cpp
 | 
| index f7bb399d42f1febe46e0eb0341114cf0d6e2a285..8b60a7c1dcf271ada29ee545a853ae7e7583469b 100644
 | 
| --- a/Source/core/dom/Position.cpp
 | 
| +++ b/Source/core/dom/Position.cpp
 | 
| @@ -1188,6 +1188,11 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi
 | 
|              }
 | 
|              caretOffset = inlineBox->caretLeftmostOffset();
 | 
|          }
 | 
| +    } else if (m_anchorNode->selfOrAncestorHasDirAutoAttribute()) {
 | 
| +        if (inlineBox->bidiLevel() < level)
 | 
| +            caretOffset = inlineBox->caretLeftmostOffset();
 | 
| +        else
 | 
| +            caretOffset = inlineBox->caretRightmostOffset();
 | 
|      } else {
 | 
|          InlineBox* nextBox = inlineBox->nextLeafChildIgnoringLineBreak();
 | 
|          if (!nextBox || nextBox->bidiLevel() < level) {
 | 
| @@ -1197,10 +1202,7 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi
 | 
|                      break;
 | 
|                  inlineBox = prevBox;
 | 
|              }
 | 
| -            if (m_anchorNode->selfOrAncestorHasDirAutoAttribute())
 | 
| -                caretOffset = inlineBox->bidiLevel() < level ? inlineBox->caretLeftmostOffset() : inlineBox->caretRightmostOffset();
 | 
| -            else
 | 
| -                caretOffset = inlineBox->caretLeftmostOffset();
 | 
| +            caretOffset = inlineBox->caretLeftmostOffset();
 | 
|          } else if (nextBox->bidiLevel() > level) {
 | 
|              // Left edge of a "tertiary" run. Set to the right edge of that run.
 | 
|              while (InlineBox* tertiaryBox = inlineBox->nextLeafChildIgnoringLineBreak()) {
 | 
| 
 |