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

Unified Diff: cc/layer_tree_host_impl.cc

Issue 12077046: Plumb an overscroll callback form the compositor to the Android UI thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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..75a733be6f0db701b0b4bfdebe85d042b6386f4c 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -769,6 +769,8 @@ CompositorFrameMetadata LayerTreeHostImpl::makeCompositorFrameMetadata() const
metadata.root_scroll_offset = rootScrollLayer()->scrollOffset() + rootScrollLayer()->scrollDelta();
if (!m_settings.pageScalePinchZoomEnabled)
metadata.root_scroll_offset.Scale(1 / m_pinchZoomViewport.page_scale_factor());
+ metadata.unused_scroll_delta = m_pendingScrollDelta;
+ m_pendingScrollDelta = gfx::Vector2dF();
mkosiba (inactive) 2013/01/30 14:46:23 where would be a good place to reset is variable?
aelias_OOO_until_Jul13 2013/01/30 18:02:48 I guess it's okay to do it here. You can remove t
return metadata;
}
@@ -808,6 +810,7 @@ void LayerTreeHostImpl::didDrawAllLayers(const FrameData& frame)
for (size_t i = 0; i < frame.willDrawLayers.size(); ++i)
frame.willDrawLayers[i]->didDraw(m_resourceProvider.get());
+
// Once all layers have been drawn, pending texture uploads should no
// longer block future uploads.
m_resourceProvider->markPendingUploadsAsNonBlocking();
@@ -1323,6 +1326,7 @@ bool LayerTreeHostImpl::scrollBy(const gfx::Point& viewportPoint,
return false;
gfx::Vector2dF pendingDelta = scrollDelta;
+ gfx::Vector2dF overScrollDelta = scrollDelta;
aelias_OOO_until_Jul13 2013/01/30 18:02:48 Call this "unused" for consistency.
bool didScroll = false;
for (LayerImpl* layerImpl = currentlyScrollingLayer(); layerImpl; layerImpl = layerImpl->parent()) {
@@ -1344,6 +1348,7 @@ bool LayerTreeHostImpl::scrollBy(const gfx::Point& viewportPoint,
if (appliedDelta.LengthSquared() < moveThresholdSquared)
continue;
didScroll = true;
+ overScrollDelta.Subtract(appliedDelta);
// 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.
@@ -1362,11 +1367,14 @@ bool LayerTreeHostImpl::scrollBy(const gfx::Point& viewportPoint,
break;
}
- if (didScroll) {
+ m_pendingScrollDelta += overScrollDelta;
+
+ if (didScroll || !gfx::ToFlooredVector2d(overScrollDelta).IsZero()) {
mkosiba (inactive) 2013/01/30 14:46:23 this makes us draw frames even though the contents
aelias_OOO_until_Jul13 2013/01/30 18:02:48 I think the redraw itself is okay but let's avoid
m_client->setNeedsCommitOnImplThread();
m_client->setNeedsRedrawOnImplThread();
m_client->renewTreePriority();
}
+
return didScroll;
}

Powered by Google App Engine
This is Rietveld 408576698