Index: chrome/browser/autocomplete/history_quick_provider.cc |
diff --git a/chrome/browser/autocomplete/history_quick_provider.cc b/chrome/browser/autocomplete/history_quick_provider.cc |
index 0f0405f918c96770f95cfec4c0708713fcf5016a..06e83002a577bc8f5965cb714ebe0a5b46e326d4 100644 |
--- a/chrome/browser/autocomplete/history_quick_provider.cc |
+++ b/chrome/browser/autocomplete/history_quick_provider.cc |
@@ -277,7 +277,17 @@ AutocompleteMatch HistoryQuickProvider::QuickMatchToACMatch( |
match.contents_class = |
SpansFromTermMatch(new_matches, match.contents.length(), true); |
- if (history_match.can_inline()) { |
+ // Set |inline_autocompletion| and |allowed_to_be_default_match| if possible. |
+ // The second part of this test can happen if the only match(es) of the user's |
+ // term occur in places FormatUrl() decides to omit in the formatted url. |
+ // In these cases, it's impossible to set |inline_autocompletion| correctly |
+ // and hence the match cannot be the default match. I (mpearson@) believe |
+ // this is likely caused by the mismatch that offsets are originally |
+ // computed with respect to the cleaned-up URL yet then applied and |
+ // updated by FormatUrl() as if they applied to the original string. |
+ // See crbug.com/252630. |
+ // TODO(mpearson): try removing the second clause after fixing 252630. |
Peter Kasting
2014/04/14 22:13:21
Nit: removing the second clause -> replacing the s
Mark P
2014/04/14 23:34:20
Done.
|
+ if (history_match.can_inline() && !new_matches.empty()) { |
DCHECK(!new_matches.empty()); |
size_t inline_autocomplete_offset = new_matches[0].offset + |
new_matches[0].length; |