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

Unified Diff: cc/layers/scrollbar_layer_unittest.cc

Issue 1991523002: cc : Track ids for which active opacity always wins on property trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/scrollbar_layer_impl_base.cc ('k') | cc/layers/solid_color_scrollbar_layer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/scrollbar_layer_unittest.cc
diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc
index 36e42daab2ef9c5e44c0fde8b19dcd215e73f2f5..22114c8b297e714db75c1e5a206148c5ed3cb2fd 100644
--- a/cc/layers/scrollbar_layer_unittest.cc
+++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -497,6 +497,59 @@ TEST_F(ScrollbarLayerTest, LayerDrivenSolidColorDrawQuads) {
}
}
+TEST_F(ScrollbarLayerTest, ScrollbarLayerOpacity) {
+ const int kThumbThickness = 3;
+ const int kTrackStart = 0;
+
+ std::unique_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true));
+
+ scoped_refptr<Layer> layer_tree_root = Layer::Create();
+ scoped_refptr<Layer> scroll_layer = Layer::Create();
+ scroll_layer->SetScrollClipLayerId(layer_tree_root->id());
+ scoped_refptr<Layer> child1 = Layer::Create();
+ scoped_refptr<Layer> scrollbar_layer;
+ const bool kIsLeftSideVerticalScrollbar = false;
+ scrollbar_layer = SolidColorScrollbarLayer::Create(
+ scrollbar->Orientation(), kThumbThickness, kTrackStart,
+ kIsLeftSideVerticalScrollbar, child1->id());
+ scrollbar_layer->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id());
+ scroll_layer->AddChild(child1);
+ scroll_layer->InsertChild(scrollbar_layer, 1);
+ layer_tree_root->AddChild(scroll_layer);
+ layer_tree_host_->SetRootLayer(layer_tree_root);
+
+ // Choose layer bounds to give max_scroll_offset = (8, 8).
+ layer_tree_root->SetBounds(gfx::Size(2, 2));
+ scroll_layer->SetBounds(gfx::Size(10, 10));
+
+ layer_tree_host_->UpdateLayers();
+
+ LayerImpl* layer_impl_tree_root =
+ layer_tree_host_->CommitAndCreateLayerImplTree();
+
+ scrollbar_layer->SetOpacity(0.5f);
+ layer_tree_host_->UpdateLayers();
+ EffectNode* node = layer_tree_host_->property_trees()->effect_tree.Node(
+ scrollbar_layer->effect_tree_index());
+ EXPECT_EQ(node->data.opacity, 0.5f);
+
+ LayerTreeHostImpl* host_impl = layer_tree_host_->host_impl();
+ host_impl->CreatePendingTree();
+ layer_impl_tree_root = layer_tree_host_->CommitAndCreatePendingTree();
+ LayerTreeImpl* layer_tree_impl = layer_impl_tree_root->layer_tree_impl();
+ EXPECT_TRUE(layer_tree_impl->IsPendingTree());
+ layer_tree_impl->property_trees()->effect_tree.Node(
+ scrollbar_layer->effect_tree_index());
+ EXPECT_EQ(node->data.opacity, 0.5f);
+ // The active tree opacity should not change with activation for scrollbar
+ // layer.
+ host_impl->ActivateSyncTree();
+ layer_tree_impl = host_impl->active_tree();
+ node = layer_tree_impl->property_trees()->effect_tree.Node(
+ scrollbar_layer->effect_tree_index());
+ EXPECT_EQ(node->data.opacity, 1.f);
+}
+
class ScrollbarLayerSolidColorThumbTest : public testing::Test {
public:
ScrollbarLayerSolidColorThumbTest() {
« no previous file with comments | « cc/layers/scrollbar_layer_impl_base.cc ('k') | cc/layers/solid_color_scrollbar_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698