Chromium Code Reviews| Index: Source/core/dom/Position.cpp |
| diff --git a/Source/core/dom/Position.cpp b/Source/core/dom/Position.cpp |
| index dacff4069ead02e8d5f39e0d2d15bf0d9294ea25..654a3f8db87f6c604f99fc714b710b6f4a183b7e 100644 |
| --- a/Source/core/dom/Position.cpp |
| +++ b/Source/core/dom/Position.cpp |
| @@ -79,6 +79,15 @@ static Node* previousRenderedEditable(Node* node) |
| return 0; |
| } |
| +static bool isTextDirectionHasAutoAttribute(Node *node) |
|
Inactive
2014/06/02 15:15:08
nit: star on wrong side.
nit: "isTextDirectionHasA
Habib Virji
2014/06/02 15:23:52
Done.
|
| +{ |
| + bool isAuto = node->selfOrAncestorHasDirAutoAttribute(); |
| + if (node->isInShadowTree()) { |
|
Inactive
2014/06/02 15:15:08
nit: No need for curly brackets.
Habib Virji
2014/06/02 15:23:52
Done.
|
| + isAuto = equalIgnoringCase(node->shadowHost()->fastGetAttribute(dirAttr), "auto"); |
| + } |
| + return isAuto; |
| +} |
| + |
| Position::Position(PassRefPtrWillBeRawPtr<Node> anchorNode, LegacyEditingOffset offset) |
| : m_anchorNode(anchorNode) |
| , m_offset(offset.value()) |
| @@ -1260,7 +1269,10 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi |
| break; |
| inlineBox = prevBox; |
| } |
| - caretOffset = inlineBox->caretLeftmostOffset(); |
| + if (isTextDirectionHasAutoAttribute(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()) { |