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

Unified Diff: chrome/browser/autocomplete/history_quick_provider.cc

Issue 9307027: Fix DCHECK with Trailing Slash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/history_quick_provider.cc
===================================================================
--- chrome/browser/autocomplete/history_quick_provider.cc (revision 119838)
+++ chrome/browser/autocomplete/history_quick_provider.cc (working copy)
@@ -128,10 +128,10 @@
AutocompleteInput::FormattedStringWithEquivalentMeaning(info.url(),
net::FormatUrlWithOffsets(info.url(), languages_, format_types,
net::UnescapeRule::SPACES, NULL, NULL, &offsets));
+ history::TermMatches new_matches =
+ ReplaceOffsetsInTermMatches(history_match.url_matches, offsets);
match.contents = net::FormatUrl(info.url(), languages_, format_types,
net::UnescapeRule::SPACES, NULL, NULL, NULL);
- history::TermMatches new_matches =
- ReplaceOffsetsInTermMatches(history_match.url_matches, offsets);
match.contents_class =
SpansFromTermMatch(new_matches, match.contents.length(), true);
@@ -141,7 +141,11 @@
DCHECK(!new_matches.empty());
match.inline_autocomplete_offset = new_matches[0].offset +
new_matches[0].length;
- DCHECK_LE(match.inline_autocomplete_offset, match.fill_into_edit.length());
+ // The following will happen if the user has typed an URL with a scheme
+ // and the last character typed is a slash because that slash is removed
+ // by the FormatURLWithOffsets call above.
Peter Kasting 2012/02/02 06:35:14 We should not be stripping slashes that the user t
+ if (match.inline_autocomplete_offset > match.fill_into_edit.length())
+ match.inline_autocomplete_offset = match.fill_into_edit.length();
}
// Format the description autocomplete presentation.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698