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

Unified Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm

Issue 299573002: [Mac] Improve modal sheet positioning during window resizing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « no previous file | chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm
index b4b4236df6f2d39bc7e8950a7e30da683a802a4b..92c02fcbab7b1e3e14b083ea42331cd5c1e498a5 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm
@@ -35,7 +35,7 @@ NSValue* GetKeyForParentWindow(NSWindow* parent_window) {
- (ConstrainedWindowSheetInfo*)
findSheetInfoForSheet:(id<ConstrainedWindowSheet>)sheet;
- (void)onParentWindowWillClose:(NSNotification*)note;
-- (void)onParentViewFrameDidChange:(NSNotification*)note;
+- (void)onParentWindowSizeDidChange:(NSNotification*)note;
- (void)updateSheetPosition:(NSView*)parentView;
- (NSRect)overlayWindowFrameForParentView:(NSView*)parentView;
- (NSPoint)originForSheetSize:(NSSize)sheetSize
@@ -130,13 +130,12 @@ NSValue* GetKeyForParentWindow(NSWindow* parent_window) {
if (!activeView_.get())
activeView_.reset([parentView retain]);
- // Observer the parent view's frame.
- [parentView setPostsFrameChangedNotifications:YES];
+ // Observe the parent window's size.
[[NSNotificationCenter defaultCenter]
addObserver:self
- selector:@selector(onParentViewFrameDidChange:)
- name:NSViewFrameDidChangeNotification
- object:parentView];
+ selector:@selector(onParentWindowSizeDidChange:)
+ name:NSWindowDidResizeNotification
+ object:parentWindow_];
// Create an invisible overlay window.
NSRect rect = [self overlayWindowFrameForParentView:parentView];
@@ -228,11 +227,8 @@ NSValue* GetKeyForParentWindow(NSWindow* parent_window) {
}
}
-- (void)onParentViewFrameDidChange:(NSNotification*)note {
- NSView* parentView = [note object];
- if (![activeView_ isEqual:parentView])
- return;
- [self updateSheetPosition:parentView];
+- (void)onParentWindowSizeDidChange:(NSNotification*)note {
+ [self updateSheetPosition:activeView_];
}
- (void)updateSheetPosition:(NSView*)parentView {
@@ -293,8 +289,8 @@ NSValue* GetKeyForParentWindow(NSWindow* parent_window) {
[[NSNotificationCenter defaultCenter]
removeObserver:self
- name:NSViewFrameDidChangeNotification
- object:[info parentView]];
+ name:NSWindowDidResizeNotification
+ object:parentWindow_];
[parentWindow_ removeChildWindow:[info overlayWindow]];
[[info sheet] closeSheetWithAnimation:withAnimation];
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698