| 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());
|
| + }
|
|
|
| if (!valueChanged)
|
| return;
|
|
|