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

Unified Diff: chrome/browser/autocomplete/autocomplete_popup_model.cc

Issue 194056: Fix text and selection's save/restore issue of omnibox when displaying tempor... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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/autocomplete_popup_model.cc
===================================================================
--- chrome/browser/autocomplete/autocomplete_popup_model.cc (revision 25735)
+++ chrome/browser/autocomplete/autocomplete_popup_model.cc (working copy)
@@ -109,10 +109,21 @@
// eliminated and just become a call to the observer on the edit.
std::wstring keyword;
const bool is_keyword_hint = GetKeywordForMatch(match, &keyword);
- edit_model_->OnPopupDataChanged(
- reset_to_default ? std::wstring() : match.fill_into_edit,
- !reset_to_default, keyword, is_keyword_hint, match.type);
+ if (reset_to_default) {
+ std::wstring inline_autocomplete_text;
+ if ((match.inline_autocomplete_offset != std::wstring::npos) &&
+ (match.inline_autocomplete_offset < match.fill_into_edit.length())) {
+ inline_autocomplete_text =
+ match.fill_into_edit.substr(match.inline_autocomplete_offset);
+ }
+ edit_model_->OnPopupDataChanged(inline_autocomplete_text, false,
+ keyword, is_keyword_hint, match.type);
+ } else {
+ edit_model_->OnPopupDataChanged(match.fill_into_edit, true,
+ keyword, is_keyword_hint, match.type);
+ }
+
// Repaint old and new selected lines immediately, so that the edit doesn't
// appear to update [much] faster than the popup. We must not update
// |selected_line_| before calling OnPopupDataChanged() (since the edit may

Powered by Google App Engine
This is Rietveld 408576698