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

Unified Diff: cc/layers/layer_impl.cc

Issue 665233004: Make aborted commits inform the scroll delegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add early return and update comment Created 6 years, 1 month 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 | « no previous file | 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 2b1193370eee237e307ce28f4074ce6a3134ce8c..bfd8f711da06716ac544d3535c301feddd670dcb 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -397,23 +397,22 @@ bool LayerImpl::user_scrollable(ScrollbarOrientation orientation) const {
}
void LayerImpl::ApplySentScrollDeltasFromAbortedCommit() {
+ if (sent_scroll_delta_.IsZero())
+ return;
+
// Pending tree never has sent scroll deltas
DCHECK(layer_tree_impl()->IsActiveTree());
+ // The combination of pending tree and aborted commits with impl scrolls
+ // shouldn't happen; we don't know how to update its deltas correctly.
+ DCHECK(!layer_tree_impl()->FindPendingTreeLayerById(id()));
+
// 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 to
- // avoid sending it multiple spurious calls.
- //
- // Because of the way scroll delta is calculated with a delegate, this will
- // leave the total scroll offset unchanged on this layer regardless of
- // whether a delegate is being used.
- scroll_offset_ += gfx::ScrollOffset(sent_scroll_delta_);
- scroll_delta_ -= sent_scroll_delta_;
- sent_scroll_delta_ = gfx::Vector2dF();
+ SetScrollOffsetAndDelta(
+ scroll_offset_ + gfx::ScrollOffset(sent_scroll_delta_),
+ ScrollDelta() - sent_scroll_delta_);
+ SetSentScrollDelta(gfx::Vector2dF());
}
void LayerImpl::ApplyScrollDeltasSinceBeginMainFrame() {
« no previous file with comments | « no previous file | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698