Chromium Code Reviews| Index: Source/core/html/HTMLTextFormControlElement.cpp |
| diff --git a/Source/core/html/HTMLTextFormControlElement.cpp b/Source/core/html/HTMLTextFormControlElement.cpp |
| index c3f751a63f54d4eb643bdb97275b0ecbe1ae555c..e0b02e66f21eaf05ae4c8f6f73a8f6fe767a728c 100644 |
| --- a/Source/core/html/HTMLTextFormControlElement.cpp |
| +++ b/Source/core/html/HTMLTextFormControlElement.cpp |
| @@ -279,11 +279,10 @@ void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextField |
| end = max(end, 0); |
| start = min(max(start, 0), end); |
| + cacheSelection(start, end, direction); |
|
tkent
2014/04/29 23:55:44
What happens if |start| or |end| is larger than va
harpreet.sk
2014/04/30 14:36:27
The browser will displays the caret at end of the
|
| - if (!hasVisibleTextArea(renderer(), innerTextElement())) { |
| - cacheSelection(start, end, direction); |
| + if (!hasVisibleTextArea(renderer(), innerTextElement())) |
| return; |
| - } |
| VisiblePosition startPosition = visiblePositionForIndex(start); |
| VisiblePosition endPosition; |
| if (start == end) |
| @@ -472,9 +471,6 @@ void HTMLTextFormControlElement::selectionChanged(bool userTriggered) |
| if (!renderer() || !isTextFormControl()) |
| return; |
| - // selectionStart() or selectionEnd() will return cached selection when this node doesn't have focus |
| - cacheSelection(computeSelectionStart(), computeSelectionEnd(), computeSelectionDirection()); |
| - |
| if (LocalFrame* frame = document().frame()) { |
| if (frame->selection().isRange() && userTriggered) |
| dispatchEvent(Event::createBubble(EventTypeNames::select)); |