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

Unified Diff: cc/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: Don't plumb through WebLayerTreeView Created 7 years, 11 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/top_controls_manager.h ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/top_controls_manager.cc
diff --git a/cc/top_controls_manager.cc b/cc/top_controls_manager.cc
index 7c0f03cf3b5bcc25be9ad55829f611f1bb7136ea..ce0c8992050b1b6adc3e5dbe4e293e7a8edfe80e 100644
--- a/cc/top_controls_manager.cc
+++ b/cc/top_controls_manager.cc
@@ -34,35 +34,31 @@ TopControlsManager::TopControlsManager(TopControlsManagerClient* client,
: client_(client),
animation_direction_(NO_ANIMATION),
is_overlay_mode_(false),
- scroll_readjustment_enabled_(false),
top_controls_height_(top_controls_height),
controls_top_offset_(0),
content_top_offset_(top_controls_height),
- previous_root_scroll_offset_(0.f) {
+ in_user_scroll_(false) {
CHECK(client_);
}
TopControlsManager::~TopControlsManager() {
}
-void TopControlsManager::UpdateDrawPositions() {
- if (!client_->haveRootScrollLayer())
+void TopControlsManager::ProgrammaticScroll(gfx::Vector2d targetOffset) {
+ if (controls_top_offset_ == -top_controls_height_)
return;
- // If the scroll position has changed underneath us (i.e. a javascript
- // scroll), then simulate a scroll that covers the delta.
- float scroll_total_y = RootScrollLayerTotalScrollY();
- if (scroll_readjustment_enabled_
- && scroll_total_y != previous_root_scroll_offset_) {
- ScrollBy(gfx::Vector2dF(0, scroll_total_y - previous_root_scroll_offset_));
- StartAnimationIfNecessary();
- previous_root_scroll_offset_ = RootScrollLayerTotalScrollY();
- }
+ // We're in a user scroll.
+ if (in_user_scroll_)
+ return;
+
+ ScrollBy(gfx::Vector2dF(0, top_controls_height_));
Ted C 2013/01/24 22:01:01 hmm...so any javascript scroll will attempt to hid
John Knottenbelt 2013/01/30 16:08:45 We can restrict it here to just 0,0 and 0,1 if we
+ StartAnimationIfNecessary();
Ted C 2013/01/24 22:01:01 The start animation if necessary shouldn't be requ
John Knottenbelt 2013/01/30 16:08:45 Done.
}
void TopControlsManager::ScrollBegin() {
ResetAnimations();
- scroll_readjustment_enabled_ = false;
+ in_user_scroll_ = true;
}
gfx::Vector2dF TopControlsManager::ScrollBy(
@@ -113,8 +109,7 @@ gfx::Vector2dF TopControlsManager::ScrollInternal(
void TopControlsManager::ScrollEnd() {
StartAnimationIfNecessary();
- previous_root_scroll_offset_ = RootScrollLayerTotalScrollY();
- scroll_readjustment_enabled_ = true;
+ in_user_scroll_ = false;
}
void TopControlsManager::Animate(base::TimeTicks monotonic_time) {
« no previous file with comments | « cc/top_controls_manager.h ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698