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

Unified Diff: cc/input/top_controls_manager.cc

Issue 11967015: Hide location bar on WebKit programmatic scroll. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove semicolon from end of message declaration Created 7 years, 9 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
« no previous file with comments | « cc/input/top_controls_manager.h ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/input/top_controls_manager.cc
diff --git a/cc/input/top_controls_manager.cc b/cc/input/top_controls_manager.cc
index e1698f1316cbd626d7a500ca81ae2cd273b10131..f09644abc336b7dedab1c35dd9b6f704520c4ee1 100644
--- a/cc/input/top_controls_manager.cc
+++ b/cc/input/top_controls_manager.cc
@@ -60,10 +60,16 @@ void TopControlsManager::EnableHidingTopControls(bool enable) {
if (!enable) {
ResetAnimations();
- if (controls_top_offset_ != 0) {
- SetupAnimation(SHOWING_CONTROLS);
- client_->setNeedsRedraw();
- }
+ SetupAnimation(SHOWING_CONTROLS);
+ }
+}
+
+void TopControlsManager::ShowTopControls(bool show) {
+ if (show) {
+ SetupAnimation(SHOWING_CONTROLS);
+ } else {
+ DCHECK(enable_hiding_);
+ SetupAnimation(HIDING_CONTROLS);
}
}
@@ -137,6 +143,18 @@ void TopControlsManager::ResetAnimations() {
}
void TopControlsManager::SetupAnimation(AnimationDirection direction) {
+ DCHECK(direction != NO_ANIMATION);
+
+ if (direction == SHOWING_CONTROLS && controls_top_offset_ == 0)
+ return;
+
+ if (direction == HIDING_CONTROLS &&
+ controls_top_offset_ == -top_controls_height_)
+ return;
+
+ if (top_controls_animation_ && animation_direction_ == direction)
+ return;
+
top_controls_animation_ = KeyframedFloatAnimationCurve::Create();
double start_time =
(base::TimeTicks::Now() - base::TimeTicks()).InMillisecondsF();
@@ -150,6 +168,7 @@ void TopControlsManager::SetupAnimation(AnimationDirection direction) {
controls_top_offset_ + max_ending_offset,
EaseTimingFunction::Create()));
animation_direction_ = direction;
+ client_->setNeedsRedraw();
}
void TopControlsManager::StartAnimationIfNecessary() {
@@ -171,11 +190,8 @@ void TopControlsManager::StartAnimationIfNecessary() {
SHOWING_CONTROLS : HIDING_CONTROLS;
}
- if (show_controls != NO_ANIMATION &&
- (!top_controls_animation_ || animation_direction_ != show_controls)) {
+ if (show_controls != NO_ANIMATION)
SetupAnimation(show_controls);
- client_->setNeedsRedraw();
- }
}
}
« no previous file with comments | « cc/input/top_controls_manager.h ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698