Changeset 95534 in webkit
- Timestamp:
- Sep 20, 2011 6:37:35 AM (13 years ago)
- Location:
- trunk/Source/WebKit/mac
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/mac/ChangeLog
r95513 r95534 1 2011-09-19 Timothy Hatcher <timothy@apple.com> 2 3 Make WebViews in NSPopovers render as they would in active windows. 4 5 The NSWindowDid{Become,Resign}KeyNotifications are not fired when NSPopovers 6 are shown or hidden since they share key with the parent window. So WebView 7 and WebHTMLView need to also observe the will order on/off screen notifications. 8 9 https://webkit.org/b/68402 10 rdar://problem/9754099 11 12 Reviewed by John Sullivan. 13 14 * WebView/WebHTMLView.mm: 15 (-[WebHTMLView _removeWindowObservers]): Remove order on/off screen notification obversers. 16 (-[WebHTMLView addWindowObservers]): Add order on/off screen notification obversers. 17 (-[WebHTMLView windowWillOrderOnScreen:]): Check if the window is already a key window, 18 which can be the case for NSPopovers. 19 (-[WebHTMLView windowWillOrderOffScreen:]): Remove the mouse moved observer. 20 * WebView/WebView.mm: 21 (-[WebView addWindowObserversForWindow:]): Add order off screen notification obverser. 22 (-[WebView removeWindowObservers]): Remove order off screen notification obverser. 23 (-[WebView _windowWillOrderOnScreen:]): Call _updateActiveState. 24 (-[WebView _windowWillOrderOffScreen:]): Ditto. 25 1 26 2011-09-19 Mark Rowe <mrowe@apple.com> 2 27 -
trunk/Source/WebKit/mac/WebView/WebHTMLView.mm
r95476 r95534 933 933 [notificationCenter removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil]; 934 934 [notificationCenter removeObserver:self name:NSWindowDidResignKeyNotification object:nil]; 935 [notificationCenter removeObserver:self name:WKWindowWillOrderOnScreenNotification() object:window]; 936 [notificationCenter removeObserver:self name:WKWindowWillOrderOffScreenNotification() object:window]; 935 937 [notificationCenter removeObserver:self name:NSWindowWillCloseNotification object:window]; 936 938 … … 2860 2862 [notificationCenter addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:nil]; 2861 2863 [notificationCenter addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:nil]; 2864 [notificationCenter addObserver:self selector:@selector(windowWillOrderOnScreen:) name:WKWindowWillOrderOnScreenNotification() object:window]; 2865 [notificationCenter addObserver:self selector:@selector(windowWillOrderOffScreen:) name:WKWindowWillOrderOffScreenNotification() object:window]; 2862 2866 [notificationCenter addObserver:self selector:@selector(windowWillClose:) name:NSWindowWillCloseNotification object:window]; 2863 2867 … … 3377 3381 [_private->completionController endRevertingChange:NO moveLeft:NO]; 3378 3382 } 3383 } 3384 3385 - (void)windowWillOrderOnScreen:(NSNotification *)notification 3386 { 3387 if (!pthread_main_np()) { 3388 [self performSelectorOnMainThread:_cmd withObject:notification waitUntilDone:NO]; 3389 return; 3390 } 3391 3392 // Check if the window is already a key window, which can be the case for NSPopovers. 3393 if ([[self window] isKeyWindow]) 3394 [self addMouseMovedObserver]; 3395 } 3396 3397 - (void)windowWillOrderOffScreen:(NSNotification *)notification 3398 { 3399 if (!pthread_main_np()) { 3400 [self performSelectorOnMainThread:_cmd withObject:notification waitUntilDone:NO]; 3401 return; 3402 } 3403 3404 // When the WebView is in a NSPopover the NSWindowDidResignKeyNotification isn't sent 3405 // unless the parent window loses key. So we need to remove the mouse moved observer. 3406 [self removeMouseMovedObserver]; 3379 3407 } 3380 3408 -
trunk/Source/WebKit/mac/WebView/WebView.mm
r95474 r95534 3195 3195 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillOrderOnScreen:) 3196 3196 name:WKWindowWillOrderOnScreenNotification() object:window]; 3197 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillOrderOffScreen:) 3198 name:WKWindowWillOrderOffScreenNotification() object:window]; 3197 3199 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeResolution:) 3198 3200 name:windowDidChangeResolutionNotification object:window]; … … 3210 3212 [[NSNotificationCenter defaultCenter] removeObserver:self 3211 3213 name:WKWindowWillOrderOnScreenNotification() object:window]; 3214 [[NSNotificationCenter defaultCenter] removeObserver:self 3215 name:WKWindowWillOrderOffScreenNotification() object:window]; 3212 3216 [[NSNotificationCenter defaultCenter] removeObserver:self 3213 3217 name:windowDidChangeResolutionNotification object:window]; … … 3280 3284 - (void)_windowWillOrderOnScreen:(NSNotification *)notification 3281 3285 { 3286 // Update the active state here so WebViews in NSPopovers get the active state. 3287 // This is needed because the normal NSWindowDidBecomeKeyNotification is not fired 3288 // for NSPopover windows since they share key with their parent window. 3289 [self _updateActiveState]; 3290 3282 3291 if (![self shouldUpdateWhileOffscreen]) 3283 3292 [self setNeedsDisplay:YES]; 3293 } 3294 3295 - (void)_windowWillOrderOffScreen:(NSNotification *)notification 3296 { 3297 // Update the active state here so WebViews in NSPopovers get the inactive state. 3298 // This is needed because the normal NSWindowDidResignKeyNotification is not fired 3299 // for NSPopover windows since they share key with their parent window. 3300 [self _updateActiveState]; 3284 3301 } 3285 3302
Note: See TracChangeset
for help on using the changeset viewer.