diff options
author | reveman <reveman@chromium.org> | 2016-02-09 15:15:41 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-09 23:16:50 +0000 |
commit | 4bbaf010a0204a1a5c8e625fa80ab330abe09598 (patch) | |
tree | 57f480ea721273015242cd66e941d96b2bd3e2eb /components/exo | |
parent | a8bff211e9cc3c64f2e6516186131dcdeed59eae (diff) | |
download | chromium_src-4bbaf010a0204a1a5c8e625fa80ab330abe09598.zip chromium_src-4bbaf010a0204a1a5c8e625fa80ab330abe09598.tar.gz chromium_src-4bbaf010a0204a1a5c8e625fa80ab330abe09598.tar.bz2 |
exo: Reset visible state of surface when no longer a sub-surface.
This removes an unnecessary DCHECK and resets the visible
state of surface when removed from parent so that creating
a new sub-surface works correctly.
BUG=549781
TEST=exo_unittests --gtest_filter=SubSurfaceTest.SetPosition
Review URL: https://codereview.chromium.org/1682213002
Cr-Commit-Position: refs/heads/master@{#374519}
Diffstat (limited to 'components/exo')
-rw-r--r-- | components/exo/sub_surface_unittest.cc | 8 | ||||
-rw-r--r-- | components/exo/surface.cc | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/components/exo/sub_surface_unittest.cc b/components/exo/sub_surface_unittest.cc index 2d4ab5c..dc8e2f6 100644 --- a/components/exo/sub_surface_unittest.cc +++ b/components/exo/sub_surface_unittest.cc @@ -32,6 +32,14 @@ TEST_F(SubSurfaceTest, SetPosition) { // Check that position is updated when Commit() is called. parent->Commit(); EXPECT_EQ(position.ToString(), surface->bounds().origin().ToString()); + + // Create and commit a new sub-surface using the same surface. + sub_surface.reset(); + sub_surface = make_scoped_ptr(new SubSurface(surface.get(), parent.get())); + parent->Commit(); + + // Initial position should be reset to origin. + EXPECT_EQ(gfx::Point().ToString(), surface->bounds().origin().ToString()); } TEST_F(SubSurfaceTest, PlaceAbove) { diff --git a/components/exo/surface.cc b/components/exo/surface.cc index c01993f..b69f4b5 100644 --- a/components/exo/surface.cc +++ b/components/exo/surface.cc @@ -166,7 +166,6 @@ void Surface::AddSubSurface(Surface* sub_surface) { DCHECK(!sub_surface->parent()); DCHECK(!sub_surface->IsVisible()); - DCHECK(sub_surface->bounds().origin() == gfx::Point()); AddChild(sub_surface); DCHECK(!ListContainsEntry(pending_sub_surfaces_, sub_surface)); @@ -178,6 +177,8 @@ void Surface::RemoveSubSurface(Surface* sub_surface) { sub_surface->AsTracedValue()); RemoveChild(sub_surface); + if (sub_surface->IsVisible()) + sub_surface->Hide(); DCHECK(ListContainsEntry(pending_sub_surfaces_, sub_surface)); pending_sub_surfaces_.erase( |