OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/aura/desktop.h" | 10 #include "ui/aura/desktop.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 void Window::MoveChildToFront(Window* child) { | 119 void Window::MoveChildToFront(Window* child) { |
120 DCHECK_EQ(child->parent(), this); | 120 DCHECK_EQ(child->parent(), this); |
121 const Windows::iterator i(std::find(children_.begin(), children_.end(), | 121 const Windows::iterator i(std::find(children_.begin(), children_.end(), |
122 child)); | 122 child)); |
123 DCHECK(i != children_.end()); | 123 DCHECK(i != children_.end()); |
124 children_.erase(i); | 124 children_.erase(i); |
125 | 125 |
126 // TODO(beng): this obviously has to handle different window types. | 126 // TODO(beng): this obviously has to handle different window types. |
127 children_.insert(children_.begin() + children_.size(), child); | 127 children_.insert(children_.begin() + children_.size(), child); |
128 SchedulePaintInRect(gfx::Rect()); | 128 SchedulePaintInRect(gfx::Rect()); |
| 129 |
| 130 ui::Layer* parent_layer = child->layer()->parent(); |
| 131 parent_layer->Remove(child->layer()); |
| 132 parent_layer->Add(child->layer()); |
129 } | 133 } |
130 | 134 |
131 void Window::AddChild(Window* child) { | 135 void Window::AddChild(Window* child) { |
132 DCHECK(std::find(children_.begin(), children_.end(), child) == | 136 DCHECK(std::find(children_.begin(), children_.end(), child) == |
133 children_.end()); | 137 children_.end()); |
134 child->parent_ = this; | 138 child->parent_ = this; |
135 layer_->Add(child->layer_.get()); | 139 layer_->Add(child->layer_.get()); |
136 children_.push_back(child); | 140 children_.push_back(child); |
137 } | 141 } |
138 | 142 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 201 |
198 void Window::SchedulePaint() { | 202 void Window::SchedulePaint() { |
199 SchedulePaintInRect(gfx::Rect(0, 0, bounds_.width(), bounds_.height())); | 203 SchedulePaintInRect(gfx::Rect(0, 0, bounds_.width(), bounds_.height())); |
200 } | 204 } |
201 | 205 |
202 void Window::OnPaintLayer(gfx::Canvas* canvas) { | 206 void Window::OnPaintLayer(gfx::Canvas* canvas) { |
203 delegate_->OnPaint(canvas); | 207 delegate_->OnPaint(canvas); |
204 } | 208 } |
205 | 209 |
206 } // namespace aura | 210 } // namespace aura |
OLD | NEW |