summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 20:45:56 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 20:45:56 +0000
commit4bf0e93c4ccf7e0b0273517e35fafca5193435fd (patch)
treeb7e8ac2291a1f3e268e9f2e5880e2028c09ef0d2 /chrome/browser/autocomplete
parentb104b771c129e5f5eb68bfa06ca6a2fc243b00d3 (diff)
downloadchromium_src-4bf0e93c4ccf7e0b0273517e35fafca5193435fd.zip
chromium_src-4bf0e93c4ccf7e0b0273517e35fafca5193435fd.tar.gz
chromium_src-4bf0e93c4ccf7e0b0273517e35fafca5193435fd.tar.bz2
gtk - Stop the instant commit animation when the user moves the cursor.
BUG=65399 TEST=manual Review URL: http://codereview.chromium.org/5530007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68511 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc16
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.h3
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_;