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

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: Added test and using scrollType instead of bool 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
Index: cc/layer_tree_host_impl.cc
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 42aa9533c928df6b108bf063cb76bb91c546d130..e016b7557dc6b7f887c41c155164fbe6ee5eef93 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -132,6 +132,8 @@ scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::create(const LayerTreeSettings&
LayerTreeHostImpl::LayerTreeHostImpl(const LayerTreeSettings& settings, LayerTreeHostImplClient* client, Proxy* proxy)
: m_client(client)
, m_proxy(proxy)
+ , m_didScrollOnce(false)
+ , m_shouldBubbleScrolls(false)
, m_scrollDeltaIsInViewportSpace(false)
, m_settings(settings)
, m_debugState(settings.initialDebugState)
@@ -1203,6 +1205,7 @@ InputHandlerClient::ScrollStatus LayerTreeHostImpl::scrollBegin(gfx::Point viewp
DCHECK(!currentlyScrollingLayer());
clearCurrentlyScrollingLayer();
+ m_didScrollOnce = false;
Sami 2013/01/30 19:28:31 Better do this in clearCurrentlyScrollingLayer().
Yusuf 2013/01/30 21:01:02 Done.
if (!ensureRenderSurfaceLayerList())
return ScrollIgnored;
@@ -1240,6 +1243,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.
@@ -1341,9 +1345,15 @@ 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_didScrollOnce)
+ continue;
+ else
+ break;
Sami 2013/01/30 19:28:31 Indent?
Yusuf 2013/01/30 21:01:02 Done.
Yusuf 2013/01/30 21:01:02 Done.
+ }
+ if (!m_shouldBubbleScrolls) m_activeTree->set_currently_scrolling_layer(layerImpl);
Sami 2013/01/30 19:28:31 You could also break here since there's no need to
Yusuf 2013/01/30 21:01:02 Done.
didScroll = true;
+ m_didScrollOnce = true;
// 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.

Powered by Google App Engine
This is Rietveld 408576698