Index: components/autofill/content/renderer/autofill_agent.cc |
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc |
index b6686c3cb5eb678c7b96f121ea07cdef8f133984..cffccfb6d840c4214e3b1753a327f7df1878b81b 100644 |
--- a/components/autofill/content/renderer/autofill_agent.cc |
+++ b/components/autofill/content/renderer/autofill_agent.cc |
@@ -22,6 +22,7 @@ |
#include "components/autofill/core/common/autofill_constants.h" |
#include "components/autofill/core/common/autofill_data_validation.h" |
#include "components/autofill/core/common/autofill_switches.h" |
+#include "components/autofill/core/common/autofill_util.h" |
#include "components/autofill/core/common/form_data.h" |
#include "components/autofill/core/common/form_data_predictions.h" |
#include "components/autofill/core/common/form_field_data.h" |
@@ -730,8 +731,14 @@ void AutofillAgent::PreviewFieldWithValue(const base::string16& value, |
was_query_node_autofilled_ = element_.isAutofilled(); |
node->setSuggestedValue(value.substr(0, node->maxLength())); |
node->setAutofilled(true); |
- node->setSelectionRange(node->value().length(), |
- node->suggestedValue().length()); |
+ |
+ if (IsFeatureSubstringMatchEnabled()) { |
+ size_t start = autofill::GetTextSelectionStart(value, node->value()); |
please use gerrit instead
2015/06/11 19:10:25
You've calculated the |start| value previously, so
Pritam Nikam
2015/06/12 11:09:11
We do not recalculate |start| here, we do it only
please use gerrit instead
2015/06/22 00:32:59
Ah, I was slightly confused. I thought that you ca
Pritam Nikam
2015/06/22 18:31:39
Cases where ContainsTokenThatStartsWith() returned
|
+ node->setSelectionRange(start, node->suggestedValue().length()); |
+ } else { |
+ node->setSelectionRange(node->value().length(), |
+ node->suggestedValue().length()); |
+ } |
} |
void AutofillAgent::ProcessForms() { |