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

Unified Diff: ash/wm/frame_painter.cc

Issue 10192001: ash: Fix transparency glitches in window header (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | « ash/wm/frame_painter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/frame_painter.cc
diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc
index 7a2f241a5d1213b0597124dd1b3b89aef1213d18..a162b5d28d5837433eadeeeddfade60e89fa4094 100644
--- a/ash/wm/frame_painter.cc
+++ b/ash/wm/frame_painter.cc
@@ -115,8 +115,10 @@ void TileRoundRect(gfx::Canvas* canvas,
// Returns true if |window| is a visible, normal window.
bool IsVisibleNormalWindow(aura::Window* window) {
+ // We must use TargetVisibility() because windows animate in and out and
+ // IsVisible() also tracks the layer visibility state.
return window &&
- window->IsVisible() &&
+ window->TargetVisibility() &&
window->type() == aura::client::WINDOW_TYPE_NORMAL;
}
@@ -514,6 +516,14 @@ void FramePainter::OnWindowPropertyChanged(aura::Window* window,
}
}
+void FramePainter::OnWindowVisibilityChanged(aura::Window* window,
+ bool visible) {
+ // Hiding a window may trigger the solo window appearance in a different
+ // window.
+ if (!visible && UseSoloWindowHeader())
+ SchedulePaintForSoloWindow();
+}
+
void FramePainter::OnWindowDestroying(aura::Window* destroying) {
DCHECK_EQ(window_, destroying);
// Must be removed here and not in the destructor, as the aura::Window is
@@ -525,17 +535,9 @@ void FramePainter::OnWindowDestroying(aura::Window* destroying) {
instances_->erase(this);
// If we have two or more windows open and we close this one, we might trigger
- // the solo window appearance. If so, find the window that is becoming solo
- // and schedule it to paint.
- if (UseSoloWindowHeader()) {
- for (std::set<FramePainter*>::const_iterator it = instances_->begin();
- it != instances_->end();
- ++it) {
- FramePainter* painter = *it;
- if (IsVisibleNormalWindow(painter->window_) && painter->frame_)
- painter->frame_->non_client_view()->SchedulePaint();
- }
- }
+ // the solo window appearance for another window.
+ if (UseSoloWindowHeader())
+ SchedulePaintForSoloWindow();
}
///////////////////////////////////////////////////////////////////////////////
@@ -582,4 +584,15 @@ bool FramePainter::UseSoloWindowHeader() {
return window_count == 1;
}
+// static
+void FramePainter::SchedulePaintForSoloWindow() {
+ for (std::set<FramePainter*>::const_iterator it = instances_->begin();
+ it != instances_->end();
+ ++it) {
+ FramePainter* painter = *it;
+ if (IsVisibleNormalWindow(painter->window_))
+ painter->frame_->non_client_view()->SchedulePaint();
+ }
+}
+
} // namespace ash
« no previous file with comments | « ash/wm/frame_painter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698