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 5bbc66fa83073a96345c481aebfbae2559450e4e..8bda4617582415e17b815de8249afc2521f9ab89 100644 | 
| --- a/Source/core/html/forms/TextFieldInputType.cpp | 
| +++ b/Source/core/html/forms/TextFieldInputType.cpp | 
| @@ -159,11 +159,17 @@ void TextFieldInputType::setValue(const String& sanitizedValue, bool valueChange | 
| if (valueChanged) | 
| input->updateView(); | 
| - unsigned max = visibleValue().length(); | 
| - if (input->focused()) | 
| + int max = visibleValue().length(); | 
| + if (input->focused()) { | 
| input->setSelectionRange(max, max); | 
| - else | 
| - input->cacheSelectionInResponseToSetValue(max); | 
| + } else { | 
| + if (max < input->selectionStart()) | 
| 
 
tkent
2014/05/19 00:00:34
This |if| statement should be
    input->setSelect
 
harpreet.sk
2014/05/19 11:16:52
Done.
 
 | 
| + input->setSelectionRange(max, max); | 
| + else if (max >= input->selectionStart() && max < input->selectionEnd()) | 
| + input->setSelectionRange(input->selectionStart(), max); | 
| + else | 
| + input->setSelectionRange(input->selectionStart(), input->selectionEnd()); | 
| + } | 
| if (!valueChanged) | 
| return; |