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

Unified Diff: Source/core/rendering/RenderText.cpp

Issue 541823003: Move caret to correct position when dir=auto (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderText.cpp
diff --git a/Source/core/rendering/RenderText.cpp b/Source/core/rendering/RenderText.cpp
index 03b74ff509e48640acf37d9c178eadd59e150aab..cf20e237c4735fa48a9f0205d166ed92f23c125b 100644
--- a/Source/core/rendering/RenderText.cpp
+++ b/Source/core/rendering/RenderText.cpp
@@ -694,12 +694,22 @@ LayoutRect RenderText::localCaretRect(InlineBox* inlineBox, int caretOffset, Lay
break;
}
- if (rightAligned) {
- left = std::max(left, leftEdge);
- left = std::min(left, rootRight - caretWidth);
+ if (node() && node()->selfOrAncestorHasDirAutoAttribute()) {
+ if (rightAligned && inlineBox->bidiLevel()%2) {
+ left = std::max(left, leftEdge);
+ left = std::min(left, rootRight - caretWidth);
+ } else {
+ left = std::min(left, rightEdge - caretWidthRightOfOffset);
+ left = std::max(left, rootLeft);
+ }
} else {
- left = std::min(left, rightEdge - caretWidthRightOfOffset);
- left = std::max(left, rootLeft);
+ if (rightAligned) {
+ left = std::max(left, leftEdge);
eae 2014/09/08 18:58:50 The code in this block is identical to that in the
Habib Virji 2014/09/09 10:44:02 Done.
+ left = std::min(left, rootRight - caretWidth);
+ } else {
+ left = std::min(left, rightEdge - caretWidthRightOfOffset);
+ left = std::max(left, rootLeft);
+ }
}
return style()->isHorizontalWritingMode() ? IntRect(left, top, caretWidth, height) : IntRect(top, left, height, caretWidth);
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698