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

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: if one of the vectors is non-empty, return it 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..73b9a3e23c263c1ffd264a8aa5e73871bdd53dff 100644
--- a/chrome/browser/autocomplete/shortcuts_provider.cc
+++ b/chrome/browser/autocomplete/shortcuts_provider.cc
@@ -295,24 +295,7 @@ ACMatchClassifications ShortcutsProvider::ClassifyAllMatchesInString(
}
// Merge match-marking data with original classifications.
Peter Kasting 2012/09/10 23:34:35 Nit: Comment no longer needed
Daniel Erat 2012/09/10 23:46:05 Done.
- if ((match_class.size() == 1) &&
- (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;
- }
- return output;
+ return AutocompleteMatch::MergeClassifications(original_class, match_class);
}
history::ShortcutsBackend::ShortcutMap::const_iterator

Powered by Google App Engine
This is Rietveld 408576698