Changeset 32874 in webkit
- Timestamp:
- May 5, 2008 9:34:03 AM (16 years ago)
- Location:
- trunk/WebKit/mac
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/mac/ChangeLog
r32852 r32874 1 2008-05-05 Darin Adler <darin@apple.com> 2 3 Reviewed by Mitz. 4 5 - https://bugs.webkit.org/show_bug.cgi?id=18789 6 fix some shouldCloseWithWindow edge cases 7 8 * WebView/WebView.mm: 9 (-[WebView viewWillMoveToWindow:]): Fix bug where we would stop observing the 10 NSWindowWillCloseNotification if the view was moved out of the window but still 11 had that window set as the host window. Also make sure this function doesn't do 12 anything if the WebView is already closed. 13 (-[WebView setHostWindow:]): Ditto. 14 1 15 2008-05-04 David Kilzer <ddkilzer@apple.com> 2 16 -
trunk/WebKit/mac/WebView/WebView.mm
r32750 r32874 2072 2072 - (void)viewWillMoveToWindow:(NSWindow *)window 2073 2073 { 2074 // Don't do anything if we aren't initialized. This happens when decoding a WebView. 2074 // Don't do anything if the WebView isn't initialized. 2075 // This happens when decoding a WebView in a nib. 2076 // FIXME: What sets up the observer of NSWindowWillCloseNotification in this case? 2075 2077 if (!_private) 2076 2078 return; 2077 2078 if ([self window]) 2079 2080 if (_private->closed) 2081 return; 2082 2083 if ([self window] && [self window] != [self hostWindow]) 2079 2084 [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:[self window]]; 2080 2085 … … 2082 2087 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillClose:) name:NSWindowWillCloseNotification object:window]; 2083 2088 2084 // Ensure that we will receive the events that WebHTMLView (at least) needs. It's expensive enough 2085 // that we don't want to call it over and over. 2089 // Ensure that we will receive the events that WebHTMLView (at least) needs. 2090 // The following are expensive enough that we don't want to call them over 2091 // and over, so do them when we move into a window. 2086 2092 [window setAcceptsMouseMovedEvents:YES]; 2087 2093 WKSetNSWindowShouldPostEventNotifications(window, YES); … … 2481 2487 - (void)setHostWindow:(NSWindow *)hostWindow 2482 2488 { 2483 if (!_private->closed && hostWindow != _private->hostWindow) { 2484 Frame* coreFrame = core([self mainFrame]); 2485 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) 2486 [[[kit(frame) frameView] documentView] viewWillMoveToHostWindow:hostWindow]; 2487 if (_private->hostWindow) 2488 [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:_private->hostWindow]; 2489 if (hostWindow) 2490 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillClose:) name:NSWindowWillCloseNotification object:hostWindow]; 2491 [_private->hostWindow release]; 2492 _private->hostWindow = [hostWindow retain]; 2493 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) 2494 [[[kit(frame) frameView] documentView] viewDidMoveToHostWindow]; 2495 } 2489 if (_private->closed) 2490 return; 2491 if (hostWindow == _private->hostWindow) 2492 return; 2493 2494 Frame* coreFrame = core([self mainFrame]); 2495 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) 2496 [[[kit(frame) frameView] documentView] viewWillMoveToHostWindow:hostWindow]; 2497 if (_private->hostWindow && [self window] != _private->hostWindow) 2498 [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:_private->hostWindow]; 2499 if (hostWindow) 2500 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillClose:) name:NSWindowWillCloseNotification object:hostWindow]; 2501 [_private->hostWindow release]; 2502 _private->hostWindow = [hostWindow retain]; 2503 for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) 2504 [[[kit(frame) frameView] documentView] viewDidMoveToHostWindow]; 2496 2505 } 2497 2506
Note: See TracChangeset
for help on using the changeset viewer.