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

Unified Diff: cc/layers/layer_impl.cc

Issue 19106007: cc: Allow the main thread to cancel commits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove DCHECKs, set vars directly Created 7 years, 5 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/layers/layer_impl.h ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698