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

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

Issue 10911188: autocomplete: Add AutocompleteMatch::MergeClassifications() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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: chrome/browser/autocomplete/shortcuts_provider.cc
diff --git a/chrome/browser/autocomplete/shortcuts_provider.cc b/chrome/browser/autocomplete/shortcuts_provider.cc
index 5e320e7d26e4e6c87ffcb7a5b4340d9be49312a1..9c0f575ca5dce1de8da84202074d5a19be7f3920 100644
--- a/chrome/browser/autocomplete/shortcuts_provider.cc
+++ b/chrome/browser/autocomplete/shortcuts_provider.cc
@@ -296,23 +296,12 @@ ACMatchClassifications ShortcutsProvider::ClassifyAllMatchesInString(
// Merge match-marking data with original classifications.
if ((match_class.size() == 1) &&
Peter Kasting 2012/09/10 18:56:11 This conditional can be entirely removed once the
Daniel Erat 2012/09/10 19:36:17 I had to update ShortcutsProviderTest.ClassifyAllM
- (match_class.back().style == ACMatchClassification::NONE))
+ (match_class.back().style == ACMatchClassification::NONE)) {
return original_class;
- ACMatchClassifications output;
- for (ACMatchClassifications::const_iterator i = original_class.begin(),
- j = match_class.begin(); i != original_class.end();) {
- AutocompleteMatch::AddLastClassificationIfNecessary(&output,
- std::max(i->offset, j->offset), i->style | j->style);
- const size_t next_i_offset = (i + 1) == original_class.end() ?
- static_cast<size_t>(-1) : (i + 1)->offset;
- const size_t next_j_offset = (j + 1) == match_class.end() ?
- static_cast<size_t>(-1) : (j + 1)->offset;
- if (next_i_offset >= next_j_offset)
- ++j;
- if (next_j_offset >= next_i_offset)
- ++i;
+ } else {
+ return AutocompleteMatch::MergeClassifications(original_class,
+ match_class);
}
- return output;
}
history::ShortcutsBackend::ShortcutMap::const_iterator

Powered by Google App Engine
This is Rietveld 408576698