Changeset 98582 in webkit
- Timestamp:
- Oct 27, 2011 8:43:37 AM (13 years ago)
- Location:
- branches/safari-534.52-branch/Source/WebKit/mac
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-534.52-branch/Source/WebKit/mac/ChangeLog
r98170 r98582 1 2011-10-27 Lucas Forschler <lforschler@apple.com> 2 3 Merge 95534 4 5 2011-09-19 Timothy Hatcher <timothy@apple.com> 6 7 Make WebViews in NSPopovers render as they would in active windows. 8 9 The NSWindowDid{Become,Resign}KeyNotifications are not fired when NSPopovers 10 are shown or hidden since they share key with the parent window. So WebView 11 and WebHTMLView need to also observe the will order on/off screen notifications. 12 13 https://webkit.org/b/68402 14 rdar://problem/9754099 15 16 Reviewed by John Sullivan. 17 18 * WebView/WebHTMLView.mm: 19 (-[WebHTMLView _removeWindowObservers]): Remove order on/off screen notification obversers. 20 (-[WebHTMLView addWindowObservers]): Add order on/off screen notification obversers. 21 (-[WebHTMLView windowWillOrderOnScreen:]): Check if the window is already a key window, 22 which can be the case for NSPopovers. 23 (-[WebHTMLView windowWillOrderOffScreen:]): Remove the mouse moved observer. 24 * WebView/WebView.mm: 25 (-[WebView addWindowObserversForWindow:]): Add order off screen notification obverser. 26 (-[WebView removeWindowObservers]): Remove order off screen notification obverser. 27 (-[WebView _windowWillOrderOnScreen:]): Call _updateActiveState. 28 (-[WebView _windowWillOrderOffScreen:]): Ditto. 29 1 30 2011-10-21 Lucas Forschler <lforschler@apple.com> 2 31 -
branches/safari-534.52-branch/Source/WebKit/mac/WebView/WebHTMLView.mm
r92015 r98582 943 943 [notificationCenter removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil]; 944 944 [notificationCenter removeObserver:self name:NSWindowDidResignKeyNotification object:nil]; 945 [notificationCenter removeObserver:self name:WKWindowWillOrderOnScreenNotification() object:window]; 946 [notificationCenter removeObserver:self name:WKWindowWillOrderOffScreenNotification() object:window]; 945 947 [notificationCenter removeObserver:self name:NSWindowWillCloseNotification object:window]; 946 948 … … 2865 2867 [notificationCenter addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:nil]; 2866 2868 [notificationCenter addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:nil]; 2869 [notificationCenter addObserver:self selector:@selector(windowWillOrderOnScreen:) name:WKWindowWillOrderOnScreenNotification() object:window]; 2870 [notificationCenter addObserver:self selector:@selector(windowWillOrderOffScreen:) name:WKWindowWillOrderOffScreenNotification() object:window]; 2867 2871 [notificationCenter addObserver:self selector:@selector(windowWillClose:) name:NSWindowWillCloseNotification object:window]; 2868 2872 … … 3357 3361 [_private->completionController endRevertingChange:NO moveLeft:NO]; 3358 3362 } 3363 } 3364 3365 - (void)windowWillOrderOnScreen:(NSNotification *)notification 3366 { 3367 if (!pthread_main_np()) { 3368 [self performSelectorOnMainThread:_cmd withObject:notification waitUntilDone:NO]; 3369 return; 3370 } 3371 3372 // Check if the window is already a key window, which can be the case for NSPopovers. 3373 if ([[self window] isKeyWindow]) 3374 [self addMouseMovedObserver]; 3375 } 3376 3377 - (void)windowWillOrderOffScreen:(NSNotification *)notification 3378 { 3379 if (!pthread_main_np()) { 3380 [self performSelectorOnMainThread:_cmd withObject:notification waitUntilDone:NO]; 3381 return; 3382 } 3383 3384 // When the WebView is in a NSPopover the NSWindowDidResignKeyNotification isn't sent 3385 // unless the parent window loses key. So we need to remove the mouse moved observer. 3386 [self removeMouseMovedObserver]; 3359 3387 } 3360 3388 -
branches/safari-534.52-branch/Source/WebKit/mac/WebView/WebView.mm
r88285 r98582 3333 3333 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillOrderOnScreen:) 3334 3334 name:WKWindowWillOrderOnScreenNotification() object:window]; 3335 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillOrderOffScreen:) 3336 name:WKWindowWillOrderOffScreenNotification() object:window]; 3335 3337 } 3336 3338 } … … 3346 3348 [[NSNotificationCenter defaultCenter] removeObserver:self 3347 3349 name:WKWindowWillOrderOnScreenNotification() object:window]; 3350 [[NSNotificationCenter defaultCenter] removeObserver:self 3351 name:WKWindowWillOrderOffScreenNotification() object:window]; 3348 3352 } 3349 3353 } … … 3412 3416 - (void)_windowWillOrderOnScreen:(NSNotification *)notification 3413 3417 { 3418 // Update the active state here so WebViews in NSPopovers get the active state. 3419 // This is needed because the normal NSWindowDidBecomeKeyNotification is not fired 3420 // for NSPopover windows since they share key with their parent window. 3421 [self _updateActiveState]; 3422 3414 3423 if (![self shouldUpdateWhileOffscreen]) 3415 3424 [self setNeedsDisplay:YES]; 3425 } 3426 3427 - (void)_windowWillOrderOffScreen:(NSNotification *)notification 3428 { 3429 // Update the active state here so WebViews in NSPopovers get the inactive state. 3430 // This is needed because the normal NSWindowDidResignKeyNotification is not fired 3431 // for NSPopover windows since they share key with their parent window. 3432 [self _updateActiveState]; 3416 3433 } 3417 3434
Note: See TracChangeset
for help on using the changeset viewer.