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

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

Issue 2723023004: Use element ids as a stable identifier tracking scroll nodes across updates (Closed)
Patch Set: No need for an explicit ctor Created 3 years, 9 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/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/tree_synchronizer.h" 5 #include "cc/trees/tree_synchronizer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 scoped_refptr<Layer> scroll_clip_layer = Layer::Create(); 486 scoped_refptr<Layer> scroll_clip_layer = Layer::Create();
487 scoped_refptr<Layer> scroll_layer = Layer::Create(); 487 scoped_refptr<Layer> scroll_layer = Layer::Create();
488 scoped_refptr<Layer> transient_scroll_clip_layer = Layer::Create(); 488 scoped_refptr<Layer> transient_scroll_clip_layer = Layer::Create();
489 scoped_refptr<Layer> transient_scroll_layer = Layer::Create(); 489 scoped_refptr<Layer> transient_scroll_layer = Layer::Create();
490 490
491 layer_tree_root->AddChild(transient_scroll_clip_layer); 491 layer_tree_root->AddChild(transient_scroll_clip_layer);
492 transient_scroll_clip_layer->AddChild(transient_scroll_layer); 492 transient_scroll_clip_layer->AddChild(transient_scroll_layer);
493 transient_scroll_layer->AddChild(scroll_clip_layer); 493 transient_scroll_layer->AddChild(scroll_clip_layer);
494 scroll_clip_layer->AddChild(scroll_layer); 494 scroll_clip_layer->AddChild(scroll_layer);
495 495
496 ElementId scroll_element_id = ElementId(5, 4);
497 scroll_layer->SetElementId(scroll_element_id);
498
496 transient_scroll_layer->SetScrollClipLayerId( 499 transient_scroll_layer->SetScrollClipLayerId(
497 transient_scroll_clip_layer->id()); 500 transient_scroll_clip_layer->id());
498 scroll_layer->SetScrollClipLayerId(scroll_clip_layer->id()); 501 scroll_layer->SetScrollClipLayerId(scroll_clip_layer->id());
499 host_->SetRootLayer(layer_tree_root); 502 host_->SetRootLayer(layer_tree_root);
500 host_->BuildPropertyTreesForTesting(); 503 host_->BuildPropertyTreesForTesting();
501 host_->CommitAndCreatePendingTree(); 504 host_->CommitAndCreatePendingTree();
502 host_impl->ActivateSyncTree(); 505 host_impl->ActivateSyncTree();
503 506
504 ExpectTreesAreIdentical(layer_tree_root.get(), 507 ExpectTreesAreIdentical(layer_tree_root.get(),
505 host_impl->active_tree()->root_layer_for_testing(), 508 host_impl->active_tree()->root_layer_for_testing(),
(...skipping 24 matching lines...) Expand all
530 TestTaskGraphRunner task_graph_runner; 533 TestTaskGraphRunner task_graph_runner;
531 FakeLayerTreeHostImpl* host_impl = host_->host_impl(); 534 FakeLayerTreeHostImpl* host_impl = host_->host_impl();
532 host_impl->CreatePendingTree(); 535 host_impl->CreatePendingTree();
533 536
534 scoped_refptr<Layer> layer_tree_root = Layer::Create(); 537 scoped_refptr<Layer> layer_tree_root = Layer::Create();
535 scoped_refptr<Layer> scroll_clip_layer = Layer::Create(); 538 scoped_refptr<Layer> scroll_clip_layer = Layer::Create();
536 scoped_refptr<Layer> scroll_layer = Layer::Create(); 539 scoped_refptr<Layer> scroll_layer = Layer::Create();
537 scoped_refptr<Layer> transient_scroll_clip_layer = Layer::Create(); 540 scoped_refptr<Layer> transient_scroll_clip_layer = Layer::Create();
538 scoped_refptr<Layer> transient_scroll_layer = Layer::Create(); 541 scoped_refptr<Layer> transient_scroll_layer = Layer::Create();
539 542
543 ElementId scroll_element_id = ElementId(5, 4);
544 scroll_layer->SetElementId(scroll_element_id);
545
540 layer_tree_root->AddChild(transient_scroll_clip_layer); 546 layer_tree_root->AddChild(transient_scroll_clip_layer);
541 transient_scroll_clip_layer->AddChild(transient_scroll_layer); 547 transient_scroll_clip_layer->AddChild(transient_scroll_layer);
542 transient_scroll_layer->AddChild(scroll_clip_layer); 548 transient_scroll_layer->AddChild(scroll_clip_layer);
543 scroll_clip_layer->AddChild(scroll_layer); 549 scroll_clip_layer->AddChild(scroll_layer);
544 550
545 transient_scroll_layer->SetScrollClipLayerId( 551 transient_scroll_layer->SetScrollClipLayerId(
546 transient_scroll_clip_layer->id()); 552 transient_scroll_clip_layer->id());
547 scroll_layer->SetScrollClipLayerId(scroll_clip_layer->id()); 553 scroll_layer->SetScrollClipLayerId(scroll_clip_layer->id());
548 transient_scroll_layer->SetScrollOffset(gfx::ScrollOffset(1, 2)); 554 transient_scroll_layer->SetScrollOffset(gfx::ScrollOffset(1, 2));
549 scroll_layer->SetScrollOffset(gfx::ScrollOffset(10, 20)); 555 scroll_layer->SetScrollOffset(gfx::ScrollOffset(10, 20));
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 host_->CommitAndCreatePendingTree(); 675 host_->CommitAndCreatePendingTree();
670 host_impl->ActivateSyncTree(); 676 host_impl->ActivateSyncTree();
671 EXPECT_EQ( 677 EXPECT_EQ(
672 CombinedAnimationScale(0.f, 0.f), 678 CombinedAnimationScale(0.f, 0.f),
673 host_impl->active_tree()->property_trees()->GetAnimationScales( 679 host_impl->active_tree()->property_trees()->GetAnimationScales(
674 transform_layer->transform_tree_index(), host_impl->active_tree())); 680 transform_layer->transform_tree_index(), host_impl->active_tree()));
675 } 681 }
676 682
677 } // namespace 683 } // namespace
678 } // namespace cc 684 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698