Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Unified Diff: components/autofill/content/renderer/autofill_agent.cc

Issue 1208133002: [Autofill/Autocomplete Feature] Substring matching instead of prefix matching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added |match_start| usage. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 79542aff2520a500debcf60c29699d73e28d5524..36fb679e0e0d7f4b48048d9468aad4c26c9580f7 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -571,10 +571,11 @@ void AutofillAgent::OnFillFieldWithValue(const base::string16& value) {
}
}
-void AutofillAgent::OnPreviewFieldWithValue(const base::string16& value) {
+void AutofillAgent::OnPreviewFieldWithValue(const base::string16& value,
+ int match_start) {
WebInputElement* input_element = toWebInputElement(&element_);
if (input_element)
- PreviewFieldWithValue(value, input_element);
+ PreviewFieldWithValue(value, input_element, match_start);
}
void AutofillAgent::OnAcceptDataListSuggestion(const base::string16& value) {
@@ -590,13 +591,11 @@ void AutofillAgent::OnFillPasswordSuggestion(const base::string16& username,
DCHECK(handled);
}
-void AutofillAgent::OnPreviewPasswordSuggestion(
- const base::string16& username,
- const base::string16& password) {
- bool handled = password_autofill_agent_->PreviewSuggestion(
- element_,
- username,
- password);
+void AutofillAgent::OnPreviewPasswordSuggestion(const base::string16& username,
+ const base::string16& password,
+ int start) {
+ bool handled = password_autofill_agent_->PreviewSuggestion(element_, username,
+ password, start);
DCHECK(handled);
}
@@ -736,11 +735,12 @@ void AutofillAgent::FillFieldWithValue(const base::string16& value,
}
void AutofillAgent::PreviewFieldWithValue(const base::string16& value,
- WebInputElement* node) {
+ WebInputElement* node,
+ int match_start) {
was_query_node_autofilled_ = element_.isAutofilled();
node->setSuggestedValue(value.substr(0, node->maxLength()));
node->setAutofilled(true);
- node->setSelectionRange(node->value().length(),
+ node->setSelectionRange(std::min(match_start, node->maxLength()),
node->suggestedValue().length());
}
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.h ('k') | components/autofill/content/renderer/password_autofill_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698