summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/aura/window.cc4
-rw-r--r--ui/gfx/compositor/layer.cc10
-rw-r--r--ui/gfx/compositor/layer.h3
3 files changed, 14 insertions, 3 deletions
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 86e1dda..b738a5b 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -139,9 +139,7 @@ void Window::MoveChildToFront(Window* child) {
children_.insert(children_.begin() + children_.size(), child);
SchedulePaintInRect(gfx::Rect());
- ui::Layer* parent_layer = child->layer()->parent();
- parent_layer->Remove(child->layer());
- parent_layer->Add(child->layer());
+ child->layer()->parent()->MoveToFront(child->layer());
}
void Window::AddChild(Window* child) {
diff --git a/ui/gfx/compositor/layer.cc b/ui/gfx/compositor/layer.cc
index 448158c..622f0a2 100644
--- a/ui/gfx/compositor/layer.cc
+++ b/ui/gfx/compositor/layer.cc
@@ -78,6 +78,14 @@ void Layer::Remove(Layer* child) {
child->DropTextures();
}
+void Layer::MoveToFront(Layer* child) {
+ std::vector<Layer*>::iterator i =
+ std::find(children_.begin(), children_.end(), child);
+ DCHECK(i != children_.end());
+ children_.erase(i);
+ children_.push_back(child);
+}
+
bool Layer::Contains(const Layer* other) const {
for (const Layer* parent = other; parent; parent = parent->parent()) {
if (parent == this)
@@ -129,6 +137,8 @@ void Layer::SetVisible(bool visible) {
visible_ = visible;
if (!visible_)
DropTextures();
+ if (fills_bounds_opaquely_ && parent_)
+ parent_->RecomputeHole();
}
bool Layer::ShouldDraw() {
diff --git a/ui/gfx/compositor/layer.h b/ui/gfx/compositor/layer.h
index 625067a..1d06035 100644
--- a/ui/gfx/compositor/layer.h
+++ b/ui/gfx/compositor/layer.h
@@ -65,6 +65,9 @@ class COMPOSITOR_EXPORT Layer : public LayerAnimatorDelegate {
// Removes a Layer from this Layer.
void Remove(Layer* child);
+ // Moves a child to the end of the child list.
+ void MoveToFront(Layer* child);
+
// Returns the child Layers.
const std::vector<Layer*>& children() { return children_; }