Index: cc/layers/layer_impl.cc |
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc |
index 4865fe2bd2c4376e93b9248ac1f6e0bdb37a0780..26fa8d8707e40f9c46a34364bcf3841724cbc21e 100644 |
--- a/cc/layers/layer_impl.cc |
+++ b/cc/layers/layer_impl.cc |
@@ -265,11 +265,25 @@ gfx::Vector2dF LayerImpl::ScrollBy(gfx::Vector2dF scroll) { |
new_delta.SetToMax(min_delta); |
new_delta.SetToMin(max_delta); |
gfx::Vector2dF unscrolled = ScrollDelta() + scroll - new_delta; |
- |
SetScrollDelta(new_delta); |
return unscrolled; |
} |
+void LayerImpl::ApplySentScrollDeltas() { |
+ // Pending tree never has sent scroll deltas |
+ DCHECK(layer_tree_impl()->IsActiveTree()); |
+ |
+ // Apply sent scroll deltas to scroll position / scroll delta as if the |
+ // main thread had applied them and then committed those values. |
+ // |
+ // This function should not change the total scroll offset; it just shifts |
+ // some of the scroll delta to the scroll offset. Therefore, adjust these |
+ // variables directly rather than calling the scroll offset delegate. |
+ scroll_offset_ += sent_scroll_delta_; |
+ scroll_delta_ -= sent_scroll_delta_; |
+ sent_scroll_delta_ = gfx::Vector2d(); |
+} |
+ |
InputHandler::ScrollStatus LayerImpl::TryScroll( |
gfx::PointF screen_space_point, |
InputHandler::ScrollInputType type) const { |
@@ -893,8 +907,8 @@ void LayerImpl::SetScrollDelta(gfx::Vector2dF scroll_delta) { |
} else { |
scroll_delta_ = scroll_delta; |
} |
- NoteLayerPropertyChangedForSubtree(); |
+ NoteLayerPropertyChangedForSubtree(); |
UpdateScrollbarPositions(); |
} |