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

Unified Diff: ui/aura/window.cc

Issue 10545140: aura: Window should notify WindowDelegate of bounds changed if Layer cannot. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 8 years, 6 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 8ea6ddfa8c5173760b3282b811190b1cacb3f472..b6097b5b1ed0b63d6eb4d1000ff7a5c1b1aacf5a 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -597,9 +597,17 @@ void Window::SetBoundsInternal(const gfx::Rect& new_bounds) {
std::max(min_size.height(), actual_new_bounds.height()));
}
+ gfx::Rect old_bounds = GetTargetBounds();
+
// Always need to set the layer's bounds -- even if it is to the same thing.
// This may cause important side effects such as stopping animation.
layer_->SetBounds(actual_new_bounds);
+
+ // If we are currently not the layer's delegate, we will not get bounds
+ // changed notification from the layer (this typically happens after animating
+ // hidden). We must notify ourselves.
+ if (layer_->delegate() != this)
+ OnLayerBoundsChanged(old_bounds, ContainsMouse());
}
void Window::SetVisible(bool visible) {
@@ -813,14 +821,8 @@ void Window::OnPaintLayer(gfx::Canvas* canvas) {
}
base::Closure Window::PrepareForLayerBoundsChange() {
- bool contains_mouse = false;
- if (IsVisible()) {
- RootWindow* root_window = GetRootWindow();
- contains_mouse =
- root_window && ContainsPointInRoot(root_window->last_mouse_location());
- }
return base::Bind(&Window::OnLayerBoundsChanged, base::Unretained(this),
- bounds(), contains_mouse);
+ bounds(), ContainsMouse());
}
void Window::UpdateLayerName(const std::string& name) {
@@ -840,6 +842,16 @@ void Window::UpdateLayerName(const std::string& name) {
#endif
}
+bool Window::ContainsMouse() {
+ bool contains_mouse = false;
+ if (IsVisible()) {
+ RootWindow* root_window = GetRootWindow();
+ contains_mouse =
+ root_window && ContainsPointInRoot(root_window->last_mouse_location());
+ }
+ return contains_mouse;
+}
+
#ifndef NDEBUG
std::string Window::GetDebugInfo() const {
return StringPrintf(
« 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