Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: ui/aura/window.cc

Issue 8136005: Makes visbility inherited. That is, in order for a window to be (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Window now gets visibility from Layer. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/window.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « ui/aura/window.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698