cc :  Delete LayerImpl::opacity

Since property trees have the required opacity info.

To to this, this CL : (opacity = LayerImpl::opacity)
- Removes pushing opacity at commit and activation.
- Removes SetOpacity in OnOpacityAnimated
- Removes SetOpacity in ScrollbarImplBase::PushPropertiesTo
- For tests, adds opacity to LayerImplTestProperties.

BUG=609205
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Review-Url: https://codereview.chromium.org/2018833002
Cr-Commit-Position: refs/heads/master@{#397000}
diff --git a/cc/input/scrollbar_animation_controller_linear_fade_unittest.cc b/cc/input/scrollbar_animation_controller_linear_fade_unittest.cc
index 7d7645b..5537737 100644
--- a/cc/input/scrollbar_animation_controller_linear_fade_unittest.cc
+++ b/cc/input/scrollbar_animation_controller_linear_fade_unittest.cc
@@ -51,17 +51,25 @@
 
     std::unique_ptr<LayerImpl> scroll_layer =
         LayerImpl::Create(host_impl_.active_tree(), 1);
-    scrollbar_layer_ = SolidColorScrollbarLayerImpl::Create(
-        host_impl_.active_tree(), 2, orientation(), kThumbThickness,
-        kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar);
-    clip_layer_ = LayerImpl::Create(host_impl_.active_tree(), 3);
+    std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
+        SolidColorScrollbarLayerImpl::Create(
+            host_impl_.active_tree(), 2, orientation(), kThumbThickness,
+            kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar);
+    scrollbar_layer_ = scrollbar.get();
+    scrollbar_layer_->test_properties()->opacity_can_animate = true;
+    std::unique_ptr<LayerImpl> clip =
+        LayerImpl::Create(host_impl_.active_tree(), 3);
+    clip_layer_ = clip.get();
     scroll_layer->SetScrollClipLayer(clip_layer_->id());
     LayerImpl* scroll_layer_ptr = scroll_layer.get();
-    clip_layer_->AddChild(std::move(scroll_layer));
+    scroll_layer->AddChild(std::move(scrollbar));
+    clip->AddChild(std::move(scroll_layer));
+    host_impl_.active_tree()->SetRootLayer(std::move(clip));
 
     scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id());
     clip_layer_->SetBounds(gfx::Size(100, 100));
     scroll_layer_ptr->SetBounds(gfx::Size(200, 200));
+    host_impl_.active_tree()->BuildPropertyTreesForTesting();
 
     scrollbar_controller_ = ScrollbarAnimationControllerLinearFade::Create(
         scroll_layer_ptr->id(), this, base::TimeDelta::FromSeconds(2),
@@ -75,8 +83,8 @@
   TestTaskGraphRunner task_graph_runner_;
   FakeLayerTreeHostImpl host_impl_;
   std::unique_ptr<ScrollbarAnimationControllerLinearFade> scrollbar_controller_;
-  std::unique_ptr<LayerImpl> clip_layer_;
-  std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar_layer_;
+  LayerImpl* clip_layer_;
+  SolidColorScrollbarLayerImpl* scrollbar_layer_;
 
   base::Closure start_fade_;
   base::TimeDelta delay_;
@@ -91,43 +99,43 @@
 };
 
 TEST_F(ScrollbarAnimationControllerLinearFadeTest, DelayAnimationOnResize) {
-  scrollbar_layer_->SetOpacity(0.0f);
+  scrollbar_layer_->OnOpacityAnimated(0.0f);
   scrollbar_controller_->DidScrollBegin();
   scrollbar_controller_->DidScrollUpdate(true);
   scrollbar_controller_->DidScrollEnd();
   // Normal Animation delay of 2 seconds.
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
   EXPECT_EQ(delay_, base::TimeDelta::FromSeconds(2));
 
-  scrollbar_layer_->SetOpacity(0.0f);
+  scrollbar_layer_->OnOpacityAnimated(0.0f);
   scrollbar_controller_->DidScrollUpdate(true);
   // Delay animation on resize to 5 seconds.
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
   EXPECT_EQ(delay_, base::TimeDelta::FromSeconds(5));
 }
 
 TEST_F(ScrollbarAnimationControllerLinearFadeTest, HiddenInBegin) {
-  scrollbar_layer_->SetOpacity(0.0f);
+  scrollbar_layer_->OnOpacityAnimated(0.0f);
   scrollbar_controller_->Animate(base::TimeTicks());
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
 }
 
 TEST_F(ScrollbarAnimationControllerLinearFadeTest,
        HiddenAfterNonScrollingGesture) {
-  scrollbar_layer_->SetOpacity(0.0f);
+  scrollbar_layer_->OnOpacityAnimated(0.0f);
   scrollbar_controller_->DidScrollBegin();
 
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(100);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
   scrollbar_controller_->DidScrollEnd();
 
   EXPECT_TRUE(start_fade_.Equals(base::Closure()));
 
   time += base::TimeDelta::FromSeconds(100);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
 }
 
 TEST_F(ScrollbarAnimationControllerLinearFadeTest, HideOnResize) {
@@ -144,7 +152,7 @@
   scrollbar_controller_->DidScrollBegin();
 
   scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
 
   scrollbar_controller_->DidScrollEnd();
 
@@ -156,7 +164,7 @@
   scrollbar_controller_->DidScrollBegin();
 
   scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
 
   scrollbar_controller_->DidScrollEnd();
 }
@@ -175,7 +183,7 @@
   scrollbar_controller_->DidScrollBegin();
 
   scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
 
   scrollbar_controller_->DidScrollEnd();
 
@@ -186,7 +194,7 @@
   scrollbar_controller_->DidScrollBegin();
 
   scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
 
   scrollbar_controller_->DidScrollEnd();
 }
@@ -202,7 +210,7 @@
   scrollbar_controller_->DidScrollBegin();
 
   scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
 
   scrollbar_controller_->DidScrollEnd();
 }
@@ -218,7 +226,7 @@
   scrollbar_controller_->DidScrollBegin();
 
   scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
 
   scrollbar_controller_->DidScrollEnd();
 }
@@ -234,7 +242,7 @@
   scrollbar_controller_->DidScrollBegin();
 
   scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
 
   scrollbar_controller_->DidScrollEnd();
 }
@@ -250,7 +258,7 @@
   scrollbar_controller_->DidScrollBegin();
 
   scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
 
   scrollbar_controller_->DidScrollEnd();
 }
@@ -263,7 +271,7 @@
 
   scrollbar_controller_->DidScrollUpdate(false);
   EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
 
   EXPECT_TRUE(start_fade_.Equals(base::Closure()));
 
@@ -271,7 +279,7 @@
 
   scrollbar_controller_->Animate(time);
   EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
   scrollbar_controller_->DidScrollEnd();
   EXPECT_FALSE(did_request_animate_);
   start_fade_.Run();
@@ -282,19 +290,19 @@
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
 
@@ -310,24 +318,24 @@
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
 }
 
 TEST_F(ScrollbarAnimationControllerLinearFadeTest, AwakenByProgrammaticScroll) {
@@ -342,13 +350,13 @@
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
   scrollbar_controller_->DidScrollUpdate(false);
   EXPECT_FALSE(did_request_animate_);
 
@@ -359,19 +367,19 @@
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->DidScrollUpdate(false);
@@ -380,24 +388,24 @@
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
 }
 
 TEST_F(ScrollbarAnimationControllerLinearFadeTest,
@@ -411,32 +419,32 @@
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
 
   scrollbar_controller_->DidScrollBegin();
   EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
 
   scrollbar_controller_->DidScrollEnd();
   EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
 }
 
 TEST_F(ScrollbarAnimationControllerLinearFadeTest,
@@ -451,32 +459,32 @@
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
 
   scrollbar_controller_->DidScrollBegin();
-  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
   EXPECT_TRUE(did_request_animate_);
   did_request_animate_ = false;
-  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->DidScrollUpdate(false);
   EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->DidScrollEnd();
   EXPECT_FALSE(did_request_animate_);
-  EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1, scrollbar_layer_->Opacity());
 }
 
 }  // namespace
diff --git a/cc/input/scrollbar_animation_controller_thinning.cc b/cc/input/scrollbar_animation_controller_thinning.cc
index 53e5895..1a124dd 100644
--- a/cc/input/scrollbar_animation_controller_thinning.cc
+++ b/cc/input/scrollbar_animation_controller_thinning.cc
@@ -140,7 +140,7 @@
       continue;
     float effective_opacity =
         scrollbar->CanScrollOrientation()
-            ? AdjustScale(opacity, scrollbar->opacity(), opacity_change_)
+            ? AdjustScale(opacity, scrollbar->Opacity(), opacity_change_)
             : 0;
 
     scrollbar->OnOpacityAnimated(effective_opacity);
diff --git a/cc/input/scrollbar_animation_controller_thinning_unittest.cc b/cc/input/scrollbar_animation_controller_thinning_unittest.cc
index 0dbe47d..6f1cf10 100644
--- a/cc/input/scrollbar_animation_controller_thinning_unittest.cc
+++ b/cc/input/scrollbar_animation_controller_thinning_unittest.cc
@@ -44,23 +44,32 @@
   void SetUp() override {
     std::unique_ptr<LayerImpl> scroll_layer =
         LayerImpl::Create(host_impl_.active_tree(), 1);
-    clip_layer_ = LayerImpl::Create(host_impl_.active_tree(), 3);
+    std::unique_ptr<LayerImpl> clip =
+        LayerImpl::Create(host_impl_.active_tree(), 3);
+    clip_layer_ = clip.get();
     scroll_layer->SetScrollClipLayer(clip_layer_->id());
     LayerImpl* scroll_layer_ptr = scroll_layer.get();
-    clip_layer_->AddChild(std::move(scroll_layer));
 
     const int kId = 2;
     const int kThumbThickness = 10;
     const int kTrackStart = 0;
     const bool kIsLeftSideVerticalScrollbar = false;
     const bool kIsOverlayScrollbar = true;
-    scrollbar_layer_ = SolidColorScrollbarLayerImpl::Create(
-        host_impl_.active_tree(), kId, HORIZONTAL, kThumbThickness, kTrackStart,
-        kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar);
+    std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
+        SolidColorScrollbarLayerImpl::Create(
+            host_impl_.active_tree(), kId, HORIZONTAL, kThumbThickness,
+            kTrackStart, kIsLeftSideVerticalScrollbar, kIsOverlayScrollbar);
+    scrollbar_layer_ = scrollbar.get();
+
+    scroll_layer->AddChild(std::move(scrollbar));
+    clip_layer_->AddChild(std::move(scroll_layer));
+    host_impl_.active_tree()->SetRootLayer(std::move(clip));
 
     scrollbar_layer_->SetScrollLayerId(scroll_layer_ptr->id());
+    scrollbar_layer_->test_properties()->opacity_can_animate = true;
     clip_layer_->SetBounds(gfx::Size(100, 100));
     scroll_layer_ptr->SetBounds(gfx::Size(200, 200));
+    host_impl_.active_tree()->BuildPropertyTreesForTesting();
 
     scrollbar_controller_ = ScrollbarAnimationControllerThinning::Create(
         scroll_layer_ptr->id(), this, base::TimeDelta::FromSeconds(2),
@@ -72,8 +81,8 @@
   TestTaskGraphRunner task_graph_runner_;
   FakeLayerTreeHostImpl host_impl_;
   std::unique_ptr<ScrollbarAnimationControllerThinning> scrollbar_controller_;
-  std::unique_ptr<LayerImpl> clip_layer_;
-  std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar_layer_;
+  LayerImpl* clip_layer_;
+  SolidColorScrollbarLayerImpl* scrollbar_layer_;
 
   base::Closure start_fade_;
   base::TimeDelta delay_;
@@ -84,7 +93,7 @@
 // Check initialization of scrollbar.
 TEST_F(ScrollbarAnimationControllerThinningTest, Idle) {
   scrollbar_controller_->Animate(base::TimeTicks());
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
 }
 
@@ -103,7 +112,7 @@
   scrollbar_controller_->DidScrollBegin();
 
   scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
 
   scrollbar_controller_->DidScrollEnd();
 
@@ -115,7 +124,7 @@
   scrollbar_controller_->DidScrollBegin();
 
   scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->Opacity());
 
   scrollbar_controller_->DidScrollEnd();
 }
@@ -126,7 +135,7 @@
   base::TimeTicks time;
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->DidScrollUpdate(false);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
   // Scrollbar doesn't change size if triggered by scroll.
   EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
 
@@ -134,7 +143,7 @@
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   // Subsequent scroll restarts animation.
@@ -144,22 +153,22 @@
 
   time += base::TimeDelta::FromSeconds(2);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
 }
 
@@ -179,13 +188,13 @@
   scrollbar_controller_->DidScrollUpdate(false);
   start_fade_.Run();
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
   // Scrollbar should still be thick.
   EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(5);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
 }
 
@@ -196,52 +205,52 @@
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->DidMouseMoveNear(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   // Should animate to thickened but not darken.
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.6f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   // Subsequent moves should not change anything.
   scrollbar_controller_->DidMouseMoveNear(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   // Now move away from bar.
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->DidMouseMoveNear(26);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   // Animate to narrow.
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.6f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
 }
 
@@ -252,52 +261,52 @@
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->DidMouseMoveNear(0);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   // Should animate to thickened and darkened.
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.6f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   // Subsequent moves should not change anything.
   scrollbar_controller_->DidMouseMoveNear(0);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   // Now move away from bar.
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->DidMouseMoveNear(26);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   // Animate to narrow.
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.6f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
 }
 
@@ -309,13 +318,13 @@
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->DidMouseMoveNear(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   // Should animate to thickened but not darken.
   time += base::TimeDelta::FromSeconds(3);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   // Now move over.
@@ -325,17 +334,17 @@
   // Should animate to darkened.
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   // This is tricky. The DidMouseMoveOffScrollbar() is sent before the
@@ -348,7 +357,7 @@
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->Opacity());
   EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   scrollbar_controller_->DidMouseMoveNear(1);
@@ -359,20 +368,20 @@
   scrollbar_controller_->Animate(time);
   // We will initiate the narrowing again, but it won't get decremented until
   // the new animation catches up to it.
-  EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.9f, scrollbar_layer_->Opacity());
   // Now the thickness should be increasing, but it shouldn't happen until the
   // animation catches up.
   EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->Opacity());
   // The thickness now gets big again.
   EXPECT_FLOAT_EQ(0.8f, scrollbar_layer_->thumb_thickness_scale_factor());
 
   time += base::TimeDelta::FromSeconds(1);
   scrollbar_controller_->Animate(time);
-  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
+  EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->Opacity());
   // The thickness now gets big again.
   EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
 }
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 14f0c00..284bb1e 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -1177,8 +1177,6 @@
   layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
   layer->SetTouchEventHandlerRegion(touch_event_handler_region_);
   layer->SetContentsOpaque(contents_opaque_);
-  if (!OpacityIsAnimating())
-    layer->SetOpacity(opacity_);
   layer->SetBlendMode(blend_mode_);
   layer->SetPosition(position_);
   layer->set_should_flatten_transform_from_property_tree(
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 1f09776..c0badc3 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -70,7 +70,6 @@
       was_ever_ready_since_last_transform_animation_(true),
       background_color_(0),
       safe_opaque_background_color_(0),
-      opacity_(1.0),
       blend_mode_(SkXfermode::kSrcOver_Mode),
       draw_blend_mode_(SkXfermode::kSrcOver_Mode),
       transform_tree_index_(-1),
@@ -380,7 +379,6 @@
   layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
   layer->SetTouchEventHandlerRegion(touch_event_handler_region_);
   layer->SetContentsOpaque(contents_opaque_);
-  layer->SetOpacity(opacity_);
   layer->SetBlendMode(blend_mode_);
   layer->SetPosition(position_);
   layer->set_should_flatten_transform_from_property_tree(
@@ -467,7 +465,7 @@
 
   result->SetBoolean("DrawsContent", draws_content_);
   result->SetBoolean("Is3dSorted", Is3dSorted());
-  result->SetDouble("OPACITY", opacity());
+  result->SetDouble("OPACITY", Opacity());
   result->SetBoolean("ContentsOpaque", contents_opaque_);
 
   if (scrollable())
@@ -622,7 +620,7 @@
   }
 }
 
-void LayerImpl::UpdatePropertyTreeOpacity() {
+void LayerImpl::UpdatePropertyTreeOpacity(float opacity) {
   PropertyTrees* property_trees = layer_tree_impl()->property_trees();
   if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) {
     // A LayerImpl's own current state is insufficient for determining whether
@@ -632,7 +630,9 @@
     // started, but might have finished since then on the compositor thread.
     EffectNode* node = property_trees->effect_tree.Node(
         property_trees->effect_id_to_index_map[id()]);
-    node->data.opacity = opacity_;
+    if (node->data.opacity == opacity)
+      return;
+    node->data.opacity = opacity;
     node->data.effect_changed = true;
     property_trees->changed = true;
     property_trees->effect_tree.set_needs_update(true);
@@ -670,8 +670,7 @@
 }
 
 void LayerImpl::OnOpacityAnimated(float opacity) {
-  SetOpacity(opacity);
-  UpdatePropertyTreeOpacity();
+  UpdatePropertyTreeOpacity(opacity);
   SetNeedsPushProperties();
   layer_tree_impl()->set_needs_update_draw_properties();
   layer_tree_impl()->AddToOpacityAnimationsMap(id(), opacity);
@@ -933,11 +932,13 @@
   contents_opaque_ = opaque;
 }
 
-void LayerImpl::SetOpacity(float opacity) {
-  if (opacity_ == opacity)
-    return;
-
-  opacity_ = opacity;
+float LayerImpl::Opacity() const {
+  if (!layer_tree_impl()->property_trees()->IsInIdToIndexMap(
+          PropertyTrees::TreeType::EFFECT, id()))
+    return 1.f;
+  EffectNode* node =
+      layer_tree_impl()->property_trees()->effect_tree.Node(effect_tree_index_);
+  return node->data.opacity;
 }
 
 bool LayerImpl::OpacityIsAnimating() const {
@@ -1140,7 +1141,7 @@
   state->SetInteger("layer_id", id());
   MathUtil::AddToTracedValue("bounds", bounds_, state);
 
-  state->SetDouble("opacity", opacity());
+  state->SetDouble("opacity", Opacity());
 
   MathUtil::AddToTracedValue("position", position_, state);
 
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index 89f3c33..141b610 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -100,7 +100,6 @@
   void OnOpacityIsCurrentlyAnimatingChanged(bool is_currently_animating);
   void OnOpacityIsPotentiallyAnimatingChanged(bool has_potential_animation);
   bool IsActive() const;
-  bool OpacityCanAnimateOnImplThread() const { return false; }
 
   // Tree structure.
   LayerImpl* parent() { return parent_; }
@@ -147,7 +146,7 @@
 
   void UpdatePropertyTreeTransform();
   void UpdatePropertyTreeTransformIsAnimated(bool is_animated);
-  void UpdatePropertyTreeOpacity();
+  void UpdatePropertyTreeOpacity(float opacity);
   void UpdatePropertyTreeScrollOffset();
 
   // For compatibility with Layer.
@@ -232,8 +231,7 @@
   void SetContentsOpaque(bool opaque);
   bool contents_opaque() const { return contents_opaque_; }
 
-  void SetOpacity(float opacity);
-  float opacity() const { return opacity_; }
+  float Opacity() const;
   bool OpacityIsAnimating() const;
   bool HasPotentiallyRunningOpacityAnimation() const;
 
@@ -593,7 +591,6 @@
   SkColor background_color_;
   SkColor safe_opaque_background_color_;
 
-  float opacity_;
   SkXfermode::Mode blend_mode_;
   // draw_blend_mode may be different than blend_mode_,
   // when a RenderSurface re-parents the layer's blend_mode.
diff --git a/cc/layers/layer_impl_test_properties.cc b/cc/layers/layer_impl_test_properties.cc
index 70582db..d4b946a 100644
--- a/cc/layers/layer_impl_test_properties.cc
+++ b/cc/layers/layer_impl_test_properties.cc
@@ -14,8 +14,10 @@
       is_container_for_fixed_position_layers(false),
       should_flatten_transform(true),
       hide_layer_and_subtree(false),
+      opacity_can_animate(false),
       num_descendants_that_draw_content(0),
       num_unclipped_descendants(0),
+      opacity(1.f),
       scroll_parent(nullptr),
       clip_parent(nullptr) {}
 
diff --git a/cc/layers/layer_impl_test_properties.h b/cc/layers/layer_impl_test_properties.h
index 0e98c37..88a8c52 100644
--- a/cc/layers/layer_impl_test_properties.h
+++ b/cc/layers/layer_impl_test_properties.h
@@ -26,8 +26,10 @@
   bool is_container_for_fixed_position_layers;
   bool should_flatten_transform;
   bool hide_layer_and_subtree;
+  bool opacity_can_animate;
   int num_descendants_that_draw_content;
   size_t num_unclipped_descendants;
+  float opacity;
   LayerPositionConstraint position_constraint;
   gfx::Point3F transform_origin;
   LayerImpl* scroll_parent;
diff --git a/cc/layers/layer_impl_unittest.cc b/cc/layers/layer_impl_unittest.cc
index 2fdedf1..a9d1839c 100644
--- a/cc/layers/layer_impl_unittest.cc
+++ b/cc/layers/layer_impl_unittest.cc
@@ -220,7 +220,6 @@
   EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
       root->SetTransform(arbitrary_transform));
   EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true));
-  EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetOpacity(arbitrary_number));
   EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
       root->SetBlendMode(arbitrary_blend_mode));
   EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetDrawsContent(true));
@@ -348,7 +347,6 @@
       layer->SetBackgroundColor(arbitrary_color));
   VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
       layer->SetBackgroundFilters(arbitrary_filters));
-  VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetOpacity(arbitrary_number));
   VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
       layer->SetBlendMode(arbitrary_blend_mode));
   VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
diff --git a/cc/layers/render_surface_unittest.cc b/cc/layers/render_surface_unittest.cc
index 24652cc..26228f9 100644
--- a/cc/layers/render_surface_unittest.cc
+++ b/cc/layers/render_surface_unittest.cc
@@ -56,7 +56,7 @@
   EXECUTE_AND_VERIFY_SURFACE_CHANGED(
       render_surface->SetContentRectForTesting(test_rect));
 
-  owning_layer->SetOpacity(0.5f);
+  owning_layer->OnOpacityAnimated(0.5f);
   EXPECT_TRUE(render_surface->SurfacePropertyChanged());
   host_impl.active_tree()->ResetAllChangeTracking();
 
diff --git a/cc/layers/scrollbar_layer_impl_base.cc b/cc/layers/scrollbar_layer_impl_base.cc
index 25dd0ad..61924f3d1 100644
--- a/cc/layers/scrollbar_layer_impl_base.cc
+++ b/cc/layers/scrollbar_layer_impl_base.cc
@@ -32,9 +32,7 @@
 }
 
 void ScrollbarLayerImplBase::PushPropertiesTo(LayerImpl* layer) {
-  float active_opacity = layer->opacity();
   LayerImpl::PushPropertiesTo(layer);
-  layer->SetOpacity(active_opacity);
   DCHECK(layer->ToScrollbarLayer());
   layer->ToScrollbarLayer()->set_is_overlay_scrollbar(is_overlay_scrollbar_);
   layer->ToScrollbarLayer()->SetScrollLayerId(ScrollLayerId());
diff --git a/cc/layers/solid_color_scrollbar_layer_impl_unittest.cc b/cc/layers/solid_color_scrollbar_layer_impl_unittest.cc
index a285f443..a2b2430 100644
--- a/cc/layers/solid_color_scrollbar_layer_impl_unittest.cc
+++ b/cc/layers/solid_color_scrollbar_layer_impl_unittest.cc
@@ -37,7 +37,7 @@
   scrollbar_layer_impl->SetClipLayerLength(100.f);
   scrollbar_layer_impl->SetScrollLayerLength(200.f);
   // SolidColorScrollbarLayers construct with opacity = 0.f, so override.
-  scrollbar_layer_impl->SetOpacity(1.f);
+  scrollbar_layer_impl->test_properties()->opacity = 1.f;
 
   impl.CalcDrawProps(viewport_size);
 
diff --git a/cc/test/layer_tree_json_parser_unittest.cc b/cc/test/layer_tree_json_parser_unittest.cc
index 48734b3..760ad6866 100644
--- a/cc/test/layer_tree_json_parser_unittest.cc
+++ b/cc/test/layer_tree_json_parser_unittest.cc
@@ -39,8 +39,8 @@
                                         layer->contents_opaque()));
   RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->scrollable(),
                                         layer->scrollable()));
-  RETURN_IF_EXPECTATION_FAILS(EXPECT_FLOAT_EQ(layer_impl->opacity(),
-                                              layer->opacity()));
+  RETURN_IF_EXPECTATION_FAILS(
+      EXPECT_FLOAT_EQ(layer_impl->Opacity(), layer->opacity()));
   RETURN_IF_EXPECTATION_FAILS(
       EXPECT_EQ(layer_impl->touch_event_handler_region(),
                 layer->touch_event_handler_region()));
diff --git a/cc/trees/damage_tracker_unittest.cc b/cc/trees/damage_tracker_unittest.cc
index 769d6f5..4a48075 100644
--- a/cc/trees/damage_tracker_unittest.cc
+++ b/cc/trees/damage_tracker_unittest.cc
@@ -1184,7 +1184,7 @@
     grand_child3->SetDrawsContent(true);
     child1->AddChild(std::move(grand_child3));
   }
-  child1->SetOpacity(0.5f);
+  child1->test_properties()->opacity = 0.5f;
   root->layer_tree_impl()->property_trees()->needs_rebuild = true;
   EmulateDrawingOneFrame(root);
 
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 8654a6bb..103e3d4 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -180,7 +180,7 @@
   SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(),
                                gfx::PointF(10, 10), gfx::Size(100, 100), true,
                                false);
-  child->SetOpacity(0.f);
+  child->test_properties()->opacity = 0.f;
   ExecuteCalculateDrawProperties(parent);
   EffectTree& effect_tree =
       parent->layer_tree_impl()->property_trees()->effect_tree;
@@ -510,7 +510,7 @@
                                true);
 
   // Child is set up so that a new render surface should be created.
-  child->SetOpacity(0.5f);
+  child->test_properties()->opacity = 0.5f;
   child->SetDrawsContent(true);
 
   gfx::Transform parent_layer_transform;
@@ -636,7 +636,7 @@
                                true);
 
   // Child is set up so that a new render surface should be created.
-  child->SetOpacity(0.5f);
+  child->test_properties()->opacity = 0.5f;
 
   gfx::Transform parent_layer_transform;
   parent_layer_transform.Scale3d(2.0, 2.0, 1.0);
@@ -729,8 +729,8 @@
 
   // In combination with descendant draws content, opacity != 1 forces the layer
   // to have a new render surface.
-  render_surface1->SetOpacity(0.5f);
-  render_surface2->SetOpacity(0.33f);
+  render_surface1->test_properties()->opacity = 0.5f;
+  render_surface2->test_properties()->opacity = 0.33f;
 
   // One-time setup of root layer
   gfx::Transform identity_matrix;
@@ -1294,7 +1294,7 @@
   SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(),
                                gfx::PointF(), gfx::Size(10, 10), true, false,
                                false);
-  render_surface1->SetOpacity(0.f);
+  render_surface1->test_properties()->opacity = 0.f;
 
   LayerImplList render_surface_layer_list;
   LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
@@ -1329,7 +1329,7 @@
   SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(),
                                gfx::PointF(), gfx::Size(10, 10), true, false,
                                false);
-  render_surface1->SetOpacity(0.f);
+  render_surface1->test_properties()->opacity = 0.f;
   render_surface1->SetDrawsContent(true);
   child->SetDrawsContent(true);
   FilterOperations filters;
@@ -1426,7 +1426,7 @@
                                true);
 
   child->SetBlendMode(blend_mode);
-  child->SetOpacity(0.5f);
+  child->test_properties()->opacity = 0.5f;
 
   ExecuteCalculateDrawProperties(parent);
 
@@ -1462,9 +1462,9 @@
   surface1->SetDrawsContent(true);
   surface2->SetDrawsContent(true);
 
-  surface1->SetOpacity(0.5f);
-  not_surface->SetOpacity(0.5f);
-  surface2->SetOpacity(0.5f);
+  surface1->test_properties()->opacity = 0.5f;
+  not_surface->test_properties()->opacity = 0.5f;
+  surface2->test_properties()->opacity = 0.5f;
 
   ExecuteCalculateDrawProperties(root);
 
@@ -1524,10 +1524,10 @@
                                gfx::PointF(), gfx::Size(100, 100), true, false,
                                false);
 
-  child1->SetOpacity(0.5f);
-  grand_child->SetOpacity(0.5f);
-  leaf_node1->SetOpacity(0.5f);
-  leaf_node2->SetOpacity(0.5f);
+  child1->test_properties()->opacity = 0.5f;
+  grand_child->test_properties()->opacity = 0.5f;
+  leaf_node1->test_properties()->opacity = 0.5f;
+  leaf_node2->test_properties()->opacity = 0.5f;
 
   // With surfaces enabled, each layer's draw opacity is the product of layer
   // opacities on the path from the layer to its render target, not including
@@ -1602,7 +1602,7 @@
   gfx::Transform rotation_about_y_axis;
   rotation_about_y_axis.RotateAboutYAxis(30.0);
   // Make |parent| have a render surface.
-  parent->SetOpacity(0.9f);
+  parent->test_properties()->opacity = 0.9f;
 
   const gfx::Transform identity_matrix;
   SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
@@ -1702,9 +1702,9 @@
                                false);
 
   child->SetMasksToBounds(true);
-  child->SetOpacity(0.4f);
-  grand_child->SetOpacity(0.5f);
-  great_grand_child->SetOpacity(0.4f);
+  child->test_properties()->opacity = 0.4f;
+  grand_child->test_properties()->opacity = 0.5f;
+  great_grand_child->test_properties()->opacity = 0.4f;
 
   ExecuteCalculateDrawProperties(parent);
 
@@ -1750,8 +1750,8 @@
                                false);
 
   parent->SetMasksToBounds(true);
-  child->SetOpacity(0.4f);
-  grand_child->SetOpacity(0.4f);
+  child->test_properties()->opacity = 0.4f;
+  grand_child->test_properties()->opacity = 0.4f;
 
   ExecuteCalculateDrawProperties(parent);
 
@@ -2144,7 +2144,7 @@
   grand_child3->SetMasksToBounds(true);
 
   // Force child to be a render surface.
-  child->SetOpacity(0.4f);
+  child->test_properties()->opacity = 0.4f;
 
   ExecuteCalculateDrawProperties(parent);
 
@@ -2217,11 +2217,11 @@
   grand_child4->SetMasksToBounds(true);
 
   // Force everyone to be a render surface.
-  child->SetOpacity(0.4f);
-  grand_child1->SetOpacity(0.5f);
-  grand_child2->SetOpacity(0.5f);
-  grand_child3->SetOpacity(0.5f);
-  grand_child4->SetOpacity(0.5f);
+  child->test_properties()->opacity = 0.4f;
+  grand_child1->test_properties()->opacity = 0.5f;
+  grand_child2->test_properties()->opacity = 0.5f;
+  grand_child3->test_properties()->opacity = 0.5f;
+  grand_child4->test_properties()->opacity = 0.5f;
 
   ExecuteCalculateDrawProperties(parent);
 
@@ -4215,8 +4215,8 @@
   backface_matrix.Translate(-50.0, -50.0);
 
   // Having a descendant and opacity will force these to have render surfaces.
-  front_facing_surface->SetOpacity(0.5f);
-  back_facing_surface->SetOpacity(0.5f);
+  front_facing_surface->test_properties()->opacity = 0.5f;
+  back_facing_surface->test_properties()->opacity = 0.5f;
 
   // Nothing preserves 3d. According to current W3C CSS gfx::Transforms spec,
   // these layers should blindly use their own local transforms to determine
@@ -4998,7 +4998,7 @@
   SetLayerPropertiesForTesting(grand_child, identity_matrix, gfx::Point3F(),
                                gfx::PointF(), gfx::Size(10, 10), true, false);
 
-  child->SetOpacity(0.5f);
+  child->test_properties()->opacity = 0.5f;
 
   ExecuteCalculateDrawProperties(root);
 
@@ -5027,7 +5027,7 @@
                                gfx::PointF(), gfx::Size(50, 50), true, false,
                                false);
   child->SetDrawsContent(true);
-  child->SetOpacity(0.0f);
+  child->test_properties()->opacity = 0.0f;
 
   const int child_id = child->id();
   root->AddChild(std::move(child));
@@ -5056,7 +5056,7 @@
 
   // If the root itself is hidden, the child should not be drawn even if it has
   // an animating opacity.
-  root_layer->SetOpacity(0.0f);
+  root_layer->test_properties()->opacity = 0.0f;
   root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true;
   LayerImplList render_surface_layer_list2;
   LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs2(
@@ -5072,8 +5072,8 @@
 
   // A layer should be drawn and it should contribute to drawn surface when
   // it has animating opacity even if it has opacity 0.
-  root_layer->SetOpacity(1.0f);
-  child_ptr->SetOpacity(0.0f);
+  root_layer->test_properties()->opacity = 1.0f;
+  child_ptr->test_properties()->opacity = 0.0f;
   root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true;
   LayerImplList render_surface_layer_list3;
   LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs3(
@@ -5249,7 +5249,7 @@
   // Case 7: Translucent.
   child_->SetTransform(identity_matrix);
   child_->layer_tree_impl()->property_trees()->needs_rebuild = true;
-  child_->SetOpacity(0.5f);
+  child_->test_properties()->opacity = 0.5f;
   ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
                                  layers_always_allowed_lcd_text_);
   EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
@@ -5259,7 +5259,7 @@
   // Case 8: Sanity check: restore transform and opacity.
   child_->SetTransform(identity_matrix);
   child_->layer_tree_impl()->property_trees()->needs_rebuild = true;
-  child_->SetOpacity(1.f);
+  child_->test_properties()->opacity = 1.f;
   ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
                                  layers_always_allowed_lcd_text_);
   EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
@@ -5295,7 +5295,7 @@
   EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
 
   // Add opacity animation.
-  child_->SetOpacity(0.9f);
+  child_->test_properties()->opacity = 0.9f;
   child_->layer_tree_impl()->property_trees()->needs_rebuild = true;
   AddOpacityTransitionToLayerWithPlayer(child_->id(), timeline(), 10.0, 0.9f,
                                         0.1f, false);
@@ -8711,10 +8711,10 @@
   EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect());
   child_ptr->test_properties()->hide_layer_and_subtree = false;
 
-  child_ptr->SetOpacity(0.f);
+  child_ptr->OnOpacityAnimated(0.f);
   ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
   EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect());
-  child_ptr->SetOpacity(1.f);
+  child_ptr->test_properties()->opacity = 1.f;
 
   root_ptr->SetTransform(singular);
   // Force transform tree to have a node for child, so that ancestor's
@@ -8726,14 +8726,14 @@
   root_ptr->SetTransform(identity);
   child_ptr->SetTransform(identity);
 
-  root_ptr->SetOpacity(0.f);
-  child_ptr->SetOpacity(0.7f);
+  root_ptr->test_properties()->opacity = 0.f;
+  child_ptr->test_properties()->opacity = 0.7f;
   host_impl.active_tree()->property_trees()->needs_rebuild = true;
   ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
   EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect());
-  root_ptr->SetOpacity(1.f);
+  root_ptr->test_properties()->opacity = 1.f;
 
-  child_ptr->SetOpacity(0.f);
+  child_ptr->test_properties()->opacity = 0.f;
   // Now, even though child has zero opacity, we will configure |grandchild| and
   // |greatgrandchild| in several ways that should force the subtree to be
   // processed anyhow.
@@ -8744,7 +8744,7 @@
   EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
 
   host_impl.active_tree()->property_trees()->effect_tree.ClearCopyRequests();
-  child_ptr->SetOpacity(1.f);
+  child_ptr->test_properties()->opacity = 1.f;
 
   // A double sided render surface with backface visible should not be skipped
   grandchild_ptr->set_visible_layer_rect(gfx::Rect());
@@ -8903,7 +8903,7 @@
       ->animation_host()
       ->GetElementAnimationsForElementId(root_ptr->id())
       ->AddAnimation(std::move(animation));
-  root_ptr->SetOpacity(0);
+  root_ptr->test_properties()->opacity = 0.f;
   grandchild_ptr->set_visible_layer_rect(gfx::Rect());
   root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true;
   ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
@@ -8950,7 +8950,7 @@
   child->test_properties()->double_sided = true;
   child->SetTransform(identity);
 
-  child->SetOpacity(0.f);
+  child->test_properties()->opacity = 0.f;
   root->layer_tree_impl()->property_trees()->needs_rebuild = true;
   ExecuteCalculateDrawProperties(root);
   EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect());
@@ -9448,7 +9448,7 @@
 
   render_surface->SetMasksToBounds(true);
   test_layer->SetDrawsContent(true);
-  test_layer->SetOpacity(0);
+  test_layer->test_properties()->opacity = 0.f;
   test_layer->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 20, 20));
 
   ExecuteCalculateDrawProperties(root);
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 10ce52d..72b431a 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -964,7 +964,7 @@
   scrollbar->SetPosition(gfx::PointF(345, 0));
   scrollbar->SetScrollLayerId(scroll->id());
   scrollbar->SetDrawsContent(true);
-  scrollbar->SetOpacity(1.f);
+  scrollbar->test_properties()->opacity = 1.f;
 
   std::unique_ptr<LayerImpl> squash1 = LayerImpl::Create(layer_tree_impl, 5);
   squash1->SetBounds(gfx::Size(140, 300));
@@ -2678,8 +2678,8 @@
     std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
         SolidColorScrollbarLayerImpl::Create(host_impl_->active_tree(), 400,
                                              VERTICAL, 10, 0, false, true);
-    scrollbar->SetOpacity(0.f);
-    EXPECT_FLOAT_EQ(0.f, scrollbar->opacity());
+    scrollbar->test_properties()->opacity = 0.f;
+    EXPECT_FLOAT_EQ(0.f, scrollbar->test_properties()->opacity);
 
     LayerImpl* scroll = host_impl_->active_tree()->OuterViewportScrollLayer();
     LayerImpl* root = host_impl_->active_tree()->InnerViewportContainerLayer();
@@ -2863,7 +2863,7 @@
     std::unique_ptr<SolidColorScrollbarLayerImpl> scrollbar =
         SolidColorScrollbarLayerImpl::Create(host_impl_->pending_tree(), 400,
                                              VERTICAL, 10, 0, false, true);
-    scrollbar->SetOpacity(0.f);
+    scrollbar->test_properties()->opacity = 0.f;
     LayerImpl* scroll = host_impl_->pending_tree()->OuterViewportScrollLayer();
     LayerImpl* root = host_impl_->pending_tree()->InnerViewportContainerLayer();
     scrollbar->SetScrollLayerId(scroll->id());
@@ -2877,7 +2877,7 @@
     EffectNode* active_tree_node =
         host_impl_->active_tree()->property_trees()->effect_tree.Node(
             scrollbar_layer->effect_tree_index());
-    EXPECT_FLOAT_EQ(scrollbar_layer->opacity(), active_tree_node->data.opacity);
+    EXPECT_FLOAT_EQ(scrollbar_layer->Opacity(), active_tree_node->data.opacity);
 
     host_impl_->ScrollbarAnimationControllerForId(scroll->id())
         ->DidMouseMoveNear(0);
@@ -2893,14 +2893,14 @@
         ->property_trees()
         ->always_use_active_tree_opacity_effect_ids.push_back(400);
     EXPECT_FLOAT_EQ(1.f, active_tree_node->data.opacity);
-    EXPECT_FLOAT_EQ(1.f, scrollbar_layer->opacity());
+    EXPECT_FLOAT_EQ(1.f, scrollbar_layer->Opacity());
     EXPECT_FLOAT_EQ(0.f, pending_tree_node->data.opacity);
     host_impl_->ActivateSyncTree();
     active_tree_node =
         host_impl_->active_tree()->property_trees()->effect_tree.Node(
             scrollbar_layer->effect_tree_index());
     EXPECT_FLOAT_EQ(1.f, active_tree_node->data.opacity);
-    EXPECT_FLOAT_EQ(1.f, scrollbar_layer->opacity());
+    EXPECT_FLOAT_EQ(1.f, scrollbar_layer->Opacity());
   }
 };
 
@@ -6240,7 +6240,7 @@
 
   // Layer with translucent opacity, drawn with blending.
   layer1->SetContentsOpaque(true);
-  layer1->SetOpacity(0.5f);
+  layer1->test_properties()->opacity = 0.5f;
   layer1->NoteLayerPropertyChanged();
   layer1->SetExpectation(true, false);
   layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
@@ -6252,7 +6252,7 @@
 
   // Layer with translucent opacity and painting, drawn with blending.
   layer1->SetContentsOpaque(true);
-  layer1->SetOpacity(0.5f);
+  layer1->test_properties()->opacity = 0.5f;
   layer1->NoteLayerPropertyChanged();
   layer1->SetExpectation(true, false);
   layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
@@ -6272,12 +6272,12 @@
 
   // 2 opaque layers, drawn without blending.
   layer1->SetContentsOpaque(true);
-  layer1->SetOpacity(1.f);
+  layer1->test_properties()->opacity = 1.f;
   layer1->NoteLayerPropertyChanged();
   layer1->SetExpectation(false, false);
   layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
   layer2->SetContentsOpaque(true);
-  layer2->SetOpacity(1.f);
+  layer2->test_properties()->opacity = 1.f;
   layer2->NoteLayerPropertyChanged();
   layer2->SetExpectation(false, false);
   layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
@@ -6323,7 +6323,7 @@
   // Child layer with opaque content, drawn without blending (parent surface
   // carries the inherited opacity).
   layer1->SetContentsOpaque(true);
-  layer1->SetOpacity(0.5f);
+  layer1->test_properties()->opacity = 0.5f;
   layer1->NoteLayerPropertyChanged();
   layer1->test_properties()->force_render_surface = true;
   layer1->SetExpectation(false, true);
@@ -6343,12 +6343,12 @@
   // Draw again, but with child non-opaque, to make sure
   // layer1 not culled.
   layer1->SetContentsOpaque(true);
-  layer1->SetOpacity(1.f);
+  layer1->test_properties()->opacity = 1.f;
   layer1->NoteLayerPropertyChanged();
   layer1->SetExpectation(false, false);
   layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
   layer2->SetContentsOpaque(true);
-  layer2->SetOpacity(0.5f);
+  layer2->test_properties()->opacity = 0.5f;
   layer2->NoteLayerPropertyChanged();
   layer2->SetExpectation(true, false);
   layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
@@ -6361,12 +6361,12 @@
 
   // A second way of making the child non-opaque.
   layer1->SetContentsOpaque(true);
-  layer1->SetOpacity(1.f);
+  layer1->test_properties()->opacity = 1.f;
   layer1->NoteLayerPropertyChanged();
   layer1->SetExpectation(false, false);
   layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
   layer2->SetContentsOpaque(false);
-  layer2->SetOpacity(1.f);
+  layer2->test_properties()->opacity = 1.f;
   layer2->NoteLayerPropertyChanged();
   layer2->SetExpectation(true, false);
   layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
@@ -6380,12 +6380,12 @@
   // And when the layer says its not opaque but is painted opaque, it is not
   // blended.
   layer1->SetContentsOpaque(true);
-  layer1->SetOpacity(1.f);
+  layer1->test_properties()->opacity = 1.f;
   layer1->NoteLayerPropertyChanged();
   layer1->SetExpectation(false, false);
   layer1->SetUpdateRect(gfx::Rect(layer1->bounds()));
   layer2->SetContentsOpaque(true);
-  layer2->SetOpacity(1.f);
+  layer2->test_properties()->opacity = 1.f;
   layer2->NoteLayerPropertyChanged();
   layer2->SetExpectation(false, false);
   layer2->SetUpdateRect(gfx::Rect(layer1->bounds()));
@@ -7170,7 +7170,7 @@
   root->SetDrawsContent(false);
 
   child->SetPosition(gfx::PointF(child_rect.x(), child_rect.y()));
-  child->SetOpacity(0.5f);
+  child->test_properties()->opacity = 0.5f;
   child->SetBounds(gfx::Size(child_rect.width(), child_rect.height()));
   child->draw_properties().visible_layer_rect = child_rect;
   child->SetDrawsContent(false);
diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc
index 6b9f8e9..f131fe8e 100644
--- a/cc/trees/property_tree_builder.cc
+++ b/cc/trees/property_tree_builder.cc
@@ -615,7 +615,8 @@
 }
 
 static inline bool HasPotentialOpacityAnimation(LayerImpl* layer) {
-  return layer->HasPotentiallyRunningOpacityAnimation();
+  return layer->HasPotentiallyRunningOpacityAnimation() ||
+         layer->test_properties()->opacity_can_animate;
 }
 
 static inline bool DoubleSided(Layer* layer) {
@@ -662,8 +663,17 @@
 }
 
 static inline float EffectiveOpacity(LayerImpl* layer) {
-  return layer->test_properties()->hide_layer_and_subtree ? 0.f
-                                                          : layer->opacity();
+  return layer->test_properties()->hide_layer_and_subtree
+             ? 0.f
+             : layer->test_properties()->opacity;
+}
+
+static inline float Opacity(Layer* layer) {
+  return layer->opacity();
+}
+
+static inline float Opacity(LayerImpl* layer) {
+  return layer->test_properties()->opacity;
 }
 
 static inline bool HideLayerAndSubtree(Layer* layer) {
@@ -846,7 +856,7 @@
         .push_back(node.owner_id);
   }
 
-  node.data.opacity = layer->opacity();
+  node.data.opacity = Opacity(layer);
   node.data.has_render_surface = should_create_render_surface;
   node.data.has_copy_request = HasCopyRequest(layer);
   node.data.has_background_filters = !layer->background_filters().IsEmpty();
diff --git a/cc/trees/tree_synchronizer_unittest.cc b/cc/trees/tree_synchronizer_unittest.cc
index b9c1dce..32add7d 100644
--- a/cc/trees/tree_synchronizer_unittest.cc
+++ b/cc/trees/tree_synchronizer_unittest.cc
@@ -287,9 +287,6 @@
   gfx::PointF root_position = gfx::PointF(2.3f, 7.4f);
   layer_tree_root->SetPosition(root_position);
 
-  float first_child_opacity = 0.25f;
-  layer_tree_root->children()[0]->SetOpacity(first_child_opacity);
-
   gfx::Size second_child_bounds = gfx::Size(25, 53);
   layer_tree_root->children()[1]->SetBounds(second_child_bounds);
   layer_tree_root->children()[1]->SavePaintProperties();
@@ -309,9 +306,6 @@
   EXPECT_EQ(root_position.x(), root_layer_impl_position.x());
   EXPECT_EQ(root_position.y(), root_layer_impl_position.y());
 
-  EXPECT_EQ(first_child_opacity,
-            layer_impl_tree_root->children()[0]->opacity());
-
   gfx::Size second_layer_impl_child_bounds =
       layer_impl_tree_root->children()[1]->bounds();
   EXPECT_EQ(second_child_bounds.width(),
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutableState.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutableState.cpp
index c149cf8..bf5af7e 100644
--- a/third_party/WebKit/Source/platform/graphics/CompositorMutableState.cpp
+++ b/third_party/WebKit/Source/platform/graphics/CompositorMutableState.cpp
@@ -20,7 +20,7 @@
 
 double CompositorMutableState::opacity() const
 {
-    return m_mainLayer->opacity();
+    return m_mainLayer->Opacity();
 }
 
 void CompositorMutableState::setOpacity(double opacity)
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp
index 0c9ed637..bd06f90 100644
--- a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateTest.cpp
@@ -132,7 +132,7 @@
     OwnPtr<CompositorMutableState> state(provider.getMutableStateFor(layer->element_id()));
     EXPECT_TRUE(state.get());
 
-    EXPECT_EQ(1.0, rootLayer()->opacity());
+    EXPECT_EQ(1.0, rootLayer()->Opacity());
     EXPECT_EQ(gfx::Transform().ToString(), rootLayer()->transform().ToString());
     EXPECT_EQ(0.0, layer->CurrentScrollOffset().x());
     EXPECT_EQ(0.0, layer->CurrentScrollOffset().y());
@@ -143,7 +143,7 @@
     state->setScrollLeft(1.0);
     state->setScrollTop(1.0);
 
-    EXPECT_EQ(0.5, rootLayer()->opacity());
+    EXPECT_EQ(0.5, rootLayer()->Opacity());
     EXPECT_EQ(zero.ToString(), rootLayer()->transform().ToString());
     EXPECT_EQ(1.0, layer->CurrentScrollOffset().x());
     EXPECT_EQ(1.0, layer->CurrentScrollOffset().y());