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

Unified Diff: mojo/services/public/cpp/view_manager/view.h

Issue 621903004: Adds View::visible() and IsDrawn (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 6 years, 3 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
Index: mojo/services/public/cpp/view_manager/view.h
diff --git a/mojo/services/public/cpp/view_manager/view.h b/mojo/services/public/cpp/view_manager/view.h
index 036684286d51040cfabb66cf9a0fbd77bf3632e4..f7afa49c5b3c3751b7ea9fe9f09312c3477b481b 100644
--- a/mojo/services/public/cpp/view_manager/view.h
+++ b/mojo/services/public/cpp/view_manager/view.h
@@ -46,12 +46,16 @@ class View {
Id id() const { return id_; }
// Geometric disposition.
- const gfx::Rect& bounds() { return bounds_; }
+ const gfx::Rect& bounds() const { return bounds_; }
void SetBounds(const gfx::Rect& bounds);
- // Visibility.
+ // Visibility (also see IsDrawn()).
+ bool visible() const { return visible_; }
void SetVisible(bool value);
- // TODO(sky): add accessor.
+
+ // A View is drawn if the View and all its ancestors are visible and the
+ // View is attached to the root.
+ bool IsDrawn() const;
// Observation.
void AddObserver(ViewObserver* observer);
@@ -105,6 +109,7 @@ class View {
// Returns true if the order actually changed.
bool LocalReorder(View* relative, OrderDirection direction);
void LocalSetBounds(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds);
+ void LocalSetDrawn(bool drawn);
void CreateBitmapUploader();
ViewManager* manager_;
@@ -115,6 +120,13 @@ class View {
ObserverList<ViewObserver> observers_;
gfx::Rect bounds_;
+
+ bool visible_;
+
+ // Drawn state is derived from the visible state and the parent's visible
+ // state. This field is only used if the view has no parent (eg it's a root).
+ bool drawn_;
+
// TODO(jamesr): Temporary, remove when all clients are using surfaces
// directly.
scoped_ptr<BitmapUploader> bitmap_uploader_;
« no previous file with comments | « mojo/services/public/cpp/view_manager/tests/view_unittest.cc ('k') | mojo/services/public/cpp/view_manager/view_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698