Index: Source/core/html/forms/TextFieldInputType.cpp |
diff --git a/Source/core/html/forms/TextFieldInputType.cpp b/Source/core/html/forms/TextFieldInputType.cpp |
index 1b78abe81c6802df9dd34458a9f75859217cdbb0..f0e876e4ee59d98cb853699e337e555dd0dc5d5b 100644 |
--- a/Source/core/html/forms/TextFieldInputType.cpp |
+++ b/Source/core/html/forms/TextFieldInputType.cpp |
@@ -158,10 +158,16 @@ void TextFieldInputType::setValue(const String& sanitizedValue, bool valueChange |
input->updateView(); |
unsigned max = visibleValue().length(); |
- if (input->focused()) |
+ if (input->focused()) { |
input->setSelectionRange(max, max); |
- else |
- input->cacheSelectionInResponseToSetValue(max); |
+ } else { |
+ if (max <= (unsigned)input->selectionStart()) |
tkent
2014/04/29 23:55:44
Do not use C-style cast. Probably Making |max| in
harpreet.sk
2014/04/30 14:36:27
Done.
|
+ input->setSelectionRange(max, max); |
+ else if ((max > (unsigned)input->selectionStart()) && (max < (unsigned)input->selectionEnd())) |
+ input->setSelectionRange(input->selectionStart(), max); |
+ else |
+ input->setSelectionRange(input->selectionStart(), input->selectionEnd()); |
+ } |
if (!valueChanged) |
return; |