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

Side by Side Diff: cc/trees/layer_tree.cc

Issue 2259083002: cc: Correct elastic overscroll synchronization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « cc/proto/layer_tree_host.proto ('k') | cc/trees/layer_tree_host.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/trees/layer_tree.h" 5 #include "cc/trees/layer_tree.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "cc/animation/animation_host.h" 9 #include "cc/animation/animation_host.h"
10 #include "cc/input/page_scale_animation.h" 10 #include "cc/input/page_scale_animation.h"
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 event_listener_properties(EventListenerClass::kMouseWheel))); 462 event_listener_properties(EventListenerClass::kMouseWheel)));
463 proto->set_touch_start_or_move_event_listener_properties( 463 proto->set_touch_start_or_move_event_listener_properties(
464 static_cast<uint32_t>( 464 static_cast<uint32_t>(
465 event_listener_properties(EventListenerClass::kTouchStartOrMove))); 465 event_listener_properties(EventListenerClass::kTouchStartOrMove)));
466 proto->set_touch_end_or_cancel_event_listener_properties( 466 proto->set_touch_end_or_cancel_event_listener_properties(
467 static_cast<uint32_t>( 467 static_cast<uint32_t>(
468 event_listener_properties(EventListenerClass::kTouchEndOrCancel))); 468 event_listener_properties(EventListenerClass::kTouchEndOrCancel)));
469 469
470 LayerSelectionToProtobuf(inputs_.selection, proto->mutable_selection()); 470 LayerSelectionToProtobuf(inputs_.selection, proto->mutable_selection());
471 property_trees_.ToProtobuf(proto->mutable_property_trees()); 471 property_trees_.ToProtobuf(proto->mutable_property_trees());
472 Vector2dFToProto(elastic_overscroll_, proto->mutable_elastic_overscroll());
472 } 473 }
473 474
474 void LayerTree::FromProtobuf(const proto::LayerTree& proto) { 475 void LayerTree::FromProtobuf(const proto::LayerTree& proto) {
475 // Layer hierarchy. 476 // Layer hierarchy.
476 scoped_refptr<Layer> new_root_layer = 477 scoped_refptr<Layer> new_root_layer =
477 LayerProtoConverter::DeserializeLayerHierarchy( 478 LayerProtoConverter::DeserializeLayerHierarchy(
478 inputs_.root_layer, proto.root_layer(), layer_tree_host_); 479 inputs_.root_layer, proto.root_layer(), layer_tree_host_);
479 if (inputs_.root_layer != new_root_layer) { 480 if (inputs_.root_layer != new_root_layer) {
480 inputs_.root_layer = new_root_layer; 481 inputs_.root_layer = new_root_layer;
481 } 482 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 proto.touch_start_or_move_event_listener_properties()); 524 proto.touch_start_or_move_event_listener_properties());
524 inputs_.event_listener_properties[static_cast<size_t>( 525 inputs_.event_listener_properties[static_cast<size_t>(
525 EventListenerClass::kTouchEndOrCancel)] = 526 EventListenerClass::kTouchEndOrCancel)] =
526 static_cast<EventListenerProperties>( 527 static_cast<EventListenerProperties>(
527 proto.touch_end_or_cancel_event_listener_properties()); 528 proto.touch_end_or_cancel_event_listener_properties());
528 529
529 hud_layer_ = static_cast<HeadsUpDisplayLayer*>( 530 hud_layer_ = static_cast<HeadsUpDisplayLayer*>(
530 UpdateAndGetLayer(hud_layer_.get(), proto.hud_layer_id(), this)); 531 UpdateAndGetLayer(hud_layer_.get(), proto.hud_layer_id(), this));
531 532
532 LayerSelectionFromProtobuf(&inputs_.selection, proto.selection()); 533 LayerSelectionFromProtobuf(&inputs_.selection, proto.selection());
534 elastic_overscroll_ = ProtoToVector2dF(proto.elastic_overscroll());
533 535
534 // It is required to create new PropertyTrees before deserializing it. 536 // It is required to create new PropertyTrees before deserializing it.
535 property_trees_ = PropertyTrees(); 537 property_trees_ = PropertyTrees();
536 property_trees_.FromProtobuf(proto.property_trees()); 538 property_trees_.FromProtobuf(proto.property_trees());
537 539
538 // Forcefully override the sequence number of all layers in the tree to have 540 // Forcefully override the sequence number of all layers in the tree to have
539 // a valid sequence number. Changing the sequence number for a layer does not 541 // a valid sequence number. Changing the sequence number for a layer does not
540 // need a commit, so the value will become out of date for layers that are not 542 // need a commit, so the value will become out of date for layers that are not
541 // updated for other reasons. All layers that at this point are part of the 543 // updated for other reasons. All layers that at this point are part of the
542 // layer tree are valid, so it is OK that they have a valid sequence number. 544 // layer tree are valid, so it is OK that they have a valid sequence number.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 LayerListReverseIterator<Layer> LayerTree::rend() { 714 LayerListReverseIterator<Layer> LayerTree::rend() {
713 return LayerListReverseIterator<Layer>(nullptr); 715 return LayerListReverseIterator<Layer>(nullptr);
714 } 716 }
715 717
716 void LayerTree::SetNeedsDisplayOnAllLayers() { 718 void LayerTree::SetNeedsDisplayOnAllLayers() {
717 for (auto* layer : *this) 719 for (auto* layer : *this)
718 layer->SetNeedsDisplay(); 720 layer->SetNeedsDisplay();
719 } 721 }
720 722
721 } // namespace cc 723 } // namespace cc
OLDNEW
« no previous file with comments | « cc/proto/layer_tree_host.proto ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698