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

Unified Diff: mojo/services/view_manager/public/cpp/lib/view.cc

Issue 945273002: Fixes bad code in OnViewVisibilityChanged (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/view_manager/public/cpp/lib/view.cc
diff --git a/mojo/services/view_manager/public/cpp/lib/view.cc b/mojo/services/view_manager/public/cpp/lib/view.cc
index bfbc67a8cb692ad3c7d81e6f3963d397cca85b0b..9ed458c7ffae0f6eae26d382ab4f4669e1816c76 100644
--- a/mojo/services/view_manager/public/cpp/lib/view.cc
+++ b/mojo/services/view_manager/public/cpp/lib/view.cc
@@ -220,9 +220,7 @@ void View::SetVisible(bool value) {
if (manager_)
static_cast<ViewManagerClientImpl*>(manager_)->SetVisible(id_, value);
- FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewVisibilityChanging(this));
- visible_ = value;
- NotifyViewVisibilityChanged(this);
+ LocalSetVisible(value);
}
void View::SetSharedProperty(const std::string& name,
@@ -531,6 +529,15 @@ void View::LocalSetDrawn(bool value) {
FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewDrawnChanged(this));
}
+void View::LocalSetVisible(bool visible) {
+ if (visible_ == visible)
+ return;
+
+ FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewVisibilityChanging(this));
+ visible_ = visible;
+ NotifyViewVisibilityChanged(this);
+}
+
void View::NotifyViewVisibilityChanged(View* target) {
if (!NotifyViewVisibilityChangedDown(target)) {
return; // |this| has been deleted.
« no previous file with comments | « no previous file | mojo/services/view_manager/public/cpp/lib/view_manager_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698