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

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: apply more feedback 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..0b52176fe116a828ac2d250f7bca33236a0da282 100644
--- a/chrome/browser/autocomplete/shortcuts_provider.cc
+++ b/chrome/browser/autocomplete/shortcuts_provider.cc
@@ -294,25 +294,7 @@ ACMatchClassifications ShortcutsProvider::ClassifyAllMatchesInString(
last_position = std::max(last_position, next_character);
}
- // Merge match-marking data with original classifications.
- 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
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_match_unittest.cc ('k') | chrome/browser/autocomplete/shortcuts_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698