Chromium Code Reviews| Index: Source/core/html/HTMLTextFormControlElement.cpp |
| diff --git a/Source/core/html/HTMLTextFormControlElement.cpp b/Source/core/html/HTMLTextFormControlElement.cpp |
| index 658ef9df2375ac4015e2f817e6984bd35abc38bf..4174b9743a75bf888f8ecba138b8cbbdbe71c351 100644 |
| --- a/Source/core/html/HTMLTextFormControlElement.cpp |
| +++ b/Source/core/html/HTMLTextFormControlElement.cpp |
| @@ -393,11 +393,12 @@ VisiblePosition HTMLTextFormControlElement::visiblePositionForIndex(int index) c |
| { |
| if (index <= 0) |
| return VisiblePosition(firstPositionInNode(innerEditorElement()), DOWNSTREAM); |
| - RefPtrWillBeRawPtr<Range> range = Range::create(document()); |
| - range->selectNodeContents(innerEditorElement(), ASSERT_NO_EXCEPTION); |
| - CharacterIterator it(range.get()); |
| + Position start, end; |
| + bool selected = Range::selectNodeContents(innerEditorElement(), start, end); |
|
yosin_UTC9
2014/09/12 01:02:24
It seems utilizing |selected| makes cleaner.
if (
Mads Ager (chromium)
2014/09/12 10:52:08
Done.
|
| + ASSERT_UNUSED(selected, selected); |
| + CharacterIterator it(start, end); |
| it.advance(index - 1); |
| - return VisiblePosition(it.range()->endPosition(), UPSTREAM); |
| + return VisiblePosition(it.endPosition(), UPSTREAM); |
| } |
| int HTMLTextFormControlElement::indexForVisiblePosition(const VisiblePosition& pos) const |