Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 #include "ui/aura/env.h" | 23 #include "ui/aura/env.h" |
| 24 #include "ui/aura/layout_manager.h" | 24 #include "ui/aura/layout_manager.h" |
| 25 #include "ui/aura/window_delegate.h" | 25 #include "ui/aura/window_delegate.h" |
| 26 #include "ui/aura/window_event_dispatcher.h" | 26 #include "ui/aura/window_event_dispatcher.h" |
| 27 #include "ui/aura/window_observer.h" | 27 #include "ui/aura/window_observer.h" |
| 28 #include "ui/aura/window_tracker.h" | 28 #include "ui/aura/window_tracker.h" |
| 29 #include "ui/aura/window_tree_host.h" | 29 #include "ui/aura/window_tree_host.h" |
| 30 #include "ui/compositor/compositor.h" | 30 #include "ui/compositor/compositor.h" |
| 31 #include "ui/compositor/layer.h" | 31 #include "ui/compositor/layer.h" |
| 32 #include "ui/events/event_target_iterator.h" | 32 #include "ui/events/event_target_iterator.h" |
| 33 #include "ui/gfx/animation/multi_animation.h" | |
| 34 #include "ui/gfx/canvas.h" | 33 #include "ui/gfx/canvas.h" |
| 35 #include "ui/gfx/path.h" | 34 #include "ui/gfx/path.h" |
| 36 #include "ui/gfx/scoped_canvas.h" | 35 #include "ui/gfx/scoped_canvas.h" |
| 37 #include "ui/gfx/screen.h" | 36 #include "ui/gfx/screen.h" |
| 38 | 37 |
| 39 namespace aura { | 38 namespace aura { |
| 40 | 39 |
| 41 namespace { | 40 namespace { |
| 42 | 41 |
| 43 ui::LayerType WindowLayerTypeToUILayerType(WindowLayerType window_layer_type) { | 42 ui::LayerType WindowLayerTypeToUILayerType(WindowLayerType window_layer_type) { |
| (...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1009 return_tightest, | 1008 return_tightest, |
| 1010 for_event_handling); | 1009 for_event_handling); |
| 1011 if (match) | 1010 if (match) |
| 1012 return match; | 1011 return match; |
| 1013 } | 1012 } |
| 1014 | 1013 |
| 1015 return delegate_ ? this : NULL; | 1014 return delegate_ ? this : NULL; |
| 1016 } | 1015 } |
| 1017 | 1016 |
| 1018 void Window::RemoveChildImpl(Window* child, Window* new_parent) { | 1017 void Window::RemoveChildImpl(Window* child, Window* new_parent) { |
| 1018 // Stop (and complete) an ongoing animation to make sure bounds are updated | |
| 1019 // before updating the layers bounds again. | |
| 1020 if (child->layer() && child->layer()->GetAnimator()) | |
| 1021 child->layer()->GetAnimator()->StopAnimating(); | |
|
Ben Goodger (Google)
2014/04/25 03:28:01
Is it possible to do this in the layer's RemoveChi
varkha
2014/04/25 04:41:45
Yes, it would make more sense. I'll explore it. Th
varkha
2014/04/25 07:13:12
Done.
| |
| 1019 if (layout_manager_) | 1022 if (layout_manager_) |
| 1020 layout_manager_->OnWillRemoveWindowFromLayout(child); | 1023 layout_manager_->OnWillRemoveWindowFromLayout(child); |
| 1021 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWillRemoveWindow(child)); | 1024 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWillRemoveWindow(child)); |
| 1022 Window* root_window = child->GetRootWindow(); | 1025 Window* root_window = child->GetRootWindow(); |
| 1023 Window* new_root_window = new_parent ? new_parent->GetRootWindow() : NULL; | 1026 Window* new_root_window = new_parent ? new_parent->GetRootWindow() : NULL; |
| 1024 if (root_window && root_window != new_root_window) | 1027 if (root_window && root_window != new_root_window) |
| 1025 child->NotifyRemovingFromRootWindow(new_root_window); | 1028 child->NotifyRemovingFromRootWindow(new_root_window); |
| 1026 | 1029 |
| 1027 gfx::Vector2d offset; | 1030 gfx::Vector2d offset; |
| 1028 GetAncestorWithLayer(&offset); | 1031 GetAncestorWithLayer(&offset); |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1437 return window; | 1440 return window; |
| 1438 if (offset) | 1441 if (offset) |
| 1439 *offset += window->bounds().OffsetFromOrigin(); | 1442 *offset += window->bounds().OffsetFromOrigin(); |
| 1440 } | 1443 } |
| 1441 if (offset) | 1444 if (offset) |
| 1442 *offset = gfx::Vector2d(); | 1445 *offset = gfx::Vector2d(); |
| 1443 return NULL; | 1446 return NULL; |
| 1444 } | 1447 } |
| 1445 | 1448 |
| 1446 } // namespace aura | 1449 } // namespace aura |
| OLD | NEW |