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

Side by Side 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: Rebase 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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/debug/trace_event_argument.h" 8 #include "base/debug/trace_event_argument.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 return (orientation == HORIZONTAL) ? user_scrollable_horizontal_ 395 return (orientation == HORIZONTAL) ? user_scrollable_horizontal_
396 : user_scrollable_vertical_; 396 : user_scrollable_vertical_;
397 } 397 }
398 398
399 void LayerImpl::ApplySentScrollDeltasFromAbortedCommit() { 399 void LayerImpl::ApplySentScrollDeltasFromAbortedCommit() {
400 // Pending tree never has sent scroll deltas 400 // Pending tree never has sent scroll deltas
401 DCHECK(layer_tree_impl()->IsActiveTree()); 401 DCHECK(layer_tree_impl()->IsActiveTree());
402 402
403 // Apply sent scroll deltas to scroll position / scroll delta as if the 403 // Apply sent scroll deltas to scroll position / scroll delta as if the
404 // main thread had applied them and then committed those values. 404 // main thread had applied them and then committed those values.
405 // 405 SetScrollOffsetAndDelta(
406 // This function should not change the total scroll offset; it just shifts 406 scroll_offset_ + gfx::ScrollOffset(sent_scroll_delta_),
407 // some of the scroll delta to the scroll offset. Therefore, adjust these 407 ScrollDelta() - sent_scroll_delta_);
bokan 2014/10/29 23:55:42 SetScrollOffsetAndDelta sets the unsent delta on t
aelias_OOO_until_Jul13 2014/10/30 01:46:55 Empirically I don't see any bugs if I try scrollin
408 // variables directly rather than calling the scroll offset delegate to 408 SetSentScrollDelta(gfx::Vector2dF());
409 // avoid sending it multiple spurious calls.
410 //
411 // Because of the way scroll delta is calculated with a delegate, this will
412 // leave the total scroll offset unchanged on this layer regardless of
413 // whether a delegate is being used.
414 scroll_offset_ += gfx::ScrollOffset(sent_scroll_delta_);
415 scroll_delta_ -= sent_scroll_delta_;
416 sent_scroll_delta_ = gfx::Vector2dF();
417 } 409 }
418 410
419 void LayerImpl::ApplyScrollDeltasSinceBeginMainFrame() { 411 void LayerImpl::ApplyScrollDeltasSinceBeginMainFrame() {
420 // Only the pending tree can have missing scrolls. 412 // Only the pending tree can have missing scrolls.
421 DCHECK(layer_tree_impl()->IsPendingTree()); 413 DCHECK(layer_tree_impl()->IsPendingTree());
422 if (!scrollable()) 414 if (!scrollable())
423 return; 415 return;
424 416
425 // Pending tree should never have sent scroll deltas. 417 // Pending tree should never have sent scroll deltas.
426 DCHECK(sent_scroll_delta().IsZero()); 418 DCHECK(sent_scroll_delta().IsZero());
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 1581
1590 void LayerImpl::NotifyAnimationFinished( 1582 void LayerImpl::NotifyAnimationFinished(
1591 base::TimeTicks monotonic_time, 1583 base::TimeTicks monotonic_time,
1592 Animation::TargetProperty target_property, 1584 Animation::TargetProperty target_property,
1593 int group) { 1585 int group) {
1594 if (target_property == Animation::ScrollOffset) 1586 if (target_property == Animation::ScrollOffset)
1595 layer_tree_impl_->InputScrollAnimationFinished(); 1587 layer_tree_impl_->InputScrollAnimationFinished();
1596 } 1588 }
1597 1589
1598 } // namespace cc 1590 } // namespace cc
OLDNEW
« 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