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

Side by Side Diff: cc/layers/layer_impl.cc

Issue 706203003: Update from https://crrev.com/303153 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 | « cc/layers/heads_up_display_layer_impl.cc ('k') | 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 void LayerImpl::SetScrollClipLayer(int scroll_clip_layer_id) { 390 void LayerImpl::SetScrollClipLayer(int scroll_clip_layer_id) {
391 scroll_clip_layer_ = layer_tree_impl()->LayerById(scroll_clip_layer_id); 391 scroll_clip_layer_ = layer_tree_impl()->LayerById(scroll_clip_layer_id);
392 } 392 }
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 if (sent_scroll_delta_.IsZero())
401 return;
402
400 // Pending tree never has sent scroll deltas 403 // Pending tree never has sent scroll deltas
401 DCHECK(layer_tree_impl()->IsActiveTree()); 404 DCHECK(layer_tree_impl()->IsActiveTree());
402 405
406 // The combination of pending tree and aborted commits with impl scrolls
407 // shouldn't happen; we don't know how to update its deltas correctly.
408 DCHECK(!layer_tree_impl()->FindPendingTreeLayerById(id()));
409
403 // Apply sent scroll deltas to scroll position / scroll delta as if the 410 // Apply sent scroll deltas to scroll position / scroll delta as if the
404 // main thread had applied them and then committed those values. 411 // main thread had applied them and then committed those values.
405 // 412 SetScrollOffsetAndDelta(
406 // This function should not change the total scroll offset; it just shifts 413 scroll_offset_ + gfx::ScrollOffset(sent_scroll_delta_),
407 // some of the scroll delta to the scroll offset. Therefore, adjust these 414 ScrollDelta() - sent_scroll_delta_);
408 // variables directly rather than calling the scroll offset delegate to 415 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 } 416 }
418 417
419 void LayerImpl::ApplyScrollDeltasSinceBeginMainFrame() { 418 void LayerImpl::ApplyScrollDeltasSinceBeginMainFrame() {
420 // Only the pending tree can have missing scrolls. 419 // Only the pending tree can have missing scrolls.
421 DCHECK(layer_tree_impl()->IsPendingTree()); 420 DCHECK(layer_tree_impl()->IsPendingTree());
422 if (!scrollable()) 421 if (!scrollable())
423 return; 422 return;
424 423
425 // Pending tree should never have sent scroll deltas. 424 // Pending tree should never have sent scroll deltas.
426 DCHECK(sent_scroll_delta().IsZero()); 425 DCHECK(sent_scroll_delta().IsZero());
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 is_container_for_fixed_position_layers_); 542 is_container_for_fixed_position_layers_);
544 layer->SetPositionConstraint(position_constraint_); 543 layer->SetPositionConstraint(position_constraint_);
545 layer->SetShouldFlattenTransform(should_flatten_transform_); 544 layer->SetShouldFlattenTransform(should_flatten_transform_);
546 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); 545 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_);
547 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); 546 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_);
548 547
549 layer->SetScrollClipLayer(scroll_clip_layer_ ? scroll_clip_layer_->id() 548 layer->SetScrollClipLayer(scroll_clip_layer_ ? scroll_clip_layer_->id()
550 : Layer::INVALID_ID); 549 : Layer::INVALID_ID);
551 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); 550 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_);
552 layer->set_user_scrollable_vertical(user_scrollable_vertical_); 551 layer->set_user_scrollable_vertical(user_scrollable_vertical_);
553 layer->SetScrollOffsetAndDelta( 552
554 scroll_offset_, 553 // Save the difference but clear the sent delta so that we don't subtract
555 layer->ScrollDelta() - layer->sent_scroll_delta()); 554 // it again in SetScrollOffsetAndDelta's pending twin mirroring logic.
555 gfx::Vector2dF remaining_delta =
556 layer->ScrollDelta() - layer->sent_scroll_delta();
556 layer->SetSentScrollDelta(gfx::Vector2dF()); 557 layer->SetSentScrollDelta(gfx::Vector2dF());
558 layer->SetScrollOffsetAndDelta(scroll_offset_, remaining_delta);
559
557 layer->Set3dSortingContextId(sorting_context_id_); 560 layer->Set3dSortingContextId(sorting_context_id_);
558 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); 561 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_);
559 562
560 LayerImpl* scroll_parent = nullptr; 563 LayerImpl* scroll_parent = nullptr;
561 if (scroll_parent_) { 564 if (scroll_parent_) {
562 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); 565 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id());
563 DCHECK(scroll_parent); 566 DCHECK(scroll_parent);
564 } 567 }
565 568
566 layer->SetScrollParent(scroll_parent); 569 layer->SetScrollParent(scroll_parent);
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 1592
1590 void LayerImpl::NotifyAnimationFinished( 1593 void LayerImpl::NotifyAnimationFinished(
1591 base::TimeTicks monotonic_time, 1594 base::TimeTicks monotonic_time,
1592 Animation::TargetProperty target_property, 1595 Animation::TargetProperty target_property,
1593 int group) { 1596 int group) {
1594 if (target_property == Animation::ScrollOffset) 1597 if (target_property == Animation::ScrollOffset)
1595 layer_tree_impl_->InputScrollAnimationFinished(); 1598 layer_tree_impl_->InputScrollAnimationFinished();
1596 } 1599 }
1597 1600
1598 } // namespace cc 1601 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/heads_up_display_layer_impl.cc ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698