Changeset 98582 in webkit


Ignore:
Timestamp:
Oct 27, 2011 8:43:37 AM (13 years ago)
Author:
Lucas Forschler
Message:

Merge 95534.

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  
     12011-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
    1302011-10-21  Lucas Forschler  <lforschler@apple.com>
    231
  • branches/safari-534.52-branch/Source/WebKit/mac/WebView/WebHTMLView.mm

    r92015 r98582  
    943943    [notificationCenter removeObserver:self name:NSWindowDidBecomeKeyNotification object:nil];
    944944    [notificationCenter removeObserver:self name:NSWindowDidResignKeyNotification object:nil];
     945    [notificationCenter removeObserver:self name:WKWindowWillOrderOnScreenNotification() object:window];
     946    [notificationCenter removeObserver:self name:WKWindowWillOrderOffScreenNotification() object:window];
    945947    [notificationCenter removeObserver:self name:NSWindowWillCloseNotification object:window];
    946948   
     
    28652867    [notificationCenter addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:nil];
    28662868    [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];
    28672871    [notificationCenter addObserver:self selector:@selector(windowWillClose:) name:NSWindowWillCloseNotification object:window];
    28682872   
     
    33573361        [_private->completionController endRevertingChange:NO moveLeft:NO];
    33583362    }
     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];
    33593387}
    33603388
  • branches/safari-534.52-branch/Source/WebKit/mac/WebView/WebView.mm

    r88285 r98582  
    33333333        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillOrderOnScreen:)
    33343334            name:WKWindowWillOrderOnScreenNotification() object:window];
     3335        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillOrderOffScreen:)
     3336            name:WKWindowWillOrderOffScreenNotification() object:window];           
    33353337    }
    33363338}
     
    33463348        [[NSNotificationCenter defaultCenter] removeObserver:self
    33473349            name:WKWindowWillOrderOnScreenNotification() object:window];
     3350        [[NSNotificationCenter defaultCenter] removeObserver:self
     3351            name:WKWindowWillOrderOffScreenNotification() object:window];
    33483352    }
    33493353}
     
    34123416- (void)_windowWillOrderOnScreen:(NSNotification *)notification
    34133417{
     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     
    34143423    if (![self shouldUpdateWhileOffscreen])
    34153424        [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];
    34163433}
    34173434
Note: See TracChangeset for help on using the changeset viewer.