summaryrefslogtreecommitdiffstats
path: root/cc/input/top_controls_manager.cc
diff options
context:
space:
mode:
authorbokan <bokan@chromium.org>2015-03-05 08:19:35 -0800
committerCommit bot <commit-bot@chromium.org>2015-03-05 16:20:19 +0000
commit7610e74eacde3468853c9765bd3f726c14df04c1 (patch)
tree41ae127fea698a6872b12f9e63e595f79a86b7bb /cc/input/top_controls_manager.cc
parenta9df577b430b3c3fa58cb2e00dd17c410290c062 (diff)
downloadchromium_src-7610e74eacde3468853c9765bd3f726c14df04c1.zip
chromium_src-7610e74eacde3468853c9765bd3f726c14df04c1.tar.gz
chromium_src-7610e74eacde3468853c9765bd3f726c14df04c1.tar.bz2
Always create top controls manager.
This CL removes the calculate_top_controls_position flag and instead always creates the top controls manager. The methods of the manager become no-ops if the top controls height is 0 so that it becomes effectively enabled when a top controls height gets set. This fixes the attached bug because some Android Chrome UI pages don't have top controls but the manager was still created. These pages set the height to 0 to hide the top controls but the methods of the manager were still getting called. This caused a crash in Blink since ScrollBy would try to calculate the shown ratio with a 0 height, causing a NaN to propagate into Blink. BUG=460007 Review URL: https://codereview.chromium.org/961023002 Cr-Commit-Position: refs/heads/master@{#319257}
Diffstat (limited to 'cc/input/top_controls_manager.cc')
-rw-r--r--cc/input/top_controls_manager.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/cc/input/top_controls_manager.cc b/cc/input/top_controls_manager.cc
index 7362805..c8bd534 100644
--- a/cc/input/top_controls_manager.cc
+++ b/cc/input/top_controls_manager.cc
@@ -101,6 +101,9 @@ void TopControlsManager::ScrollBegin() {
gfx::Vector2dF TopControlsManager::ScrollBy(
const gfx::Vector2dF& pending_delta) {
+ if (!TopControlsHeight())
+ return pending_delta;
+
if (pinch_gesture_active_)
return pending_delta;
@@ -180,6 +183,12 @@ void TopControlsManager::SetupAnimation(AnimationDirection direction) {
if (top_controls_animation_ && animation_direction_ == direction)
return;
+ if (!TopControlsHeight()) {
+ client_->SetCurrentTopControlsShownRatio(
+ direction == HIDING_CONTROLS ? 0.f : 1.f);
+ return;
+ }
+
top_controls_animation_ = KeyframedFloatAnimationCurve::Create();
base::TimeDelta start_time = gfx::FrameTime::Now() - base::TimeTicks();
top_controls_animation_->AddKeyframe(