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

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

Issue 2612883002: Rename cc property tree node owner_id to owning_layer_id. (Closed)
Patch Set: Created 3 years, 11 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/effect_node.cc ('k') | cc/trees/layer_tree_host_impl.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 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/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 9595 matching lines...) Expand 10 before | Expand all | Expand 10 after
9606 bool skip_verify_visible_rect_calculations = true; 9606 bool skip_verify_visible_rect_calculations = true;
9607 ExecuteCalculateDrawProperties(root, device_scale_factor, page_scale_factor, 9607 ExecuteCalculateDrawProperties(root, device_scale_factor, page_scale_factor,
9608 page_scale_layer, inner_viewport_scroll_layer, 9608 page_scale_layer, inner_viewport_scroll_layer,
9609 outer_viewport_scroll_layer, 9609 outer_viewport_scroll_layer,
9610 skip_verify_visible_rect_calculations); 9610 skip_verify_visible_rect_calculations);
9611 9611
9612 TransformTree& transform_tree = 9612 TransformTree& transform_tree =
9613 root->layer_tree_impl()->property_trees()->transform_tree; 9613 root->layer_tree_impl()->property_trees()->transform_tree;
9614 TransformNode* transform_node = 9614 TransformNode* transform_node =
9615 transform_tree.Node(significant_transform->transform_tree_index()); 9615 transform_tree.Node(significant_transform->transform_tree_index());
9616 EXPECT_EQ(transform_node->owner_id, significant_transform->id()); 9616 EXPECT_EQ(transform_node->owning_layer_id, significant_transform->id());
9617 9617
9618 EXPECT_TRUE(root->has_render_surface()); 9618 EXPECT_TRUE(root->has_render_surface());
9619 EXPECT_FALSE(significant_transform->has_render_surface()); 9619 EXPECT_FALSE(significant_transform->has_render_surface());
9620 EXPECT_TRUE(layer_clips_subtree->has_render_surface()); 9620 EXPECT_TRUE(layer_clips_subtree->has_render_surface());
9621 EXPECT_TRUE(render_surface->has_render_surface()); 9621 EXPECT_TRUE(render_surface->has_render_surface());
9622 EXPECT_FALSE(test_layer->has_render_surface()); 9622 EXPECT_FALSE(test_layer->has_render_surface());
9623 9623
9624 ClipTree& clip_tree = root->layer_tree_impl()->property_trees()->clip_tree; 9624 ClipTree& clip_tree = root->layer_tree_impl()->property_trees()->clip_tree;
9625 ClipNode* clip_node = clip_tree.Node(render_surface->clip_tree_index()); 9625 ClipNode* clip_node = clip_tree.Node(render_surface->clip_tree_index());
9626 EXPECT_EQ(clip_node->clip_type, ClipNode::ClipType::NONE); 9626 EXPECT_EQ(clip_node->clip_type, ClipNode::ClipType::NONE);
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
10480 10480
10481 // Property tree root 10481 // Property tree root
10482 ScrollTree& scroll_tree = host()->property_trees()->scroll_tree; 10482 ScrollTree& scroll_tree = host()->property_trees()->scroll_tree;
10483 PropertyTrees property_trees; 10483 PropertyTrees property_trees;
10484 property_trees.is_main_thread = true; 10484 property_trees.is_main_thread = true;
10485 property_trees.is_active = false; 10485 property_trees.is_active = false;
10486 ScrollTree& expected_scroll_tree = property_trees.scroll_tree; 10486 ScrollTree& expected_scroll_tree = property_trees.scroll_tree;
10487 ScrollNode* property_tree_root = expected_scroll_tree.Node(0); 10487 ScrollNode* property_tree_root = expected_scroll_tree.Node(0);
10488 property_tree_root->id = kRootPropertyTreeNodeId; 10488 property_tree_root->id = kRootPropertyTreeNodeId;
10489 property_tree_root->parent_id = kInvalidPropertyTreeNodeId; 10489 property_tree_root->parent_id = kInvalidPropertyTreeNodeId;
10490 property_tree_root->owner_id = kInvalidPropertyTreeNodeId; 10490 property_tree_root->owning_layer_id = kInvalidPropertyTreeNodeId;
10491 property_tree_root->scrollable = false; 10491 property_tree_root->scrollable = false;
10492 property_tree_root->main_thread_scrolling_reasons = 10492 property_tree_root->main_thread_scrolling_reasons =
10493 MainThreadScrollingReason::kNotScrollingOnMain; 10493 MainThreadScrollingReason::kNotScrollingOnMain;
10494 property_tree_root->contains_non_fast_scrollable_region = false; 10494 property_tree_root->contains_non_fast_scrollable_region = false;
10495 property_tree_root->transform_id = kRootPropertyTreeNodeId; 10495 property_tree_root->transform_id = kRootPropertyTreeNodeId;
10496 10496
10497 // The node owned by root1 10497 // The node owned by root1
10498 ScrollNode scroll_root1; 10498 ScrollNode scroll_root1;
10499 scroll_root1.id = 1; 10499 scroll_root1.id = 1;
10500 scroll_root1.owner_id = root1->id(); 10500 scroll_root1.owning_layer_id = root1->id();
10501 scroll_root1.user_scrollable_horizontal = true; 10501 scroll_root1.user_scrollable_horizontal = true;
10502 scroll_root1.user_scrollable_vertical = true; 10502 scroll_root1.user_scrollable_vertical = true;
10503 scroll_root1.transform_id = root1->transform_tree_index(); 10503 scroll_root1.transform_id = root1->transform_tree_index();
10504 expected_scroll_tree.Insert(scroll_root1, 0); 10504 expected_scroll_tree.Insert(scroll_root1, 0);
10505 10505
10506 // The node owned by parent2 10506 // The node owned by parent2
10507 ScrollNode scroll_parent2; 10507 ScrollNode scroll_parent2;
10508 scroll_parent2.id = 2; 10508 scroll_parent2.id = 2;
10509 scroll_parent2.owner_id = parent2->id(); 10509 scroll_parent2.owning_layer_id = parent2->id();
10510 scroll_parent2.scrollable = true; 10510 scroll_parent2.scrollable = true;
10511 scroll_parent2.main_thread_scrolling_reasons = 10511 scroll_parent2.main_thread_scrolling_reasons =
10512 parent2->main_thread_scrolling_reasons(); 10512 parent2->main_thread_scrolling_reasons();
10513 scroll_parent2.scroll_clip_layer_bounds = root1->bounds(); 10513 scroll_parent2.scroll_clip_layer_bounds = root1->bounds();
10514 scroll_parent2.bounds = parent2->bounds(); 10514 scroll_parent2.bounds = parent2->bounds();
10515 scroll_parent2.max_scroll_offset_affected_by_page_scale = true; 10515 scroll_parent2.max_scroll_offset_affected_by_page_scale = true;
10516 scroll_parent2.is_inner_viewport_scroll_layer = true; 10516 scroll_parent2.is_inner_viewport_scroll_layer = true;
10517 scroll_parent2.user_scrollable_horizontal = true; 10517 scroll_parent2.user_scrollable_horizontal = true;
10518 scroll_parent2.user_scrollable_vertical = true; 10518 scroll_parent2.user_scrollable_vertical = true;
10519 scroll_parent2.transform_id = parent2->transform_tree_index(); 10519 scroll_parent2.transform_id = parent2->transform_tree_index();
10520 expected_scroll_tree.Insert(scroll_parent2, 1); 10520 expected_scroll_tree.Insert(scroll_parent2, 1);
10521 10521
10522 // The node owned by child6 10522 // The node owned by child6
10523 ScrollNode scroll_child6; 10523 ScrollNode scroll_child6;
10524 scroll_child6.id = 3; 10524 scroll_child6.id = 3;
10525 scroll_child6.owner_id = child6->id(); 10525 scroll_child6.owning_layer_id = child6->id();
10526 scroll_child6.main_thread_scrolling_reasons = 10526 scroll_child6.main_thread_scrolling_reasons =
10527 child6->main_thread_scrolling_reasons(); 10527 child6->main_thread_scrolling_reasons();
10528 scroll_child6.should_flatten = true; 10528 scroll_child6.should_flatten = true;
10529 scroll_child6.user_scrollable_horizontal = true; 10529 scroll_child6.user_scrollable_horizontal = true;
10530 scroll_child6.user_scrollable_vertical = true; 10530 scroll_child6.user_scrollable_vertical = true;
10531 scroll_child6.transform_id = child6->transform_tree_index(); 10531 scroll_child6.transform_id = child6->transform_tree_index();
10532 expected_scroll_tree.Insert(scroll_child6, 2); 10532 expected_scroll_tree.Insert(scroll_child6, 2);
10533 10533
10534 // The node owned by child7, child7 also owns a transform node 10534 // The node owned by child7, child7 also owns a transform node
10535 ScrollNode scroll_child7; 10535 ScrollNode scroll_child7;
10536 scroll_child7.id = 4; 10536 scroll_child7.id = 4;
10537 scroll_child7.owner_id = child7->id(); 10537 scroll_child7.owning_layer_id = child7->id();
10538 scroll_child7.scrollable = true; 10538 scroll_child7.scrollable = true;
10539 scroll_child7.scroll_clip_layer_bounds = parent3->bounds(); 10539 scroll_child7.scroll_clip_layer_bounds = parent3->bounds();
10540 scroll_child7.bounds = child7->bounds(); 10540 scroll_child7.bounds = child7->bounds();
10541 scroll_child7.user_scrollable_horizontal = true; 10541 scroll_child7.user_scrollable_horizontal = true;
10542 scroll_child7.user_scrollable_vertical = true; 10542 scroll_child7.user_scrollable_vertical = true;
10543 scroll_child7.transform_id = child7->transform_tree_index(); 10543 scroll_child7.transform_id = child7->transform_tree_index();
10544 expected_scroll_tree.Insert(scroll_child7, 1); 10544 expected_scroll_tree.Insert(scroll_child7, 1);
10545 10545
10546 // The node owned by grand_child11, grand_child11 also owns a transform node 10546 // The node owned by grand_child11, grand_child11 also owns a transform node
10547 ScrollNode scroll_grand_child11; 10547 ScrollNode scroll_grand_child11;
10548 scroll_grand_child11.id = 5; 10548 scroll_grand_child11.id = 5;
10549 scroll_grand_child11.owner_id = grand_child11->id(); 10549 scroll_grand_child11.owning_layer_id = grand_child11->id();
10550 scroll_grand_child11.scrollable = true; 10550 scroll_grand_child11.scrollable = true;
10551 scroll_grand_child11.user_scrollable_horizontal = true; 10551 scroll_grand_child11.user_scrollable_horizontal = true;
10552 scroll_grand_child11.user_scrollable_vertical = true; 10552 scroll_grand_child11.user_scrollable_vertical = true;
10553 scroll_grand_child11.transform_id = grand_child11->transform_tree_index(); 10553 scroll_grand_child11.transform_id = grand_child11->transform_tree_index();
10554 expected_scroll_tree.Insert(scroll_grand_child11, 4); 10554 expected_scroll_tree.Insert(scroll_grand_child11, 4);
10555 10555
10556 // The node owned by parent5 10556 // The node owned by parent5
10557 ScrollNode scroll_parent5; 10557 ScrollNode scroll_parent5;
10558 scroll_parent5.id = 8; 10558 scroll_parent5.id = 8;
10559 scroll_parent5.owner_id = parent5->id(); 10559 scroll_parent5.owning_layer_id = parent5->id();
10560 scroll_parent5.contains_non_fast_scrollable_region = true; 10560 scroll_parent5.contains_non_fast_scrollable_region = true;
10561 scroll_parent5.bounds = gfx::Size(10, 10); 10561 scroll_parent5.bounds = gfx::Size(10, 10);
10562 scroll_parent5.should_flatten = true; 10562 scroll_parent5.should_flatten = true;
10563 scroll_parent5.user_scrollable_horizontal = true; 10563 scroll_parent5.user_scrollable_horizontal = true;
10564 scroll_parent5.user_scrollable_vertical = true; 10564 scroll_parent5.user_scrollable_vertical = true;
10565 scroll_parent5.transform_id = parent5->transform_tree_index(); 10565 scroll_parent5.transform_id = parent5->transform_tree_index();
10566 expected_scroll_tree.Insert(scroll_parent5, 1); 10566 expected_scroll_tree.Insert(scroll_parent5, 1);
10567 10567
10568 expected_scroll_tree.SetScrollOffset(parent2->id(), gfx::ScrollOffset(0, 0)); 10568 expected_scroll_tree.SetScrollOffset(parent2->id(), gfx::ScrollOffset(0, 0));
10569 expected_scroll_tree.SetScrollOffset(child7->id(), gfx::ScrollOffset(0, 0)); 10569 expected_scroll_tree.SetScrollOffset(child7->id(), gfx::ScrollOffset(0, 0));
10570 expected_scroll_tree.SetScrollOffset(grand_child11->id(), 10570 expected_scroll_tree.SetScrollOffset(grand_child11->id(),
10571 gfx::ScrollOffset(0, 0)); 10571 gfx::ScrollOffset(0, 0));
10572 expected_scroll_tree.set_needs_update(false); 10572 expected_scroll_tree.set_needs_update(false);
10573 10573
10574 EXPECT_EQ(expected_scroll_tree, scroll_tree); 10574 EXPECT_EQ(expected_scroll_tree, scroll_tree);
10575 10575
10576 // Check other layers' scroll_tree_index 10576 // Check other layers' scroll_tree_index
10577 EXPECT_EQ(scroll_root1.id, page_scale_layer->scroll_tree_index()); 10577 EXPECT_EQ(scroll_root1.id, page_scale_layer->scroll_tree_index());
10578 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10578 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10579 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10579 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10580 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10580 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10581 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10581 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10582 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10582 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10583 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10583 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10584 } 10584 }
10585 10585
10586 } // namespace 10586 } // namespace
10587 } // namespace cc 10587 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/effect_node.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698