| Index: cc/trees/layer_tree_host_common_unittest.cc
|
| diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
|
| index 2a2ca196f6278a3fd4e6a6584bc15eaa11e508b9..43e9bef8b8b25aed077cfd3121cfe0ba881af606 100644
|
| --- a/cc/trees/layer_tree_host_common_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_common_unittest.cc
|
| @@ -5110,8 +5110,9 @@ class LCDTextTest : public LayerTreeHostCommonTestBase,
|
| public testing::TestWithParam<LCDTextTestParam> {
|
| public:
|
| LCDTextTest()
|
| - : LayerTreeHostCommonTestBase(LayerTreeSettings()),
|
| - host_impl_(&task_runner_provider_,
|
| + : LayerTreeHostCommonTestBase(LCDTextTestLayerTreeSettings()),
|
| + host_impl_(LCDTextTestLayerTreeSettings(),
|
| + &task_runner_provider_,
|
| &shared_bitmap_manager_,
|
| &task_graph_runner_),
|
| root_(nullptr),
|
| @@ -5121,14 +5122,21 @@ class LCDTextTest : public LayerTreeHostCommonTestBase,
|
| scoped_refptr<AnimationTimeline> timeline() { return timeline_; }
|
|
|
| protected:
|
| + LayerTreeSettings LCDTextTestLayerTreeSettings() {
|
| + LayerTreeSettings settings = LayerTreeSettings();
|
| +
|
| + can_use_lcd_text_ = std::tr1::get<0>(GetParam());
|
| + layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam());
|
| + settings.can_use_lcd_text = can_use_lcd_text_;
|
| + settings.layers_always_allowed_lcd_text = layers_always_allowed_lcd_text_;
|
| + return settings;
|
| + }
|
| +
|
| void SetUp() override {
|
| timeline_ =
|
| AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
|
| host_impl_.animation_host()->AddAnimationTimeline(timeline_);
|
|
|
| - can_use_lcd_text_ = std::tr1::get<0>(GetParam());
|
| - layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam());
|
| -
|
| std::unique_ptr<LayerImpl> root_ptr =
|
| LayerImpl::Create(host_impl_.active_tree(), 1);
|
| std::unique_ptr<LayerImpl> child_ptr =
|
| @@ -5185,8 +5193,7 @@ TEST_P(LCDTextTest, CanUseLCDText) {
|
|
|
| // Case 1: Identity transform.
|
| gfx::Transform identity_matrix;
|
| - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
|
| - layers_always_allowed_lcd_text_);
|
| + ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
|
| EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
|
| EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text());
|
| EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
|
| @@ -5196,8 +5203,7 @@ TEST_P(LCDTextTest, CanUseLCDText) {
|
| integral_translation.Translate(1.0, 2.0);
|
| child_->SetTransform(integral_translation);
|
| child_->layer_tree_impl()->property_trees()->needs_rebuild = true;
|
| - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
|
| - layers_always_allowed_lcd_text_);
|
| + ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
|
| EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
|
| EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text());
|
| EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
|
| @@ -5207,8 +5213,7 @@ TEST_P(LCDTextTest, CanUseLCDText) {
|
| non_integral_translation.Translate(1.5, 2.5);
|
| child_->SetTransform(non_integral_translation);
|
| child_->layer_tree_impl()->property_trees()->needs_rebuild = true;
|
| - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
|
| - layers_always_allowed_lcd_text_);
|
| + ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
|
| EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
|
| EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text());
|
| EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text());
|
| @@ -5218,8 +5223,7 @@ TEST_P(LCDTextTest, CanUseLCDText) {
|
| rotation.Rotate(10.0);
|
| child_->SetTransform(rotation);
|
| child_->layer_tree_impl()->property_trees()->needs_rebuild = true;
|
| - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
|
| - layers_always_allowed_lcd_text_);
|
| + ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
|
| EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
|
| EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text());
|
| EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text());
|
| @@ -5229,8 +5233,7 @@ TEST_P(LCDTextTest, CanUseLCDText) {
|
| scale.Scale(2.0, 2.0);
|
| child_->SetTransform(scale);
|
| child_->layer_tree_impl()->property_trees()->needs_rebuild = true;
|
| - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
|
| - layers_always_allowed_lcd_text_);
|
| + ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
|
| EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
|
| EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text());
|
| EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text());
|
| @@ -5240,8 +5243,7 @@ TEST_P(LCDTextTest, CanUseLCDText) {
|
| skew.Skew(10.0, 0.0);
|
| child_->SetTransform(skew);
|
| child_->layer_tree_impl()->property_trees()->needs_rebuild = true;
|
| - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
|
| - layers_always_allowed_lcd_text_);
|
| + ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
|
| EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
|
| EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text());
|
| EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text());
|
| @@ -5250,8 +5252,7 @@ TEST_P(LCDTextTest, CanUseLCDText) {
|
| child_->SetTransform(identity_matrix);
|
| child_->layer_tree_impl()->property_trees()->needs_rebuild = true;
|
| child_->SetOpacity(0.5f);
|
| - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
|
| - layers_always_allowed_lcd_text_);
|
| + ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
|
| EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
|
| EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text());
|
| EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text());
|
| @@ -5260,24 +5261,21 @@ TEST_P(LCDTextTest, CanUseLCDText) {
|
| child_->SetTransform(identity_matrix);
|
| child_->layer_tree_impl()->property_trees()->needs_rebuild = true;
|
| child_->SetOpacity(1.f);
|
| - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
|
| - layers_always_allowed_lcd_text_);
|
| + ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
|
| EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
|
| EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text());
|
| EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
|
|
|
| // Case 9: Non-opaque content.
|
| child_->SetContentsOpaque(false);
|
| - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
|
| - layers_always_allowed_lcd_text_);
|
| + ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
|
| EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
|
| EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text());
|
| EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
|
|
|
| // Case 10: Sanity check: restore content opaqueness.
|
| child_->SetContentsOpaque(true);
|
| - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
|
| - layers_always_allowed_lcd_text_);
|
| + ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
|
| EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
|
| EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text());
|
| EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
|
| @@ -5288,8 +5286,7 @@ TEST_P(LCDTextTest, CanUseLCDTextWithAnimation) {
|
| bool expect_not_lcd_text = layers_always_allowed_lcd_text_;
|
|
|
| // Sanity check: Make sure can_use_lcd_text_ is set on each node.
|
| - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
|
| - layers_always_allowed_lcd_text_);
|
| + ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
|
| EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
|
| EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text());
|
| EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
|
| @@ -5299,8 +5296,7 @@ TEST_P(LCDTextTest, CanUseLCDTextWithAnimation) {
|
| child_->layer_tree_impl()->property_trees()->needs_rebuild = true;
|
| AddOpacityTransitionToLayerWithPlayer(child_->id(), timeline(), 10.0, 0.9f,
|
| 0.1f, false);
|
| - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
|
| - layers_always_allowed_lcd_text_);
|
| + ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
|
| // Text LCD should be adjusted while animation is active.
|
| EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
|
| EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text());
|
| @@ -5312,8 +5308,7 @@ TEST_P(LCDTextTest, CanUseLCDTextWithAnimationContentsOpaque) {
|
| bool expect_not_lcd_text = layers_always_allowed_lcd_text_;
|
|
|
| // Sanity check: Make sure can_use_lcd_text_ is set on each node.
|
| - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
|
| - layers_always_allowed_lcd_text_);
|
| + ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
|
| EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
|
| EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text());
|
| EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
|
| @@ -5322,8 +5317,7 @@ TEST_P(LCDTextTest, CanUseLCDTextWithAnimationContentsOpaque) {
|
| child_->SetContentsOpaque(false);
|
| AddOpacityTransitionToLayerWithPlayer(child_->id(), timeline(), 10.0, 0.9f,
|
| 0.1f, false);
|
| - ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
|
| - layers_always_allowed_lcd_text_);
|
| + ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL);
|
| // LCD text should be disabled for non-opaque layers even during animations.
|
| EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text());
|
| EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text());
|
|
|