Chromium Code Reviews| Index: ui/aura/window.cc |
| diff --git a/ui/aura/window.cc b/ui/aura/window.cc |
| index c1e41de4500d02dfa6d233e9cfce1bb83ea9ff22..26d52bbd5c603ae02c90e36ebceb075843ee5f14 100644 |
| --- a/ui/aura/window.cc |
| +++ b/ui/aura/window.cc |
| @@ -24,7 +24,6 @@ using internal::RootWindow; |
| Window::Window(WindowDelegate* delegate) |
| : delegate_(delegate), |
| - visible_(false), |
| parent_(NULL), |
| id_(-1), |
| user_data_(NULL) { |
| @@ -60,6 +59,8 @@ void Window::Init() { |
| if (delegate_) |
| type = ui::Layer::LAYER_HAS_TEXTURE; |
| layer_.reset(new ui::Layer(Desktop::GetInstance()->compositor(), type)); |
| + // Windows (and therefor the layer) should initially be hidden. |
| + layer_->SetVisible(false); |
|
Ben Goodger (Google)
2011/10/05 01:44:09
therefore
also, I think we should make control-ty
|
| layer_->set_delegate(this); |
| } |
| @@ -76,6 +77,10 @@ void Window::Hide() { |
| } |
| } |
| +bool Window::IsVisible() const { |
| + return layer_->IsDrawn(); |
| +} |
| + |
| void Window::SetLayoutManager(LayoutManager* layout_manager) { |
| layout_manager_.reset(layout_manager); |
| } |
| @@ -205,7 +210,7 @@ Window* Window::GetEventHandlerForPoint(const gfx::Point& point) { |
| Windows::const_reverse_iterator i = children_.rbegin(); |
| for (; i != children_.rend(); ++i) { |
| Window* child = *i; |
| - if (!child->visible()) |
| + if (!child->IsVisible()) |
| continue; |
| gfx::Point point_in_child_coords(point); |
| Window::ConvertPointToWindow(this, child, &point_in_child_coords); |
| @@ -223,7 +228,7 @@ internal::FocusManager* Window::GetFocusManager() { |
| } |
| void Window::SetCapture() { |
| - if (!visible_) |
| + if (!IsVisible()) |
| return; |
| RootWindow* root = GetRoot(); |
| @@ -260,12 +265,11 @@ internal::RootWindow* Window::GetRoot() { |
| } |
| void Window::SetVisible(bool visible) { |
| - if (visible_ == visible) |
| - return; |
| - |
| - visible_ = visible; |
| - layer_->SetVisible(visible_); |
| - SchedulePaint(); |
| + bool was_visible = IsVisible(); |
| + layer_->SetVisible(visible); |
| + bool is_visible = IsVisible(); |
| + if (was_visible != is_visible) |
| + SchedulePaint(); |
| } |
| void Window::SchedulePaint() { |