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

Side by Side Diff: chrome/browser/autocomplete/history_quick_provider.cc

Issue 7004042: Fix Wrong Offset (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/autocomplete/history_quick_provider.h" 5 #include "chrome/browser/autocomplete/history_quick_provider.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/i18n/break_iterator.h" 10 #include "base/i18n/break_iterator.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 InMemoryURLIndex::ReplaceOffsetsInTermMatches(history_match.url_matches, 142 InMemoryURLIndex::ReplaceOffsetsInTermMatches(history_match.url_matches,
143 offsets); 143 offsets);
144 match.contents_class = 144 match.contents_class =
145 SpansFromTermMatch(new_matches, match.contents.size(), true); 145 SpansFromTermMatch(new_matches, match.contents.size(), true);
146 match.fill_into_edit = match.contents; 146 match.fill_into_edit = match.contents;
147 147
148 if (prevent_inline_autocomplete || !history_match.can_inline) { 148 if (prevent_inline_autocomplete || !history_match.can_inline) {
149 match.inline_autocomplete_offset = string16::npos; 149 match.inline_autocomplete_offset = string16::npos;
150 } else { 150 } else {
151 match.inline_autocomplete_offset = 151 match.inline_autocomplete_offset =
152 history_match.input_location + autocomplete_input_.text().length(); 152 history_match.input_location + match.fill_into_edit.length();
153 DCHECK_LE(match.inline_autocomplete_offset, match.fill_into_edit.length()); 153 DCHECK_LE(match.inline_autocomplete_offset, match.fill_into_edit.length());
154 } 154 }
155 155
156 // Format the description autocomplete presentation. 156 // Format the description autocomplete presentation.
157 match.description = info.title(); 157 match.description = info.title();
158 match.description_class = SpansFromTermMatch(history_match.title_matches, 158 match.description_class = SpansFromTermMatch(history_match.title_matches,
159 match.description.size(), false); 159 match.description.size(), false);
160 160
161 return match; 161 return match;
162 } 162 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 do { 218 do {
219 offset += matches[i].length; 219 offset += matches[i].length;
220 ++i; 220 ++i;
221 } while ((i < match_count) && (offset == matches[i].offset)); 221 } while ((i < match_count) && (offset == matches[i].offset));
222 if (offset < text_length) 222 if (offset < text_length)
223 spans.push_back(ACMatchClassification(offset, url_style)); 223 spans.push_back(ACMatchClassification(offset, url_style));
224 } 224 }
225 225
226 return spans; 226 return spans;
227 } 227 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698