diff options
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc | 16 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_gtk.h | 3 |
2 files changed, 15 insertions, 4 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc index 9814a59..6d9a8cc 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc @@ -871,7 +871,8 @@ void AutocompleteEditViewGtk::UpdateInstantViewColors() { theme_provider_->get_active_selection_bg_color(); } - double alpha = instant_animation_->GetCurrentValue(); + double alpha = instant_animation_->is_animating() ? + instant_animation_->GetCurrentValue() : 0.0; GdkColor text = gfx::SkColorToGdkColor(color_utils::AlphaBlend( selection_text, gfx::GdkColorToSkColor(faded_text), @@ -1286,6 +1287,8 @@ void AutocompleteEditViewGtk::HandleMarkSet(GtkTextBuffer* buffer, return; } + StopAnimation(); + // If we are here, that means the user may be changing the selection selection_suggested_ = false; @@ -1762,9 +1765,7 @@ void AutocompleteEditViewGtk::SetInstantSuggestion( // Select the whole thing. gtk_label_select_region(GTK_LABEL(instant_view_), 0, -1); - // Clear the animation delegate so we don't get an AnimationEnded() callback. - instant_animation_->set_delegate(NULL); - instant_animation_->Stop(); + StopAnimation(); if (suggestion.empty()) { gtk_widget_hide(instant_view_); @@ -1781,6 +1782,13 @@ void AutocompleteEditViewGtk::SetInstantSuggestion( } } +void AutocompleteEditViewGtk::StopAnimation() { + // Clear the animation delegate so we don't get an AnimationEnded() callback. + instant_animation_->set_delegate(NULL); + instant_animation_->Stop(); + UpdateInstantViewColors(); +} + bool AutocompleteEditViewGtk::CommitInstantSuggestion() { const gchar* suggestion = gtk_label_get_text(GTK_LABEL(instant_view_)); if (!suggestion || !*suggestion) diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h index fa25e90..21f4a93 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h @@ -341,6 +341,9 @@ class AutocompleteEditViewGtk : public AutocompleteEditView, // make sure they have the same baseline. void AdjustVerticalAlignmentOfInstantView(); + // Stop showing the instant suggest auto-commit animation. + void StopAnimation(); + // The widget we expose, used for vertically centering the real text edit, // since the height will change based on the font / font size, etc. OwnedWidgetGtk alignment_; |