Chromium Code Reviews| 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 10d7bb2428cb8dcae515df30e6b47cfe308179ee..00d6b6ac4c461c5d98b4ea6929b006a89f2440d0 100644 |
| --- a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp |
| +++ b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp |
| @@ -817,16 +817,20 @@ static InlineBoxPosition ComputeInlineBoxPositionTemplate( |
| if (caret_offset > caret_min_offset && caret_offset < caret_max_offset) |
| return InlineBoxPosition(box, caret_offset); |
| - if (((caret_offset == caret_max_offset) ^ |
| - (affinity == TextAffinity::kDownstream)) || |
| - ((caret_offset == caret_min_offset) ^ |
| - (affinity == TextAffinity::kUpstream)) || |
| - (caret_offset == caret_max_offset && box->NextLeafChild() && |
| - box->NextLeafChild()->IsLineBreak())) { |
| + if (caret_offset == caret_min_offset) { |
|
Xiaocheng
2017/06/12 18:35:12
I think it's better to use a wrapper function that
yosin_UTC9
2017/06/13 07:41:07
You're right. Move the condition to another functi
|
| + if (affinity == TextAffinity::kDownstream) { |
| + inline_box = box; |
| + break; |
| + } |
| + candidate = box; |
| + continue; |
| + } |
| + DCHECK_EQ(caret_offset, caret_max_offset); |
| + if (affinity == TextAffinity::kUpstream || |
| + (box->NextLeafChild() && box->NextLeafChild()->IsLineBreak())) { |
| inline_box = box; |
| break; |
| } |
| - |
| candidate = box; |
| } |
| if (candidate && candidate == text_layout_object->LastTextBox() && |