diff options
| author | xdai <xdai@chromium.org> | 2016-03-04 16:44:49 -0800 |
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2016-03-05 00:48:15 +0000 |
| commit | b05778e3eb9b34ccf25d6eb906864be220de7093 (patch) | |
| tree | 5714625be3d0ab1129f5d5671c79227af10743d8 | |
| parent | 23bf77a7d48612e9e722a246d1ddce0ebee4fa7c (diff) | |
| download | chromium_src-b05778e3eb9b34ccf25d6eb906864be220de7093.zip chromium_src-b05778e3eb9b34ccf25d6eb906864be220de7093.tar.gz chromium_src-b05778e3eb9b34ccf25d6eb906864be220de7093.tar.bz2 | |
Use the old layer's inverted property to create a new layer.
Otherwise we might lose the high contrast mode setting.
BUG=569847
Review URL: https://codereview.chromium.org/1764883002
Cr-Commit-Position: refs/heads/master@{#379419}
| -rw-r--r-- | ui/compositor/layer_owner.cc | 1 | ||||
| -rw-r--r-- | ui/compositor/layer_owner_unittest.cc | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/ui/compositor/layer_owner.cc b/ui/compositor/layer_owner.cc index c918081..f406d88 100644 --- a/ui/compositor/layer_owner.cc +++ b/ui/compositor/layer_owner.cc @@ -48,6 +48,7 @@ scoped_ptr<Layer> LayerOwner::RecreateLayer() { new_layer->SetFillsBoundsOpaquely(old_layer->fills_bounds_opaquely()); new_layer->SetFillsBoundsCompletely(old_layer->FillsBoundsCompletely()); new_layer->SetSubpixelPositionOffset(old_layer->subpixel_position_offset()); + new_layer->SetLayerInverted(old_layer->layer_inverted()); if (old_layer->type() == LAYER_SOLID_COLOR) new_layer->SetColor(old_layer->GetTargetColor()); SkRegion* alpha_shape = old_layer->alpha_shape(); diff --git a/ui/compositor/layer_owner_unittest.cc b/ui/compositor/layer_owner_unittest.cc index 8b6bf50..b3c08f3 100644 --- a/ui/compositor/layer_owner_unittest.cc +++ b/ui/compositor/layer_owner_unittest.cc @@ -144,6 +144,20 @@ TEST(LayerOwnerTest, RecreateRootLayerWithNullCompositor) { EXPECT_EQ(nullptr, layer_copy->GetCompositor()); } +TEST(LayerOwnerTest, InvertPropertyRemainSameWithRecreateLayer) { + LayerOwner owner; + Layer* layer = new Layer; + owner.SetLayer(layer); + + layer->SetLayerInverted(true); + scoped_ptr<Layer> old_layer1 = owner.RecreateLayer(); + EXPECT_EQ(old_layer1->layer_inverted(), owner.layer()->layer_inverted()); + + old_layer1->SetLayerInverted(false); + scoped_ptr<Layer> old_layer2 = owner.RecreateLayer(); + EXPECT_EQ(old_layer2->layer_inverted(), owner.layer()->layer_inverted()); +} + TEST_F(LayerOwnerTestWithCompositor, RecreateRootLayerWithCompositor) { LayerOwner owner; Layer* layer = new Layer; |
