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

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

Issue 2033453002: cc : Fix effect tree index bug in cc::LayerImpl::Opacity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/layers/layer_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/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 2847 matching lines...) Expand 10 before | Expand all | Expand 10 after
2858 gfx::Size content_size(100, 100); 2858 gfx::Size content_size(100, 100);
2859 2859
2860 CreateHostImpl(settings, CreateOutputSurface()); 2860 CreateHostImpl(settings, CreateOutputSurface());
2861 host_impl_->CreatePendingTree(); 2861 host_impl_->CreatePendingTree();
2862 CreateScrollAndContentsLayers(host_impl_->pending_tree(), content_size); 2862 CreateScrollAndContentsLayers(host_impl_->pending_tree(), content_size);
2863 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 2863 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
2864 SolidColorScrollbarLayerImpl::Create(host_impl_->pending_tree(), 400, 2864 SolidColorScrollbarLayerImpl::Create(host_impl_->pending_tree(), 400,
2865 VERTICAL, 10, 0, false, true); 2865 VERTICAL, 10, 0, false, true);
2866 scrollbar->test_properties()->opacity = 0.f; 2866 scrollbar->test_properties()->opacity = 0.f;
2867 LayerImpl* scroll = host_impl_->pending_tree()->OuterViewportScrollLayer(); 2867 LayerImpl* scroll = host_impl_->pending_tree()->OuterViewportScrollLayer();
2868 LayerImpl* root = host_impl_->pending_tree()->InnerViewportContainerLayer(); 2868 LayerImpl* container =
2869 host_impl_->pending_tree()->InnerViewportContainerLayer();
2869 scrollbar->SetScrollLayerId(scroll->id()); 2870 scrollbar->SetScrollLayerId(scroll->id());
2870 root->AddChild(std::move(scrollbar)); 2871 container->AddChild(std::move(scrollbar));
2871 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); 2872 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f);
2872 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); 2873 host_impl_->pending_tree()->BuildPropertyTreesForTesting();
2873 host_impl_->ActivateSyncTree(); 2874 host_impl_->ActivateSyncTree();
2874 2875
2875 LayerImpl* scrollbar_layer = host_impl_->active_tree()->LayerById(400); 2876 LayerImpl* active_scrollbar_layer =
2877 host_impl_->active_tree()->LayerById(400);
2876 2878
2877 EffectNode* active_tree_node = 2879 EffectNode* active_tree_node =
2878 host_impl_->active_tree()->property_trees()->effect_tree.Node( 2880 host_impl_->active_tree()->property_trees()->effect_tree.Node(
2879 scrollbar_layer->effect_tree_index()); 2881 active_scrollbar_layer->effect_tree_index());
2880 EXPECT_FLOAT_EQ(scrollbar_layer->Opacity(), active_tree_node->data.opacity); 2882 EXPECT_FLOAT_EQ(active_scrollbar_layer->Opacity(),
2883 active_tree_node->data.opacity);
2881 2884
2882 host_impl_->ScrollbarAnimationControllerForId(scroll->id()) 2885 host_impl_->ScrollbarAnimationControllerForId(scroll->id())
2883 ->DidMouseMoveNear(0); 2886 ->DidMouseMoveNear(0);
2884 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), 2887 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
2885 InputHandler::WHEEL); 2888 InputHandler::WHEEL);
2886 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(0, 5)).get()); 2889 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(0, 5)).get());
2887 host_impl_->ScrollEnd(EndState().get()); 2890 host_impl_->ScrollEnd(EndState().get());
2888 host_impl_->CreatePendingTree(); 2891 host_impl_->CreatePendingTree();
2892 container = host_impl_->pending_tree()->InnerViewportContainerLayer();
2893 container->test_properties()->force_render_surface = true;
ajuma 2016/06/01 21:09:54 Why do we need a surface here?
jaydasika 2016/06/01 21:12:15 Don't need a surface. I added this so that contain
ajuma 2016/06/01 21:17:09 Ah, makes sense. Please add a comment about that.
jaydasika 2016/06/01 21:23:48 Done.
2894 container->SetBounds(gfx::Size(10, 10));
2895 host_impl_->pending_tree()->property_trees()->needs_rebuild = true;
2896 host_impl_->pending_tree()->BuildPropertyTreesForTesting();
2897
2898 LayerImpl* pending_scrollbar_layer =
2899 host_impl_->pending_tree()->LayerById(400);
2889 EffectNode* pending_tree_node = 2900 EffectNode* pending_tree_node =
jaydasika 2016/06/01 20:50:28 This test will crash if we use effect_tree_index i
2890 host_impl_->pending_tree()->property_trees()->effect_tree.Node( 2901 host_impl_->pending_tree()->property_trees()->effect_tree.Node(
2891 scrollbar_layer->effect_tree_index()); 2902 pending_scrollbar_layer->effect_tree_index());
2892 host_impl_->pending_tree() 2903 host_impl_->pending_tree()
2893 ->property_trees() 2904 ->property_trees()
2894 ->always_use_active_tree_opacity_effect_ids.push_back(400); 2905 ->always_use_active_tree_opacity_effect_ids.push_back(400);
2895 EXPECT_FLOAT_EQ(1.f, active_tree_node->data.opacity); 2906 EXPECT_FLOAT_EQ(1.f, active_tree_node->data.opacity);
2896 EXPECT_FLOAT_EQ(1.f, scrollbar_layer->Opacity()); 2907 EXPECT_FLOAT_EQ(1.f, active_scrollbar_layer->Opacity());
2897 EXPECT_FLOAT_EQ(0.f, pending_tree_node->data.opacity); 2908 EXPECT_FLOAT_EQ(0.f, pending_tree_node->data.opacity);
2898 host_impl_->ActivateSyncTree(); 2909 host_impl_->ActivateSyncTree();
2899 active_tree_node = 2910 active_tree_node =
2900 host_impl_->active_tree()->property_trees()->effect_tree.Node( 2911 host_impl_->active_tree()->property_trees()->effect_tree.Node(
2901 scrollbar_layer->effect_tree_index()); 2912 active_scrollbar_layer->effect_tree_index());
2902 EXPECT_FLOAT_EQ(1.f, active_tree_node->data.opacity); 2913 EXPECT_FLOAT_EQ(1.f, active_tree_node->data.opacity);
2903 EXPECT_FLOAT_EQ(1.f, scrollbar_layer->Opacity()); 2914 EXPECT_FLOAT_EQ(1.f, active_scrollbar_layer->Opacity());
2904 } 2915 }
2905 }; 2916 };
2906 2917
2907 TEST_F(LayerTreeHostImplTestScrollbarOpacity, LinearFade) { 2918 TEST_F(LayerTreeHostImplTestScrollbarOpacity, LinearFade) {
2908 RunTest(LayerTreeSettings::LINEAR_FADE); 2919 RunTest(LayerTreeSettings::LINEAR_FADE);
2909 } 2920 }
2910 2921
2911 TEST_F(LayerTreeHostImplTestScrollbarOpacity, Thinning) { 2922 TEST_F(LayerTreeHostImplTestScrollbarOpacity, Thinning) {
2912 RunTest(LayerTreeSettings::THINNING); 2923 RunTest(LayerTreeSettings::THINNING);
2913 } 2924 }
(...skipping 7832 matching lines...) Expand 10 before | Expand all | Expand 10 after
10746 10757
10747 // Re-initialize with a software output surface. 10758 // Re-initialize with a software output surface.
10748 output_surface_ = FakeOutputSurface::CreateSoftware( 10759 output_surface_ = FakeOutputSurface::CreateSoftware(
10749 base::WrapUnique(new SoftwareOutputDevice)); 10760 base::WrapUnique(new SoftwareOutputDevice));
10750 host_impl_->InitializeRenderer(output_surface_.get()); 10761 host_impl_->InitializeRenderer(output_surface_.get());
10751 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); 10762 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
10752 } 10763 }
10753 10764
10754 } // namespace 10765 } // namespace
10755 } // namespace cc 10766 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698