summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorfmalita <fmalita@chromium.org>2015-05-13 13:19:33 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-13 20:19:39 +0000
commitfcd926a57df8c32f16ff05c8917548ec104943f7 (patch)
tree55587b87aa6e118d5f373dbc3ae8928d70609142 /cc
parenteb6d82cd81c4e0a4dc528e98630283b17e17e2d9 (diff)
downloadchromium_src-fcd926a57df8c32f16ff05c8917548ec104943f7.zip
chromium_src-fcd926a57df8c32f16ff05c8917548ec104943f7.tar.gz
chromium_src-fcd926a57df8c32f16ff05c8917548ec104943f7.tar.bz2
Observe LCD text restrictions during layer animations
Drawing LCD text into non-opaque layers is never correct - we should update DrawProperties.can_use_lcd_text during animations also. BUG=486892 R=danakj@chromium.org,enne@chromium.org Review URL: https://codereview.chromium.org/1132253003 Cr-Commit-Position: refs/heads/master@{#329705}
Diffstat (limited to 'cc')
-rw-r--r--cc/trees/layer_tree_host_common.cc7
-rw-r--r--cc/trees/layer_tree_host_common_unittest.cc28
2 files changed, 27 insertions, 8 deletions
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 49bc13d..0988285 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -1897,10 +1897,6 @@ static void CalculateDrawPropertiesInternal(
layer_draw_properties.screen_space_transform.PreconcatTransform
(layer_draw_properties.target_space_transform);
- // Adjusting text AA method during animation may cause repaints, which in-turn
- // causes jank.
- bool adjust_text_aa =
- !animating_opacity_to_screen && !animating_transform_to_screen;
bool layer_can_use_lcd_text = true;
bool subtree_can_use_lcd_text = true;
if (!globals.layers_always_allowed_lcd_text) {
@@ -2145,8 +2141,7 @@ static void CalculateDrawPropertiesInternal(
layer_draw_properties.render_target = layer->parent()->render_target();
}
- if (adjust_text_aa)
- layer_draw_properties.can_use_lcd_text = layer_can_use_lcd_text;
+ layer_draw_properties.can_use_lcd_text = layer_can_use_lcd_text;
gfx::Size content_size_affected_by_delta(layer->content_bounds());
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index bcd437f..591f48c 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -5977,6 +5977,7 @@ TEST_P(LCDTextTest, CanUseLCDText) {
TEST_P(LCDTextTest, CanUseLCDTextWithAnimation) {
bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_;
+ 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_,
@@ -5992,11 +5993,34 @@ TEST_P(LCDTextTest, CanUseLCDTextWithAnimation) {
ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
layers_always_allowed_lcd_text_);
- // Text AA should not be adjusted while animation is active.
- // Make sure LCD text AA setting remains unchanged.
+ // 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());
+ EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text());
+}
+
+TEST_P(LCDTextTest, CanUseLCDTextWithAnimationContentsOpaque) {
+ bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_;
+ 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_);
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());
+
+ // Mark contents non-opaque within the first animation frame.
+ child_->SetContentsOpaque(false);
+ AddOpacityTransitionToController(child_->layer_animation_controller(), 10.0,
+ 0.9f, 0.1f, false);
+
+ ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_,
+ layers_always_allowed_lcd_text_);
+ // 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());
+ EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text());
}
INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest,