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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 12 matching lines...) Expand all Loading... | |
23 #include "ui/aura/client/event_client.h" | 23 #include "ui/aura/client/event_client.h" |
24 #include "ui/aura/client/focus_client.h" | 24 #include "ui/aura/client/focus_client.h" |
25 #include "ui/aura/client/screen_position_client.h" | 25 #include "ui/aura/client/screen_position_client.h" |
26 #include "ui/aura/client/visibility_client.h" | 26 #include "ui/aura/client/visibility_client.h" |
27 #include "ui/aura/client/window_stacking_client.h" | 27 #include "ui/aura/client/window_stacking_client.h" |
28 #include "ui/aura/env.h" | 28 #include "ui/aura/env.h" |
29 #include "ui/aura/layout_manager.h" | 29 #include "ui/aura/layout_manager.h" |
30 #include "ui/aura/window_delegate.h" | 30 #include "ui/aura/window_delegate.h" |
31 #include "ui/aura/window_event_dispatcher.h" | 31 #include "ui/aura/window_event_dispatcher.h" |
32 #include "ui/aura/window_observer.h" | 32 #include "ui/aura/window_observer.h" |
33 #include "ui/aura/window_port.h" | |
34 #include "ui/aura/window_port_aura.h" | |
33 #include "ui/aura/window_tracker.h" | 35 #include "ui/aura/window_tracker.h" |
34 #include "ui/aura/window_tree_host.h" | 36 #include "ui/aura/window_tree_host.h" |
35 #include "ui/compositor/compositor.h" | 37 #include "ui/compositor/compositor.h" |
36 #include "ui/compositor/layer.h" | 38 #include "ui/compositor/layer.h" |
37 #include "ui/display/display.h" | 39 #include "ui/display/display.h" |
38 #include "ui/display/screen.h" | 40 #include "ui/display/screen.h" |
39 #include "ui/events/event_target_iterator.h" | 41 #include "ui/events/event_target_iterator.h" |
40 #include "ui/gfx/canvas.h" | 42 #include "ui/gfx/canvas.h" |
41 #include "ui/gfx/path.h" | 43 #include "ui/gfx/path.h" |
42 #include "ui/gfx/scoped_canvas.h" | 44 #include "ui/gfx/scoped_canvas.h" |
43 | 45 |
44 namespace aura { | 46 namespace aura { |
45 | 47 |
46 class ScopedCursorHider { | 48 Window::Window(WindowDelegate* delegate) : Window(delegate, nullptr) {} |
47 public: | |
48 explicit ScopedCursorHider(Window* window) | |
49 : window_(window), | |
50 hid_cursor_(false) { | |
51 if (!window_->IsRootWindow()) | |
52 return; | |
53 const bool cursor_is_in_bounds = window_->GetBoundsInScreen().Contains( | |
54 Env::GetInstance()->last_mouse_location()); | |
55 client::CursorClient* cursor_client = client::GetCursorClient(window_); | |
56 if (cursor_is_in_bounds && cursor_client && | |
57 cursor_client->IsCursorVisible()) { | |
58 cursor_client->HideCursor(); | |
59 hid_cursor_ = true; | |
60 } | |
61 } | |
62 ~ScopedCursorHider() { | |
63 if (!window_->IsRootWindow()) | |
64 return; | |
65 | 49 |
66 // Update the device scale factor of the cursor client only when the last | 50 Window::Window(WindowDelegate* delegate, std::unique_ptr<WindowPort> port) |
67 // mouse location is on this root window. | 51 : port_(port.release()), |
68 if (hid_cursor_) { | 52 host_(nullptr), |
69 client::CursorClient* cursor_client = client::GetCursorClient(window_); | |
70 if (cursor_client) { | |
71 const display::Display& display = | |
72 display::Screen::GetScreen()->GetDisplayNearestWindow(window_); | |
73 cursor_client->SetDisplay(display); | |
74 cursor_client->ShowCursor(); | |
75 } | |
76 } | |
77 } | |
78 | |
79 private: | |
80 Window* window_; | |
81 bool hid_cursor_; | |
82 | |
83 DISALLOW_COPY_AND_ASSIGN(ScopedCursorHider); | |
84 }; | |
85 | |
86 Window::Window(WindowDelegate* delegate) | |
87 : host_(NULL), | |
88 type_(ui::wm::WINDOW_TYPE_UNKNOWN), | 53 type_(ui::wm::WINDOW_TYPE_UNKNOWN), |
89 owned_by_parent_(true), | 54 owned_by_parent_(true), |
90 delegate_(delegate), | 55 delegate_(delegate), |
91 parent_(NULL), | 56 parent_(nullptr), |
92 visible_(false), | 57 visible_(false), |
93 id_(kInitialId), | 58 id_(kInitialId), |
94 transparent_(false), | 59 transparent_(false), |
95 user_data_(NULL), | 60 user_data_(nullptr), |
96 ignore_events_(false), | 61 ignore_events_(false), |
97 // Don't notify newly added observers during notification. This causes | 62 // Don't notify newly added observers during notification. This causes |
98 // problems for code that adds an observer as part of an observer | 63 // problems for code that adds an observer as part of an observer |
99 // notification (such as the workspace code). | 64 // notification (such as the workspace code). |
100 observers_(base::ObserverList<WindowObserver>::NOTIFY_EXISTING_ONLY) { | 65 observers_(base::ObserverList<WindowObserver>::NOTIFY_EXISTING_ONLY) { |
101 SetTargetHandler(delegate_); | 66 SetTargetHandler(delegate_); |
102 } | 67 } |
103 | 68 |
104 Window::~Window() { | 69 Window::~Window() { |
70 // See comemnt in header as to why this is done. | |
sadrul
2016/10/26 04:25:55
*comment
sky
2016/10/26 16:25:21
Done.
| |
71 std::unique_ptr<WindowPort> port(port_); | |
72 | |
105 if (layer()->owner() == this) | 73 if (layer()->owner() == this) |
106 layer()->CompleteAllAnimations(); | 74 layer()->CompleteAllAnimations(); |
107 layer()->SuppressPaint(); | 75 layer()->SuppressPaint(); |
108 | 76 |
109 // Let the delegate know we're in the processing of destroying. | 77 // Let the delegate know we're in the processing of destroying. |
110 if (delegate_) | 78 if (delegate_) |
111 delegate_->OnWindowDestroying(this); | 79 delegate_->OnWindowDestroying(this); |
112 for (WindowObserver& observer : observers_) | 80 for (WindowObserver& observer : observers_) |
113 observer.OnWindowDestroying(this); | 81 observer.OnWindowDestroying(this); |
114 | 82 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 } | 131 } |
164 prop_map_.clear(); | 132 prop_map_.clear(); |
165 | 133 |
166 // The layer will either be destroyed by |layer_owner_|'s dtor, or by whoever | 134 // The layer will either be destroyed by |layer_owner_|'s dtor, or by whoever |
167 // acquired it. | 135 // acquired it. |
168 layer()->set_delegate(NULL); | 136 layer()->set_delegate(NULL); |
169 DestroyLayer(); | 137 DestroyLayer(); |
170 } | 138 } |
171 | 139 |
172 void Window::Init(ui::LayerType layer_type) { | 140 void Window::Init(ui::LayerType layer_type) { |
141 if (!port_) | |
142 port_ = Env::GetInstance()->CreateWindowPort(this).release(); | |
173 SetLayer(new ui::Layer(layer_type)); | 143 SetLayer(new ui::Layer(layer_type)); |
144 std::unique_ptr<WindowPortInitData> init_data = port_->Init(this); | |
174 layer()->SetVisible(false); | 145 layer()->SetVisible(false); |
175 layer()->set_delegate(this); | 146 layer()->set_delegate(this); |
176 UpdateLayerName(); | 147 UpdateLayerName(); |
177 layer()->SetFillsBoundsOpaquely(!transparent_); | 148 layer()->SetFillsBoundsOpaquely(!transparent_); |
178 Env::GetInstance()->NotifyWindowInitialized(this); | 149 Env::GetInstance()->NotifyWindowInitialized(this); |
150 port_->OnInitDone(std::move(init_data)); | |
179 } | 151 } |
180 | 152 |
181 void Window::SetType(ui::wm::WindowType type) { | 153 void Window::SetType(ui::wm::WindowType type) { |
182 // Cannot change type after the window is initialized. | 154 // Cannot change type after the window is initialized. |
183 DCHECK(!layer()); | 155 DCHECK(!layer()); |
184 type_ = type; | 156 type_ = type; |
185 } | 157 } |
186 | 158 |
187 void Window::SetName(const std::string& name) { | 159 void Window::SetName(const std::string& name) { |
188 name_ = name; | 160 name_ = name; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
366 DCHECK(child->layer()) << "Child has not been Init()ed yt."; | 338 DCHECK(child->layer()) << "Child has not been Init()ed yt."; |
367 WindowObserver::HierarchyChangeParams params; | 339 WindowObserver::HierarchyChangeParams params; |
368 params.target = child; | 340 params.target = child; |
369 params.new_parent = this; | 341 params.new_parent = this; |
370 params.old_parent = child->parent(); | 342 params.old_parent = child->parent(); |
371 params.phase = WindowObserver::HierarchyChangeParams::HIERARCHY_CHANGING; | 343 params.phase = WindowObserver::HierarchyChangeParams::HIERARCHY_CHANGING; |
372 NotifyWindowHierarchyChange(params); | 344 NotifyWindowHierarchyChange(params); |
373 | 345 |
374 Window* old_root = child->GetRootWindow(); | 346 Window* old_root = child->GetRootWindow(); |
375 | 347 |
348 port_->OnWillAddChild(child); | |
349 | |
376 DCHECK(std::find(children_.begin(), children_.end(), child) == | 350 DCHECK(std::find(children_.begin(), children_.end(), child) == |
377 children_.end()); | 351 children_.end()); |
378 if (child->parent()) | 352 if (child->parent()) |
379 child->parent()->RemoveChildImpl(child, this); | 353 child->parent()->RemoveChildImpl(child, this); |
380 | 354 |
381 child->parent_ = this; | 355 child->parent_ = this; |
382 layer()->Add(child->layer()); | 356 layer()->Add(child->layer()); |
383 | 357 |
384 children_.push_back(child); | 358 children_.push_back(child); |
385 if (layout_manager_) | 359 if (layout_manager_) |
(...skipping 13 matching lines...) Expand all Loading... | |
399 } | 373 } |
400 | 374 |
401 void Window::RemoveChild(Window* child) { | 375 void Window::RemoveChild(Window* child) { |
402 WindowObserver::HierarchyChangeParams params; | 376 WindowObserver::HierarchyChangeParams params; |
403 params.target = child; | 377 params.target = child; |
404 params.new_parent = NULL; | 378 params.new_parent = NULL; |
405 params.old_parent = this; | 379 params.old_parent = this; |
406 params.phase = WindowObserver::HierarchyChangeParams::HIERARCHY_CHANGING; | 380 params.phase = WindowObserver::HierarchyChangeParams::HIERARCHY_CHANGING; |
407 NotifyWindowHierarchyChange(params); | 381 NotifyWindowHierarchyChange(params); |
408 | 382 |
383 port_->OnWillRemoveChild(child); | |
409 RemoveChildImpl(child, NULL); | 384 RemoveChildImpl(child, NULL); |
410 | 385 |
411 params.phase = WindowObserver::HierarchyChangeParams::HIERARCHY_CHANGED; | 386 params.phase = WindowObserver::HierarchyChangeParams::HIERARCHY_CHANGED; |
412 NotifyWindowHierarchyChange(params); | 387 NotifyWindowHierarchyChange(params); |
413 } | 388 } |
414 | 389 |
415 bool Window::Contains(const Window* other) const { | 390 bool Window::Contains(const Window* other) const { |
416 for (const Window* parent = other; parent; parent = parent->parent_) { | 391 for (const Window* parent = other; parent; parent = parent->parent_) { |
417 if (parent == this) | 392 if (parent == this) |
418 return true; | 393 return true; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
510 | 485 |
511 Window* Window::GetEventHandlerForPoint(const gfx::Point& local_point) { | 486 Window* Window::GetEventHandlerForPoint(const gfx::Point& local_point) { |
512 return GetWindowForPoint(local_point, true, true); | 487 return GetWindowForPoint(local_point, true, true); |
513 } | 488 } |
514 | 489 |
515 Window* Window::GetTopWindowContainingPoint(const gfx::Point& local_point) { | 490 Window* Window::GetTopWindowContainingPoint(const gfx::Point& local_point) { |
516 return GetWindowForPoint(local_point, false, false); | 491 return GetWindowForPoint(local_point, false, false); |
517 } | 492 } |
518 | 493 |
519 Window* Window::GetToplevelWindow() { | 494 Window* Window::GetToplevelWindow() { |
495 // TODO: this may need to call to the WindowPort. For mus this may need to | |
496 // return for any top level. | |
520 Window* topmost_window_with_delegate = NULL; | 497 Window* topmost_window_with_delegate = NULL; |
521 for (aura::Window* window = this; window != NULL; window = window->parent()) { | 498 for (aura::Window* window = this; window != NULL; window = window->parent()) { |
522 if (window->delegate()) | 499 if (window->delegate()) |
523 topmost_window_with_delegate = window; | 500 topmost_window_with_delegate = window; |
524 } | 501 } |
525 return topmost_window_with_delegate; | 502 return topmost_window_with_delegate; |
526 } | 503 } |
527 | 504 |
528 void Window::Focus() { | 505 void Window::Focus() { |
529 client::FocusClient* client = client::GetFocusClient(this); | 506 client::FocusClient* client = client::GetFocusClient(this); |
(...skipping 19 matching lines...) Expand all Loading... | |
549 // The client may forbid certain windows from receiving focus at a given point | 526 // The client may forbid certain windows from receiving focus at a given point |
550 // in time. | 527 // in time. |
551 client::EventClient* client = client::GetEventClient(GetRootWindow()); | 528 client::EventClient* client = client::GetEventClient(GetRootWindow()); |
552 if (client && !client->CanProcessEventsWithinSubtree(this)) | 529 if (client && !client->CanProcessEventsWithinSubtree(this)) |
553 return false; | 530 return false; |
554 | 531 |
555 return parent_->CanFocus(); | 532 return parent_->CanFocus(); |
556 } | 533 } |
557 | 534 |
558 bool Window::CanReceiveEvents() const { | 535 bool Window::CanReceiveEvents() const { |
536 // TODO(sky): this may want to delegate to the WindowPort as for mus there | |
537 // isn't a point in descending into windows owned by the client. | |
559 if (IsRootWindow()) | 538 if (IsRootWindow()) |
560 return IsVisible(); | 539 return IsVisible(); |
561 | 540 |
562 // The client may forbid certain windows from receiving events at a given | 541 // The client may forbid certain windows from receiving events at a given |
563 // point in time. | 542 // point in time. |
564 client::EventClient* client = client::GetEventClient(GetRootWindow()); | 543 client::EventClient* client = client::GetEventClient(GetRootWindow()); |
565 if (client && !client->CanProcessEventsWithinSubtree(this)) | 544 if (client && !client->CanProcessEventsWithinSubtree(this)) |
566 return false; | 545 return false; |
567 | 546 |
568 return parent_ && IsVisible() && parent_->CanReceiveEvents(); | 547 return parent_ && IsVisible() && parent_->CanReceiveEvents(); |
(...skipping 27 matching lines...) Expand all Loading... | |
596 if (!root_window) | 575 if (!root_window) |
597 return false; | 576 return false; |
598 client::CaptureClient* capture_client = client::GetCaptureClient(root_window); | 577 client::CaptureClient* capture_client = client::GetCaptureClient(root_window); |
599 return capture_client && capture_client->GetCaptureWindow() == this; | 578 return capture_client && capture_client->GetCaptureWindow() == this; |
600 } | 579 } |
601 | 580 |
602 void Window::SuppressPaint() { | 581 void Window::SuppressPaint() { |
603 layer()->SuppressPaint(); | 582 layer()->SuppressPaint(); |
604 } | 583 } |
605 | 584 |
585 std::set<const void*> Window::GetAllPropertKeys() const { | |
586 std::set<const void*> keys; | |
587 for (auto& pair : prop_map_) | |
588 keys.insert(pair.first); | |
589 return keys; | |
590 } | |
591 | |
606 // {Set,Get,Clear}Property are implemented in window_property.h. | 592 // {Set,Get,Clear}Property are implemented in window_property.h. |
607 | 593 |
608 void Window::SetNativeWindowProperty(const char* key, void* value) { | 594 void Window::SetNativeWindowProperty(const char* key, void* value) { |
609 SetPropertyInternal(key, key, NULL, reinterpret_cast<int64_t>(value), 0); | 595 SetPropertyInternal(key, key, NULL, reinterpret_cast<int64_t>(value), 0); |
610 } | 596 } |
611 | 597 |
612 void* Window::GetNativeWindowProperty(const char* key) const { | 598 void* Window::GetNativeWindowProperty(const char* key) const { |
613 return reinterpret_cast<void*>(GetPropertyInternal(key, 0)); | 599 return reinterpret_cast<void*>(GetPropertyInternal(key, 0)); |
614 } | 600 } |
615 | 601 |
616 void Window::OnDeviceScaleFactorChanged(float device_scale_factor) { | 602 void Window::OnDeviceScaleFactorChanged(float device_scale_factor) { |
617 ScopedCursorHider hider(this); | 603 port_->OnDeviceScaleFactorChanged(device_scale_factor); |
618 if (delegate_) | |
619 delegate_->OnDeviceScaleFactorChanged(device_scale_factor); | |
620 } | 604 } |
621 | 605 |
622 #if !defined(NDEBUG) | 606 #if !defined(NDEBUG) |
623 std::string Window::GetDebugInfo() const { | 607 std::string Window::GetDebugInfo() const { |
624 return base::StringPrintf( | 608 return base::StringPrintf( |
625 "%s<%d> bounds(%d, %d, %d, %d) %s %s opacity=%.1f", | 609 "%s<%d> bounds(%d, %d, %d, %d) %s %s opacity=%.1f", |
626 name().empty() ? "Unknown" : name().c_str(), id(), | 610 name().empty() ? "Unknown" : name().c_str(), id(), |
627 bounds().x(), bounds().y(), bounds().width(), bounds().height(), | 611 bounds().x(), bounds().y(), bounds().width(), bounds().height(), |
628 visible_ ? "WindowVisible" : "WindowHidden", | 612 visible_ ? "WindowVisible" : "WindowHidden", |
629 layer() ? | 613 layer() ? |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
661 } | 645 } |
662 | 646 |
663 /////////////////////////////////////////////////////////////////////////////// | 647 /////////////////////////////////////////////////////////////////////////////// |
664 // Window, private: | 648 // Window, private: |
665 | 649 |
666 int64_t Window::SetPropertyInternal(const void* key, | 650 int64_t Window::SetPropertyInternal(const void* key, |
667 const char* name, | 651 const char* name, |
668 PropertyDeallocator deallocator, | 652 PropertyDeallocator deallocator, |
669 int64_t value, | 653 int64_t value, |
670 int64_t default_value) { | 654 int64_t default_value) { |
655 // This code may be called before |port_| has been created. | |
656 std::unique_ptr<WindowPortPropertyData> data = | |
657 port_ ? port_->OnWillChangeProperty(key) : nullptr; | |
671 int64_t old = GetPropertyInternal(key, default_value); | 658 int64_t old = GetPropertyInternal(key, default_value); |
672 if (value == default_value) { | 659 if (value == default_value) { |
673 prop_map_.erase(key); | 660 prop_map_.erase(key); |
674 } else { | 661 } else { |
675 Value prop_value; | 662 Value prop_value; |
676 prop_value.name = name; | 663 prop_value.name = name; |
677 prop_value.value = value; | 664 prop_value.value = value; |
678 prop_value.deallocator = deallocator; | 665 prop_value.deallocator = deallocator; |
679 prop_map_[key] = prop_value; | 666 prop_map_[key] = prop_value; |
680 } | 667 } |
668 if (port_) | |
669 port_->OnPropertyChanged(key, std::move(data)); | |
681 for (WindowObserver& observer : observers_) | 670 for (WindowObserver& observer : observers_) |
682 observer.OnWindowPropertyChanged(this, key, old); | 671 observer.OnWindowPropertyChanged(this, key, old); |
683 return old; | 672 return old; |
684 } | 673 } |
685 | 674 |
686 int64_t Window::GetPropertyInternal(const void* key, | 675 int64_t Window::GetPropertyInternal(const void* key, |
687 int64_t default_value) const { | 676 int64_t default_value) const { |
688 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); | 677 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); |
689 if (iter == prop_map_.end()) | 678 if (iter == prop_map_.end()) |
690 return default_value; | 679 return default_value; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
728 for (WindowObserver& observer : observers_) | 717 for (WindowObserver& observer : observers_) |
729 observer.OnWindowVisibilityChanging(this, visible); | 718 observer.OnWindowVisibilityChanging(this, visible); |
730 | 719 |
731 client::VisibilityClient* visibility_client = | 720 client::VisibilityClient* visibility_client = |
732 client::GetVisibilityClient(this); | 721 client::GetVisibilityClient(this); |
733 if (visibility_client) | 722 if (visibility_client) |
734 visibility_client->UpdateLayerVisibility(this, visible); | 723 visibility_client->UpdateLayerVisibility(this, visible); |
735 else | 724 else |
736 layer()->SetVisible(visible); | 725 layer()->SetVisible(visible); |
737 visible_ = visible; | 726 visible_ = visible; |
727 port_->OnVisibilityChanged(visible); | |
738 SchedulePaint(); | 728 SchedulePaint(); |
739 if (parent_ && parent_->layout_manager_) | 729 if (parent_ && parent_->layout_manager_) |
740 parent_->layout_manager_->OnChildWindowVisibilityChanged(this, visible); | 730 parent_->layout_manager_->OnChildWindowVisibilityChanged(this, visible); |
741 | 731 |
742 if (delegate_) | 732 if (delegate_) |
743 delegate_->OnWindowTargetVisibilityChanged(visible); | 733 delegate_->OnWindowTargetVisibilityChanged(visible); |
744 | 734 |
745 NotifyWindowVisibilityChanged(this, visible); | 735 NotifyWindowVisibilityChanged(this, visible); |
746 } | 736 } |
747 | 737 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
857 | 847 |
858 // Don't move the child if it is already in the right place. | 848 // Don't move the child if it is already in the right place. |
859 if ((direction == STACK_ABOVE && child_i == target_i + 1) || | 849 if ((direction == STACK_ABOVE && child_i == target_i + 1) || |
860 (direction == STACK_BELOW && child_i + 1 == target_i)) | 850 (direction == STACK_BELOW && child_i + 1 == target_i)) |
861 return; | 851 return; |
862 | 852 |
863 const size_t dest_i = | 853 const size_t dest_i = |
864 direction == STACK_ABOVE ? | 854 direction == STACK_ABOVE ? |
865 (child_i < target_i ? target_i : target_i + 1) : | 855 (child_i < target_i ? target_i : target_i + 1) : |
866 (child_i < target_i ? target_i - 1 : target_i); | 856 (child_i < target_i ? target_i - 1 : target_i); |
857 port_->OnWillMoveChild(child_i, dest_i); | |
867 children_.erase(children_.begin() + child_i); | 858 children_.erase(children_.begin() + child_i); |
868 children_.insert(children_.begin() + dest_i, child); | 859 children_.insert(children_.begin() + dest_i, child); |
869 | 860 |
870 StackChildLayerRelativeTo(child, target, direction); | 861 StackChildLayerRelativeTo(child, target, direction); |
871 | 862 |
872 child->OnStackingChanged(); | 863 child->OnStackingChanged(); |
873 } | 864 } |
874 | 865 |
875 void Window::StackChildLayerRelativeTo(Window* child, | 866 void Window::StackChildLayerRelativeTo(Window* child, |
876 Window* target, | 867 Window* target, |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1031 } | 1022 } |
1032 | 1023 |
1033 void Window::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) { | 1024 void Window::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) { |
1034 DCHECK(layer()); | 1025 DCHECK(layer()); |
1035 for (WindowObserver& observer : observers_) | 1026 for (WindowObserver& observer : observers_) |
1036 observer.OnDelegatedFrameDamage(this, damage_rect_in_dip); | 1027 observer.OnDelegatedFrameDamage(this, damage_rect_in_dip); |
1037 } | 1028 } |
1038 | 1029 |
1039 void Window::OnLayerBoundsChanged(const gfx::Rect& old_bounds) { | 1030 void Window::OnLayerBoundsChanged(const gfx::Rect& old_bounds) { |
1040 bounds_ = layer()->bounds(); | 1031 bounds_ = layer()->bounds(); |
1032 | |
1033 // Use |bounds_| as that is the bounds before any animations, which is what | |
1034 // mus wants. | |
1035 port_->OnDidChangeBounds(old_bounds, bounds_); | |
1036 | |
1041 if (layout_manager_) | 1037 if (layout_manager_) |
1042 layout_manager_->OnWindowResized(); | 1038 layout_manager_->OnWindowResized(); |
1043 if (delegate_) | 1039 if (delegate_) |
1044 delegate_->OnBoundsChanged(old_bounds, bounds_); | 1040 delegate_->OnBoundsChanged(old_bounds, bounds_); |
1045 for (auto& observer : observers_) | 1041 for (auto& observer : observers_) |
1046 observer.OnWindowBoundsChanged(this, old_bounds, bounds_); | 1042 observer.OnWindowBoundsChanged(this, old_bounds, bounds_); |
1047 } | 1043 } |
1048 | 1044 |
1049 bool Window::CanAcceptEvent(const ui::Event& event) { | 1045 bool Window::CanAcceptEvent(const ui::Event& event) { |
1050 // The client may forbid certain windows from receiving events at a given | 1046 // The client may forbid certain windows from receiving events at a given |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1105 layer_name = "Unnamed Window"; | 1101 layer_name = "Unnamed Window"; |
1106 | 1102 |
1107 if (id_ != -1) | 1103 if (id_ != -1) |
1108 layer_name += " " + base::IntToString(id_); | 1104 layer_name += " " + base::IntToString(id_); |
1109 | 1105 |
1110 layer()->set_name(layer_name); | 1106 layer()->set_name(layer_name); |
1111 #endif | 1107 #endif |
1112 } | 1108 } |
1113 | 1109 |
1114 } // namespace aura | 1110 } // namespace aura |
OLD | NEW |