Chromium Code Reviews| Index: chrome/browser/history/query_parser.cc |
| =================================================================== |
| --- chrome/browser/history/query_parser.cc (revision 159706) |
| +++ chrome/browser/history/query_parser.cc (working copy) |
| @@ -22,7 +22,7 @@ |
| } |
| // Returns true if |mp2| intersects |mp1|. This is intended for use by |
| -// CoalesceMatchesFrom and isn't meant as a general intersectpion comparison |
| +// CoalesceMatchesFrom and isn't meant as a general intersection comparison |
| // function. |
| bool SnippetIntersects(const Snippet::MatchPosition& mp1, |
| const Snippet::MatchPosition& mp2) { |
| @@ -36,7 +36,8 @@ |
| for (Snippet::MatchPositions::iterator i = matches->begin() + index + 1; |
| i != matches->end(); ) { |
| if (SnippetIntersects(mp, *i)) { |
| - mp.second = i->second; |
| + mp.first = std::min(mp.first, i->first); |
|
sky
2012/10/15 23:32:34
I get the need for std::max on 40, bug 39 shouldn'
mrossetti
2012/10/16 16:38:05
Makes sense. Thanks.
|
| + mp.second = std::max(mp.second, i->second); |
| i = matches->erase(i); |
| } else { |
| return; |
| @@ -125,16 +126,17 @@ |
| bool QueryNodeWord::HasMatchIn(const std::vector<QueryWord>& words, |
| Snippet::MatchPositions* match_positions) const { |
| + bool matched = false; |
| for (size_t i = 0; i < words.size(); ++i) { |
| if (Matches(words[i].word, false)) { |
| size_t match_start = words[i].position; |
| match_positions->push_back( |
| Snippet::MatchPosition(match_start, |
| match_start + static_cast<int>(word_.size()))); |
| - return true; |
| + matched = true; |
| } |
| } |
| - return false; |
| + return matched; |
| } |
| void QueryNodeWord::AppendWords(std::vector<string16>* words) const { |