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

Side by Side Diff: ui/views/cocoa/bridged_native_widget.mm

Issue 2577593002: MacViews: Be robust against Views manipulating Layers during Widget::Close(). (Closed)
Patch Set: selfnits Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "ui/views/cocoa/bridged_native_widget.h" 5 #import "ui/views/cocoa/bridged_native_widget.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 native_widget_mac_->GetWidget()->ReorderNativeViews(); 1039 native_widget_mac_->GetWidget()->ReorderNativeViews();
1040 } 1040 }
1041 1041
1042 void BridgedNativeWidget::ClearAssociationForView(const views::View* view) { 1042 void BridgedNativeWidget::ClearAssociationForView(const views::View* view) {
1043 auto it = associated_views_.find(view); 1043 auto it = associated_views_.find(view);
1044 DCHECK(it != associated_views_.end()); 1044 DCHECK(it != associated_views_.end());
1045 associated_views_.erase(it); 1045 associated_views_.erase(it);
1046 } 1046 }
1047 1047
1048 void BridgedNativeWidget::ReorderChildViews() { 1048 void BridgedNativeWidget::ReorderChildViews() {
1049 // Ignore layer manipulation during a Close(). This can be reached during the
1050 // orderOut: in Close(), which notifies visibility changes to Views.
1051 if (!bridged_view_)
1052 return;
1053
1049 RankMap rank; 1054 RankMap rank;
1050 Widget* widget = native_widget_mac_->GetWidget(); 1055 Widget* widget = native_widget_mac_->GetWidget();
1051 RankNSViews(widget->GetRootView(), associated_views_, &rank); 1056 RankNSViews(widget->GetRootView(), associated_views_, &rank);
1052 // Unassociated NSViews should be ordered above associated ones. The exception 1057 // Unassociated NSViews should be ordered above associated ones. The exception
1053 // is the UI compositor's superview, which should always be on the very 1058 // is the UI compositor's superview, which should always be on the very
1054 // bottom, so give it an explicit negative rank. 1059 // bottom, so give it an explicit negative rank.
1055 if (compositor_superview_) 1060 if (compositor_superview_)
1056 rank[compositor_superview_] = -1; 1061 rank[compositor_superview_] = -1;
1057 [bridged_view_ sortSubviewsUsingFunction:&SubviewSorter context:&rank]; 1062 [bridged_view_ sortSubviewsUsingFunction:&SubviewSorter context:&rank];
1058 } 1063 }
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 [bridged_view_ setMouseDownCanMoveWindow:draggable]; 1423 [bridged_view_ setMouseDownCanMoveWindow:draggable];
1419 // AppKit will not update its cache of mouseDownCanMoveWindow unless something 1424 // AppKit will not update its cache of mouseDownCanMoveWindow unless something
1420 // changes. Previously we tried adding an NSView and removing it, but for some 1425 // changes. Previously we tried adding an NSView and removing it, but for some
1421 // reason it required reposting the mouse-down event, and didn't always work. 1426 // reason it required reposting the mouse-down event, and didn't always work.
1422 // Calling the below seems to be an effective solution. 1427 // Calling the below seems to be an effective solution.
1423 [window_ setMovableByWindowBackground:NO]; 1428 [window_ setMovableByWindowBackground:NO];
1424 [window_ setMovableByWindowBackground:YES]; 1429 [window_ setMovableByWindowBackground:YES];
1425 } 1430 }
1426 1431
1427 } // namespace views 1432 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698