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

Unified Diff: cc/layer_tree_host_impl.cc

Issue 12090014: Add a bit to not bubble scrolls to parent scrolling layers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits 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/layer_tree_host_impl.h ('k') | cc/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_impl.cc
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 36c8d6738bf0de19f6cfe0da05694c025b583a5b..86c416d0233cca07d0623d55a81b0b4b21de9fea 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -133,6 +133,8 @@ scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::create(const LayerTreeSettings&
LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy* proxy)
: m_client(client)
, m_proxy(proxy)
+ , m_didLockScrollingLayer(false)
+ , m_shouldBubbleScrolls(false)
, m_scrollDeltaIsInViewportSpace(false)
, m_settings(settings)
, m_debugState(settings.initialDebugState)
@@ -1182,6 +1184,7 @@ InputHandlerClient::ScrollStatus LayerTreeHostImpl::scrollBegin(gfx::Point viewp
if (potentiallyScrollingLayerImpl) {
m_activeTree->set_currently_scrolling_layer(potentiallyScrollingLayerImpl);
+ m_shouldBubbleScrolls = (type != NonBubblingGesture);
// Gesture events need to be transformed from viewport coordinates to local layer coordinates
// so that the scrolling contents exactly follow the user's finger. In contrast, wheel
// events are already in local layer coordinates so we can just apply them directly.
@@ -1278,9 +1281,18 @@ bool LayerTreeHostImpl::scrollBy(const gfx::Point& viewportPoint,
// If the layer wasn't able to move, try the next one in the hierarchy.
float moveThresholdSquared = 0.1f * 0.1f;
- if (appliedDelta.LengthSquared() < moveThresholdSquared)
- continue;
+ if (appliedDelta.LengthSquared() < moveThresholdSquared) {
+ if (m_shouldBubbleScrolls || !m_didLockScrollingLayer)
+ continue;
+ else
+ break;
+ }
didScroll = true;
+ m_didLockScrollingLayer = true;
+ if (!m_shouldBubbleScrolls) {
+ m_activeTree->set_currently_scrolling_layer(layerImpl);
+ break;
+ }
// If the applied delta is within 45 degrees of the input delta, bail out to make it easier
// to scroll just one layer in one direction without affecting any of its parents.
@@ -1310,6 +1322,7 @@ bool LayerTreeHostImpl::scrollBy(const gfx::Point& viewportPoint,
void LayerTreeHostImpl::clearCurrentlyScrollingLayer()
{
m_activeTree->ClearCurrentlyScrollingLayer();
+ m_didLockScrollingLayer = false;
}
void LayerTreeHostImpl::scrollEnd()
« no previous file with comments | « cc/layer_tree_host_impl.h ('k') | cc/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698