Index: third_party/WebKit/Source/core/editing/VisibleUnits.cpp |
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp |
index 0fe37bfec988ce5ee355ab3af0f81238c6e28496..d325380239b137b4c7a2f5ed33280e9a9ba38424 100644 |
--- a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp |
+++ b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp |
@@ -893,10 +893,8 @@ static InlineBoxPosition AdjustInlineBoxPositionForTextDirection( |
return InlineBoxPosition(inline_box, caret_offset); |
level = next_box->BidiLevel(); |
- InlineBox* prev_box = inline_box; |
- do { |
- prev_box = prev_box->PrevLeafChild(); |
- } while (prev_box && prev_box->BidiLevel() > level); |
+ InlineBox* const prev_box = |
+ InlineBoxTraversal::FindLeftBidiRun(*inline_box, level); |
// For example, abc FED 123 ^ CBA |
if (prev_box && prev_box->BidiLevel() == level) |
@@ -912,10 +910,8 @@ static InlineBoxPosition AdjustInlineBoxPositionForTextDirection( |
return InlineBoxPosition(inline_box, caret_offset); |
level = inline_box->PrevLeafChild()->BidiLevel(); |
- InlineBox* next_box = inline_box; |
- do { |
- next_box = next_box->NextLeafChild(); |
- } while (next_box && next_box->BidiLevel() > level); |
+ InlineBox* const next_box = |
+ InlineBoxTraversal::FindRightBidiRun(*inline_box, level); |
if (next_box && next_box->BidiLevel() == level) |
return InlineBoxPosition(inline_box, caret_offset); |