OLD | NEW |
---|---|
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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
393 | 393 |
394 bool LayerImpl::user_scrollable(ScrollbarOrientation orientation) const { | 394 bool LayerImpl::user_scrollable(ScrollbarOrientation orientation) const { |
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 // The pending tree shouldn't exist during aborted commits; we don't know how | |
danakj
2014/11/04 21:11:34
Can you maybe say the pending tree shouldn't exist
aelias_OOO_until_Jul13
2014/11/04 21:19:16
Good idea. I added an early return and made the c
| |
404 // to update its deltas in this case. | |
405 DCHECK(!layer_tree_impl()->FindPendingTreeLayerById(id())); | |
enne (OOO)
2014/11/04 23:31:49
Yeah, by definition there is no pending tree durin
aelias_OOO_until_Jul13
2014/11/04 23:35:00
Thanks for the clarification. I wanted to check f
| |
406 | |
403 // Apply sent scroll deltas to scroll position / scroll delta as if the | 407 // Apply sent scroll deltas to scroll position / scroll delta as if the |
404 // main thread had applied them and then committed those values. | 408 // main thread had applied them and then committed those values. |
405 // | 409 SetScrollOffsetAndDelta( |
406 // This function should not change the total scroll offset; it just shifts | 410 scroll_offset_ + gfx::ScrollOffset(sent_scroll_delta_), |
407 // some of the scroll delta to the scroll offset. Therefore, adjust these | 411 ScrollDelta() - sent_scroll_delta_); |
408 // variables directly rather than calling the scroll offset delegate to | 412 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 } | 413 } |
418 | 414 |
419 void LayerImpl::ApplyScrollDeltasSinceBeginMainFrame() { | 415 void LayerImpl::ApplyScrollDeltasSinceBeginMainFrame() { |
420 // Only the pending tree can have missing scrolls. | 416 // Only the pending tree can have missing scrolls. |
421 DCHECK(layer_tree_impl()->IsPendingTree()); | 417 DCHECK(layer_tree_impl()->IsPendingTree()); |
422 if (!scrollable()) | 418 if (!scrollable()) |
423 return; | 419 return; |
424 | 420 |
425 // Pending tree should never have sent scroll deltas. | 421 // Pending tree should never have sent scroll deltas. |
426 DCHECK(sent_scroll_delta().IsZero()); | 422 DCHECK(sent_scroll_delta().IsZero()); |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1589 | 1585 |
1590 void LayerImpl::NotifyAnimationFinished( | 1586 void LayerImpl::NotifyAnimationFinished( |
1591 base::TimeTicks monotonic_time, | 1587 base::TimeTicks monotonic_time, |
1592 Animation::TargetProperty target_property, | 1588 Animation::TargetProperty target_property, |
1593 int group) { | 1589 int group) { |
1594 if (target_property == Animation::ScrollOffset) | 1590 if (target_property == Animation::ScrollOffset) |
1595 layer_tree_impl_->InputScrollAnimationFinished(); | 1591 layer_tree_impl_->InputScrollAnimationFinished(); |
1596 } | 1592 } |
1597 | 1593 |
1598 } // namespace cc | 1594 } // namespace cc |
OLD | NEW |