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

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: Merge to trunk 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 effca031e21b599dce88f2b0054eab08965d2f27..c85aba24c305ad27789ef069f9627f4271e71c9b 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -23,7 +23,6 @@ using internal::RootWindow;
Window::Window(WindowDelegate* delegate)
: delegate_(delegate),
- visible_(false),
parent_(NULL),
id_(-1),
user_data_(NULL),
@@ -60,6 +59,10 @@ void Window::Init() {
if (delegate_)
type = ui::Layer::LAYER_HAS_TEXTURE;
layer_.reset(new ui::Layer(Desktop::GetInstance()->compositor(), type));
+ // Windows (and therefore the layer) should initially be hidden.
+ // TODO: when we distinguish control (child) windows, they should be initially
+ // visible.
+ layer_->SetVisible(false);
layer_->set_delegate(this);
}
@@ -76,6 +79,10 @@ void Window::Hide() {
}
}
+bool Window::IsVisible() const {
+ return layer_->IsDrawn();
+}
+
void Window::SetLayoutManager(LayoutManager* layout_manager) {
layout_manager_.reset(layout_manager);
}
@@ -205,7 +212,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);
@@ -225,7 +232,7 @@ internal::FocusManager* Window::GetFocusManager() {
}
void Window::SetCapture() {
- if (!visible_)
+ if (!IsVisible())
return;
RootWindow* root = GetRoot();
@@ -262,12 +269,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