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

Unified Diff: chrome/browser/history/in_memory_url_index_types.h

Issue 255423002: Omnibox: Highlight Matches in URLs Properly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix OffsetsFromTermMatches test Created 6 years, 8 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 | « chrome/browser/bookmarks/bookmark_utils.cc ('k') | chrome/browser/history/in_memory_url_index_types.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/in_memory_url_index_types.h
diff --git a/chrome/browser/history/in_memory_url_index_types.h b/chrome/browser/history/in_memory_url_index_types.h
index d8a024347e0253e29328c4e6e1b2e230a69f18d3..17813d56b64215e9ae72afbb28569b979f5ef0e7 100644
--- a/chrome/browser/history/in_memory_url_index_types.h
+++ b/chrome/browser/history/in_memory_url_index_types.h
@@ -54,11 +54,16 @@ TermMatches MatchTermInString(const base::string16& term,
// returns the cleaned up matches.
TermMatches SortAndDeoverlapMatches(const TermMatches& matches);
-// Extracts and returns the offsets from |matches|.
+// Extracts and returns the offsets from |matches|. This includes both
+// the offsets corresponding to the beginning of a match and the offsets
+// corresponding to the end of a match (i.e., offset+length for that match).
std::vector<size_t> OffsetsFromTermMatches(const TermMatches& matches);
-// Replaces the offsets in |matches| with those given in |offsets|, deleting
-// any which are npos, and returns the updated list of matches.
+// Replaces the offsets and lengths in |matches| with those given in |offsets|.
+// |offsets| gives beginning and ending offsets for each match; this function
+// translates (beginning, ending) offset into (beginning offset, length of
+// match). It deletes any matches for which an endpoint is npos and returns
+// the updated list of matches.
TermMatches ReplaceOffsetsInTermMatches(const TermMatches& matches,
const std::vector<size_t>& offsets);
« no previous file with comments | « chrome/browser/bookmarks/bookmark_utils.cc ('k') | chrome/browser/history/in_memory_url_index_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698