Chromium Code Reviews| Index: Source/core/html/forms/TextFieldInputType.cpp |
| diff --git a/Source/core/html/forms/TextFieldInputType.cpp b/Source/core/html/forms/TextFieldInputType.cpp |
| index beb8cd5bfc56b9c21268ca2fe4378d2270542a3b..132c896d28f9f891528d9013e5209af6fd558930 100644 |
| --- a/Source/core/html/forms/TextFieldInputType.cpp |
| +++ b/Source/core/html/forms/TextFieldInputType.cpp |
| @@ -160,10 +160,14 @@ void TextFieldInputType::setValue(const String& sanitizedValue, bool valueChange |
| input->updateView(); |
| unsigned max = visibleValue().length(); |
| - if (input->focused()) |
| - input->setSelectionRange(max, max); |
| - else |
| - input->cacheSelectionInResponseToSetValue(max); |
| + if (input->focused()) { |
| + if (input->selectionStart() != input->selectionEnd()) |
| + input->setSelectionRange(input->selectionStart(), input->selectionEnd()); |
| + else |
| + input->setSelectionRange(max, max); |
| + } else { |
| + input->setSelectionRange(input->selectionStart(), input->selectionEnd()); |
|
yosin_UTC9
2014/07/03 01:58:36
Why do we need to set same value to input field se
harpreet.sk
2014/07/04 13:50:27
In case if input field is focused and selection is
|
| + } |
| if (!valueChanged) |
| return; |