Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Unified Diff: Source/core/dom/Position.cpp

Issue 541823003: Move caret to correct position when dir=auto (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Compile fix for Windows Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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()) {
« no previous file with comments | « LayoutTests/editing/selection/caret-in-textarea-auto-expected.txt ('k') | Source/core/rendering/RenderText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698