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. |