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

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

Issue 2018833002: cc : Delete LayerImpl::opacity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/property_tree_builder.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_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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 scroll->SetScrollClipLayer(clip->id()); 957 scroll->SetScrollClipLayer(clip->id());
958 scroll->SetDrawsContent(true); 958 scroll->SetDrawsContent(true);
959 959
960 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 960 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
961 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0, 961 SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0,
962 false, true); 962 false, true);
963 scrollbar->SetBounds(scrollbar_size); 963 scrollbar->SetBounds(scrollbar_size);
964 scrollbar->SetPosition(gfx::PointF(345, 0)); 964 scrollbar->SetPosition(gfx::PointF(345, 0));
965 scrollbar->SetScrollLayerId(scroll->id()); 965 scrollbar->SetScrollLayerId(scroll->id());
966 scrollbar->SetDrawsContent(true); 966 scrollbar->SetDrawsContent(true);
967 scrollbar->SetOpacity(1.f); 967 scrollbar->test_properties()->opacity = 1.f;
968 968
969 std::unique_ptr<LayerImpl> squash1 = LayerImpl::Create(layer_tree_impl, 5); 969 std::unique_ptr<LayerImpl> squash1 = LayerImpl::Create(layer_tree_impl, 5);
970 squash1->SetBounds(gfx::Size(140, 300)); 970 squash1->SetBounds(gfx::Size(140, 300));
971 squash1->SetPosition(gfx::PointF(220, 0)); 971 squash1->SetPosition(gfx::PointF(220, 0));
972 squash1->SetDrawsContent(true); 972 squash1->SetDrawsContent(true);
973 973
974 std::unique_ptr<LayerImpl> squash2 = LayerImpl::Create(layer_tree_impl, 6); 974 std::unique_ptr<LayerImpl> squash2 = LayerImpl::Create(layer_tree_impl, 6);
975 squash2->SetBounds(gfx::Size(140, 300)); 975 squash2->SetBounds(gfx::Size(140, 300));
976 squash2->SetPosition(gfx::PointF(220, 300)); 976 squash2->SetPosition(gfx::PointF(220, 300));
977 squash2->SetDrawsContent(true); 977 squash2->SetDrawsContent(true);
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after
2671 host_impl_->InitializeRenderer(output_surface_.get()); 2671 host_impl_->InitializeRenderer(output_surface_.get());
2672 2672
2673 SetupScrollAndContentsLayers(content_size); 2673 SetupScrollAndContentsLayers(content_size);
2674 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f); 2674 host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 1.f, 4.f);
2675 host_impl_->SetViewportSize( 2675 host_impl_->SetViewportSize(
2676 gfx::Size(content_size.width() / 2, content_size.height() / 2)); 2676 gfx::Size(content_size.width() / 2, content_size.height() / 2));
2677 2677
2678 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar = 2678 std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
2679 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400, 2679 SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400,
2680 VERTICAL, 10, 0, false, true); 2680 VERTICAL, 10, 0, false, true);
2681 scrollbar->SetOpacity(0.f); 2681 scrollbar->test_properties()->opacity = 0.f;
2682 EXPECT_FLOAT_EQ(0.f, scrollbar->opacity()); 2682 EXPECT_FLOAT_EQ(0.f, scrollbar->test_properties()->opacity);
2683 2683
2684 LayerImpl* scroll = host_impl_->active_tree()->OuterViewportScrollLayer(); 2684 LayerImpl* scroll = host_impl_->active_tree()->OuterViewportScrollLayer();
2685 LayerImpl* root = host_impl_->active_tree()->InnerViewportContainerLayer(); 2685 LayerImpl* root = host_impl_->active_tree()->InnerViewportContainerLayer();
2686 scrollbar->SetScrollLayerId(scroll->id()); 2686 scrollbar->SetScrollLayerId(scroll->id());
2687 root->AddChild(std::move(scrollbar)); 2687 root->AddChild(std::move(scrollbar));
2688 2688
2689 host_impl_->active_tree()->DidBecomeActive(); 2689 host_impl_->active_tree()->DidBecomeActive();
2690 SetNeedsRebuildPropertyTrees(); 2690 SetNeedsRebuildPropertyTrees();
2691 DrawFrame(); 2691 DrawFrame();
2692 } 2692 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 settings.scrollbar_fade_delay_ms = 20; 2856 settings.scrollbar_fade_delay_ms = 20;
2857 settings.scrollbar_fade_duration_ms = 20; 2857 settings.scrollbar_fade_duration_ms = 20;
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->SetOpacity(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* root = host_impl_->pending_tree()->InnerViewportContainerLayer();
2869 scrollbar->SetScrollLayerId(scroll->id()); 2869 scrollbar->SetScrollLayerId(scroll->id());
2870 root->AddChild(std::move(scrollbar)); 2870 root->AddChild(std::move(scrollbar));
2871 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f); 2871 host_impl_->pending_tree()->PushPageScaleFromMainThread(1.f, 1.f, 1.f);
2872 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); 2872 host_impl_->pending_tree()->BuildPropertyTreesForTesting();
2873 host_impl_->ActivateSyncTree(); 2873 host_impl_->ActivateSyncTree();
2874 2874
2875 LayerImpl* scrollbar_layer = host_impl_->active_tree()->LayerById(400); 2875 LayerImpl* scrollbar_layer = host_impl_->active_tree()->LayerById(400);
2876 2876
2877 EffectNode* active_tree_node = 2877 EffectNode* active_tree_node =
2878 host_impl_->active_tree()->property_trees()->effect_tree.Node( 2878 host_impl_->active_tree()->property_trees()->effect_tree.Node(
2879 scrollbar_layer->effect_tree_index()); 2879 scrollbar_layer->effect_tree_index());
2880 EXPECT_FLOAT_EQ(scrollbar_layer->opacity(), active_tree_node->data.opacity); 2880 EXPECT_FLOAT_EQ(scrollbar_layer->Opacity(), active_tree_node->data.opacity);
2881 2881
2882 host_impl_->ScrollbarAnimationControllerForId(scroll->id()) 2882 host_impl_->ScrollbarAnimationControllerForId(scroll->id())
2883 ->DidMouseMoveNear(0); 2883 ->DidMouseMoveNear(0);
2884 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(), 2884 host_impl_->ScrollBegin(BeginState(gfx::Point()).get(),
2885 InputHandler::WHEEL); 2885 InputHandler::WHEEL);
2886 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(0, 5)).get()); 2886 host_impl_->ScrollBy(UpdateState(gfx::Point(), gfx::Vector2dF(0, 5)).get());
2887 host_impl_->ScrollEnd(EndState().get()); 2887 host_impl_->ScrollEnd(EndState().get());
2888 host_impl_->CreatePendingTree(); 2888 host_impl_->CreatePendingTree();
2889 EffectNode* pending_tree_node = 2889 EffectNode* pending_tree_node =
2890 host_impl_->pending_tree()->property_trees()->effect_tree.Node( 2890 host_impl_->pending_tree()->property_trees()->effect_tree.Node(
2891 scrollbar_layer->effect_tree_index()); 2891 scrollbar_layer->effect_tree_index());
2892 host_impl_->pending_tree() 2892 host_impl_->pending_tree()
2893 ->property_trees() 2893 ->property_trees()
2894 ->always_use_active_tree_opacity_effect_ids.push_back(400); 2894 ->always_use_active_tree_opacity_effect_ids.push_back(400);
2895 EXPECT_FLOAT_EQ(1.f, active_tree_node->data.opacity); 2895 EXPECT_FLOAT_EQ(1.f, active_tree_node->data.opacity);
2896 EXPECT_FLOAT_EQ(1.f, scrollbar_layer->opacity()); 2896 EXPECT_FLOAT_EQ(1.f, scrollbar_layer->Opacity());
2897 EXPECT_FLOAT_EQ(0.f, pending_tree_node->data.opacity); 2897 EXPECT_FLOAT_EQ(0.f, pending_tree_node->data.opacity);
2898 host_impl_->ActivateSyncTree(); 2898 host_impl_->ActivateSyncTree();
2899 active_tree_node = 2899 active_tree_node =
2900 host_impl_->active_tree()->property_trees()->effect_tree.Node( 2900 host_impl_->active_tree()->property_trees()->effect_tree.Node(
2901 scrollbar_layer->effect_tree_index()); 2901 scrollbar_layer->effect_tree_index());
2902 EXPECT_FLOAT_EQ(1.f, active_tree_node->data.opacity); 2902 EXPECT_FLOAT_EQ(1.f, active_tree_node->data.opacity);
2903 EXPECT_FLOAT_EQ(1.f, scrollbar_layer->opacity()); 2903 EXPECT_FLOAT_EQ(1.f, scrollbar_layer->Opacity());
2904 } 2904 }
2905 }; 2905 };
2906 2906
2907 TEST_F(LayerTreeHostImplTestScrollbarOpacity, LinearFade) { 2907 TEST_F(LayerTreeHostImplTestScrollbarOpacity, LinearFade) {
2908 RunTest(LayerTreeSettings::LINEAR_FADE); 2908 RunTest(LayerTreeSettings::LINEAR_FADE);
2909 } 2909 }
2910 2910
2911 TEST_F(LayerTreeHostImplTestScrollbarOpacity, Thinning) { 2911 TEST_F(LayerTreeHostImplTestScrollbarOpacity, Thinning) {
2912 RunTest(LayerTreeSettings::THINNING); 2912 RunTest(LayerTreeSettings::THINNING);
2913 } 2913 }
(...skipping 3319 matching lines...) Expand 10 before | Expand all | Expand 10 after
6233 layer1->SetExpectation(true, false); 6233 layer1->SetExpectation(true, false);
6234 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6234 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6235 SetNeedsRebuildPropertyTrees(); 6235 SetNeedsRebuildPropertyTrees();
6236 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6236 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6237 host_impl_->DrawLayers(&frame); 6237 host_impl_->DrawLayers(&frame);
6238 EXPECT_TRUE(layer1->quads_appended()); 6238 EXPECT_TRUE(layer1->quads_appended());
6239 host_impl_->DidDrawAllLayers(frame); 6239 host_impl_->DidDrawAllLayers(frame);
6240 6240
6241 // Layer with translucent opacity, drawn with blending. 6241 // Layer with translucent opacity, drawn with blending.
6242 layer1->SetContentsOpaque(true); 6242 layer1->SetContentsOpaque(true);
6243 layer1->SetOpacity(0.5f); 6243 layer1->test_properties()->opacity = 0.5f;
6244 layer1->NoteLayerPropertyChanged(); 6244 layer1->NoteLayerPropertyChanged();
6245 layer1->SetExpectation(true, false); 6245 layer1->SetExpectation(true, false);
6246 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6246 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6247 SetNeedsRebuildPropertyTrees(); 6247 SetNeedsRebuildPropertyTrees();
6248 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6248 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6249 host_impl_->DrawLayers(&frame); 6249 host_impl_->DrawLayers(&frame);
6250 EXPECT_TRUE(layer1->quads_appended()); 6250 EXPECT_TRUE(layer1->quads_appended());
6251 host_impl_->DidDrawAllLayers(frame); 6251 host_impl_->DidDrawAllLayers(frame);
6252 6252
6253 // Layer with translucent opacity and painting, drawn with blending. 6253 // Layer with translucent opacity and painting, drawn with blending.
6254 layer1->SetContentsOpaque(true); 6254 layer1->SetContentsOpaque(true);
6255 layer1->SetOpacity(0.5f); 6255 layer1->test_properties()->opacity = 0.5f;
6256 layer1->NoteLayerPropertyChanged(); 6256 layer1->NoteLayerPropertyChanged();
6257 layer1->SetExpectation(true, false); 6257 layer1->SetExpectation(true, false);
6258 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6258 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6259 SetNeedsRebuildPropertyTrees(); 6259 SetNeedsRebuildPropertyTrees();
6260 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6260 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6261 host_impl_->DrawLayers(&frame); 6261 host_impl_->DrawLayers(&frame);
6262 EXPECT_TRUE(layer1->quads_appended()); 6262 EXPECT_TRUE(layer1->quads_appended());
6263 host_impl_->DidDrawAllLayers(frame); 6263 host_impl_->DidDrawAllLayers(frame);
6264 6264
6265 layer1->AddChild( 6265 layer1->AddChild(
6266 BlendStateCheckLayer::Create(host_impl_->active_tree(), 6266 BlendStateCheckLayer::Create(host_impl_->active_tree(),
6267 3, 6267 3,
6268 host_impl_->resource_provider())); 6268 host_impl_->resource_provider()));
6269 BlendStateCheckLayer* layer2 = 6269 BlendStateCheckLayer* layer2 =
6270 static_cast<BlendStateCheckLayer*>(layer1->children()[0]); 6270 static_cast<BlendStateCheckLayer*>(layer1->children()[0]);
6271 layer2->SetPosition(gfx::PointF(4.f, 4.f)); 6271 layer2->SetPosition(gfx::PointF(4.f, 4.f));
6272 6272
6273 // 2 opaque layers, drawn without blending. 6273 // 2 opaque layers, drawn without blending.
6274 layer1->SetContentsOpaque(true); 6274 layer1->SetContentsOpaque(true);
6275 layer1->SetOpacity(1.f); 6275 layer1->test_properties()->opacity = 1.f;
6276 layer1->NoteLayerPropertyChanged(); 6276 layer1->NoteLayerPropertyChanged();
6277 layer1->SetExpectation(false, false); 6277 layer1->SetExpectation(false, false);
6278 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6278 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6279 layer2->SetContentsOpaque(true); 6279 layer2->SetContentsOpaque(true);
6280 layer2->SetOpacity(1.f); 6280 layer2->test_properties()->opacity = 1.f;
6281 layer2->NoteLayerPropertyChanged(); 6281 layer2->NoteLayerPropertyChanged();
6282 layer2->SetExpectation(false, false); 6282 layer2->SetExpectation(false, false);
6283 layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); 6283 layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
6284 SetNeedsRebuildPropertyTrees(); 6284 SetNeedsRebuildPropertyTrees();
6285 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6285 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6286 host_impl_->DrawLayers(&frame); 6286 host_impl_->DrawLayers(&frame);
6287 EXPECT_TRUE(layer1->quads_appended()); 6287 EXPECT_TRUE(layer1->quads_appended());
6288 EXPECT_TRUE(layer2->quads_appended()); 6288 EXPECT_TRUE(layer2->quads_appended());
6289 host_impl_->DidDrawAllLayers(frame); 6289 host_impl_->DidDrawAllLayers(frame);
6290 6290
(...skipping 25 matching lines...) Expand all
6316 EXPECT_TRUE(layer1->quads_appended()); 6316 EXPECT_TRUE(layer1->quads_appended());
6317 EXPECT_TRUE(layer2->quads_appended()); 6317 EXPECT_TRUE(layer2->quads_appended());
6318 host_impl_->DidDrawAllLayers(frame); 6318 host_impl_->DidDrawAllLayers(frame);
6319 6319
6320 // Parent layer with translucent opacity and opaque content. Since it has a 6320 // Parent layer with translucent opacity and opaque content. Since it has a
6321 // drawing child, it's drawn to a render surface which carries the opacity, 6321 // drawing child, it's drawn to a render surface which carries the opacity,
6322 // so it's itself drawn without blending. 6322 // so it's itself drawn without blending.
6323 // Child layer with opaque content, drawn without blending (parent surface 6323 // Child layer with opaque content, drawn without blending (parent surface
6324 // carries the inherited opacity). 6324 // carries the inherited opacity).
6325 layer1->SetContentsOpaque(true); 6325 layer1->SetContentsOpaque(true);
6326 layer1->SetOpacity(0.5f); 6326 layer1->test_properties()->opacity = 0.5f;
6327 layer1->NoteLayerPropertyChanged(); 6327 layer1->NoteLayerPropertyChanged();
6328 layer1->test_properties()->force_render_surface = true; 6328 layer1->test_properties()->force_render_surface = true;
6329 layer1->SetExpectation(false, true); 6329 layer1->SetExpectation(false, true);
6330 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6330 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6331 layer2->SetExpectation(false, false); 6331 layer2->SetExpectation(false, false);
6332 layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); 6332 layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
6333 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren( 6333 FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(
6334 host_impl_->active_tree()->root_layer()); 6334 host_impl_->active_tree()->root_layer());
6335 SetNeedsRebuildPropertyTrees(); 6335 SetNeedsRebuildPropertyTrees();
6336 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6336 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6337 host_impl_->DrawLayers(&frame); 6337 host_impl_->DrawLayers(&frame);
6338 EXPECT_TRUE(layer1->quads_appended()); 6338 EXPECT_TRUE(layer1->quads_appended());
6339 EXPECT_TRUE(layer2->quads_appended()); 6339 EXPECT_TRUE(layer2->quads_appended());
6340 host_impl_->DidDrawAllLayers(frame); 6340 host_impl_->DidDrawAllLayers(frame);
6341 layer1->test_properties()->force_render_surface = false; 6341 layer1->test_properties()->force_render_surface = false;
6342 6342
6343 // Draw again, but with child non-opaque, to make sure 6343 // Draw again, but with child non-opaque, to make sure
6344 // layer1 not culled. 6344 // layer1 not culled.
6345 layer1->SetContentsOpaque(true); 6345 layer1->SetContentsOpaque(true);
6346 layer1->SetOpacity(1.f); 6346 layer1->test_properties()->opacity = 1.f;
6347 layer1->NoteLayerPropertyChanged(); 6347 layer1->NoteLayerPropertyChanged();
6348 layer1->SetExpectation(false, false); 6348 layer1->SetExpectation(false, false);
6349 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6349 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6350 layer2->SetContentsOpaque(true); 6350 layer2->SetContentsOpaque(true);
6351 layer2->SetOpacity(0.5f); 6351 layer2->test_properties()->opacity = 0.5f;
6352 layer2->NoteLayerPropertyChanged(); 6352 layer2->NoteLayerPropertyChanged();
6353 layer2->SetExpectation(true, false); 6353 layer2->SetExpectation(true, false);
6354 layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); 6354 layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
6355 SetNeedsRebuildPropertyTrees(); 6355 SetNeedsRebuildPropertyTrees();
6356 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6356 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6357 host_impl_->DrawLayers(&frame); 6357 host_impl_->DrawLayers(&frame);
6358 EXPECT_TRUE(layer1->quads_appended()); 6358 EXPECT_TRUE(layer1->quads_appended());
6359 EXPECT_TRUE(layer2->quads_appended()); 6359 EXPECT_TRUE(layer2->quads_appended());
6360 host_impl_->DidDrawAllLayers(frame); 6360 host_impl_->DidDrawAllLayers(frame);
6361 6361
6362 // A second way of making the child non-opaque. 6362 // A second way of making the child non-opaque.
6363 layer1->SetContentsOpaque(true); 6363 layer1->SetContentsOpaque(true);
6364 layer1->SetOpacity(1.f); 6364 layer1->test_properties()->opacity = 1.f;
6365 layer1->NoteLayerPropertyChanged(); 6365 layer1->NoteLayerPropertyChanged();
6366 layer1->SetExpectation(false, false); 6366 layer1->SetExpectation(false, false);
6367 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6367 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6368 layer2->SetContentsOpaque(false); 6368 layer2->SetContentsOpaque(false);
6369 layer2->SetOpacity(1.f); 6369 layer2->test_properties()->opacity = 1.f;
6370 layer2->NoteLayerPropertyChanged(); 6370 layer2->NoteLayerPropertyChanged();
6371 layer2->SetExpectation(true, false); 6371 layer2->SetExpectation(true, false);
6372 layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); 6372 layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
6373 SetNeedsRebuildPropertyTrees(); 6373 SetNeedsRebuildPropertyTrees();
6374 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6374 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6375 host_impl_->DrawLayers(&frame); 6375 host_impl_->DrawLayers(&frame);
6376 EXPECT_TRUE(layer1->quads_appended()); 6376 EXPECT_TRUE(layer1->quads_appended());
6377 EXPECT_TRUE(layer2->quads_appended()); 6377 EXPECT_TRUE(layer2->quads_appended());
6378 host_impl_->DidDrawAllLayers(frame); 6378 host_impl_->DidDrawAllLayers(frame);
6379 6379
6380 // And when the layer says its not opaque but is painted opaque, it is not 6380 // And when the layer says its not opaque but is painted opaque, it is not
6381 // blended. 6381 // blended.
6382 layer1->SetContentsOpaque(true); 6382 layer1->SetContentsOpaque(true);
6383 layer1->SetOpacity(1.f); 6383 layer1->test_properties()->opacity = 1.f;
6384 layer1->NoteLayerPropertyChanged(); 6384 layer1->NoteLayerPropertyChanged();
6385 layer1->SetExpectation(false, false); 6385 layer1->SetExpectation(false, false);
6386 layer1->SetUpdateRect(gfx::Rect(layer1->bounds())); 6386 layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
6387 layer2->SetContentsOpaque(true); 6387 layer2->SetContentsOpaque(true);
6388 layer2->SetOpacity(1.f); 6388 layer2->test_properties()->opacity = 1.f;
6389 layer2->NoteLayerPropertyChanged(); 6389 layer2->NoteLayerPropertyChanged();
6390 layer2->SetExpectation(false, false); 6390 layer2->SetExpectation(false, false);
6391 layer2->SetUpdateRect(gfx::Rect(layer1->bounds())); 6391 layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
6392 SetNeedsRebuildPropertyTrees(); 6392 SetNeedsRebuildPropertyTrees();
6393 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame)); 6393 EXPECT_EQ(DRAW_SUCCESS, PrepareToDrawFrame(&frame));
6394 host_impl_->DrawLayers(&frame); 6394 host_impl_->DrawLayers(&frame);
6395 EXPECT_TRUE(layer1->quads_appended()); 6395 EXPECT_TRUE(layer1->quads_appended());
6396 EXPECT_TRUE(layer2->quads_appended()); 6396 EXPECT_TRUE(layer2->quads_appended());
6397 host_impl_->DidDrawAllLayers(frame); 6397 host_impl_->DidDrawAllLayers(frame);
6398 6398
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
7163 gfx::Rect child_rect(10, 10, 50, 50); 7163 gfx::Rect child_rect(10, 10, 50, 50);
7164 gfx::Rect grand_child_rect(5, 5, 150, 150); 7164 gfx::Rect grand_child_rect(5, 5, 150, 150);
7165 7165
7166 root->test_properties()->force_render_surface = true; 7166 root->test_properties()->force_render_surface = true;
7167 root->SetPosition(gfx::PointF(root_rect.origin())); 7167 root->SetPosition(gfx::PointF(root_rect.origin()));
7168 root->SetBounds(root_rect.size()); 7168 root->SetBounds(root_rect.size());
7169 root->draw_properties().visible_layer_rect = root_rect; 7169 root->draw_properties().visible_layer_rect = root_rect;
7170 root->SetDrawsContent(false); 7170 root->SetDrawsContent(false);
7171 7171
7172 child->SetPosition(gfx::PointF(child_rect.x(), child_rect.y())); 7172 child->SetPosition(gfx::PointF(child_rect.x(), child_rect.y()));
7173 child->SetOpacity(0.5f); 7173 child->test_properties()->opacity = 0.5f;
7174 child->SetBounds(gfx::Size(child_rect.width(), child_rect.height())); 7174 child->SetBounds(gfx::Size(child_rect.width(), child_rect.height()));
7175 child->draw_properties().visible_layer_rect = child_rect; 7175 child->draw_properties().visible_layer_rect = child_rect;
7176 child->SetDrawsContent(false); 7176 child->SetDrawsContent(false);
7177 child->test_properties()->force_render_surface = true; 7177 child->test_properties()->force_render_surface = true;
7178 7178
7179 grand_child->SetPosition(gfx::PointF(grand_child_rect.origin())); 7179 grand_child->SetPosition(gfx::PointF(grand_child_rect.origin()));
7180 grand_child->SetBounds(grand_child_rect.size()); 7180 grand_child->SetBounds(grand_child_rect.size());
7181 grand_child->draw_properties().visible_layer_rect = grand_child_rect; 7181 grand_child->draw_properties().visible_layer_rect = grand_child_rect;
7182 grand_child->SetDrawsContent(true); 7182 grand_child->SetDrawsContent(true);
7183 7183
(...skipping 3562 matching lines...) Expand 10 before | Expand all | Expand 10 after
10746 10746
10747 // Re-initialize with a software output surface. 10747 // Re-initialize with a software output surface.
10748 output_surface_ = FakeOutputSurface::CreateSoftware( 10748 output_surface_ = FakeOutputSurface::CreateSoftware(
10749 base::WrapUnique(new SoftwareOutputDevice)); 10749 base::WrapUnique(new SoftwareOutputDevice));
10750 host_impl_->InitializeRenderer(output_surface_.get()); 10750 host_impl_->InitializeRenderer(output_surface_.get());
10751 EXPECT_FALSE(host_impl_->use_gpu_rasterization()); 10751 EXPECT_FALSE(host_impl_->use_gpu_rasterization());
10752 } 10752 }
10753 10753
10754 } // namespace 10754 } // namespace
10755 } // namespace cc 10755 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698