Index: Source/core/dom/Position.cpp |
diff --git a/Source/core/dom/Position.cpp b/Source/core/dom/Position.cpp |
index dacff4069ead02e8d5f39e0d2d15bf0d9294ea25..fba587d1ee3cf603ff064bdf5d663f6140f16eca 100644 |
--- a/Source/core/dom/Position.cpp |
+++ b/Source/core/dom/Position.cpp |
@@ -79,6 +79,14 @@ static Node* previousRenderedEditable(Node* node) |
return 0; |
} |
+static bool hasDirectionAutoAttribute(Node* node) |
+{ |
+ bool isAuto = node->selfOrAncestorHasDirAutoAttribute(); |
+ if (node->isInShadowTree()) |
+ isAuto = equalIgnoringCase(node->shadowHost()->fastGetAttribute(dirAttr), "auto"); |
leviw_travelin_and_unemployed
2014/06/02 18:00:29
This seems specific to TextArea. If you're inside
esprehn
2014/06/02 18:06:13
I don't think this is correct, what if you're mult
Habib Virji
2014/06/03 16:35:57
@levi: If I get some assistance about how to find
Habib Virji
2014/06/03 16:35:57
@esprehn: i have upload a new patch which check mu
|
+ return isAuto; |
+} |
+ |
Position::Position(PassRefPtrWillBeRawPtr<Node> anchorNode, LegacyEditingOffset offset) |
: m_anchorNode(anchorNode) |
, m_offset(offset.value()) |
@@ -1260,7 +1268,10 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi |
break; |
inlineBox = prevBox; |
} |
- caretOffset = inlineBox->caretLeftmostOffset(); |
+ if (hasDirectionAutoAttribute(m_anchorNode.get())) |
+ 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()) { |