Index: Source/core/dom/Position.cpp |
diff --git a/Source/core/dom/Position.cpp b/Source/core/dom/Position.cpp |
index dacff4069ead02e8d5f39e0d2d15bf0d9294ea25..9cde3858cddc4cb1b392953a2ce853b8baf0bb13 100644 |
--- a/Source/core/dom/Position.cpp |
+++ b/Source/core/dom/Position.cpp |
@@ -228,7 +228,6 @@ Node* Position::computeNodeBeforePosition() const |
{ |
if (!m_anchorNode) |
return 0; |
- |
switch (anchorType()) { |
case PositionIsBeforeChildren: |
return 0; |
@@ -1260,7 +1259,10 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi |
break; |
inlineBox = prevBox; |
} |
- caretOffset = inlineBox->caretLeftmostOffset(); |
+ if (m_anchorNode->selfOrAncestorHasDirAutoAttribute()) |
+ caretOffset = inlineBox->bidiLevel() < level ? inlineBox->caretLeftmostOffset() : inlineBox->caretRightmostOffset(); |
+ else |
+ 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()) { |