Changeset 13431 in webkit


Ignore:
Timestamp:
Mar 21, 2006 8:59:58 PM (18 years ago)
Author:
darin
Message:
  • WebView/WebHTMLView.m: (-[WebHTMLView _updateFocusState]): Treat window as having focus if its sheet is key. (-[WebHTMLView addWindowObservers]): Observe all focus notifications, not just the ones involving this window. (-[WebHTMLView removeWindowObservers]): Ditto. (-[WebHTMLView windowDidBecomeKey:]): Add checks so that we call the methods only when appropriate, since this will now be called for all windows. (-[WebHTMLView windowDidResignKey:]): Ditto.
Location:
trunk/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/ChangeLog

    r13427 r13431  
     12006-03-21  Darin Adler  <darin@apple.com>
     2
     3        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=3784
     4          <rdar://problem/4483827> JavaScript save dialog disappears right away (sheet triggers blur event) (3784)
     5
     6        * WebView/WebHTMLView.m:
     7        (-[WebHTMLView _updateFocusState]): Treat window as having focus if its sheet is key.
     8        (-[WebHTMLView addWindowObservers]): Observe all focus notifications, not just the ones involving this window.
     9        (-[WebHTMLView removeWindowObservers]): Ditto.
     10        (-[WebHTMLView windowDidBecomeKey:]): Add checks so that we call the methods only when appropriate,
     11        since this will now be called for all windows.
     12        (-[WebHTMLView windowDidResignKey:]): Ditto.
     13
    1142006-03-21  Adele Peterson  <adele@apple.com>
    215
  • trunk/WebKit/WebView/WebHTMLView.m

    r13427 r13431  
    11/*
    2  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2005, 2006 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    16241624    // so we can send focus and blur events.
    16251625
    1626     BOOL windowIsKey = [[self window] isKeyWindow];
     1626    NSWindow *window = [self window];
     1627    BOOL windowIsKey = [window isKeyWindow];
     1628    BOOL windowOrSheetIsKey = windowIsKey || [[window attachedSheet] isKeyWindow];
     1629
    16271630    BOOL displaysWithFocusAttributes = !_private->resigningFirstResponder && windowIsKey && [self _web_firstResponderCausesFocusDisplay];
    16281631   
    1629     [[self _bridge] setWindowHasFocus:windowIsKey];
     1632    [[self _bridge] setWindowHasFocus:windowOrSheetIsKey];
    16301633    [[self _bridge] setDisplaysWithFocusAttributes:displaysWithFocusAttributes];
    16311634}
     
    21402143    if (window) {
    21412144        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeKey:)
    2142             name:NSWindowDidBecomeKeyNotification object:window];
     2145            name:NSWindowDidBecomeKeyNotification object:nil];
    21432146        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidResignKey:)
    2144             name:NSWindowDidResignKeyNotification object:window];
     2147            name:NSWindowDidResignKeyNotification object:nil];
    21452148        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowWillClose:)
    21462149            name:NSWindowWillCloseNotification object:window];
     
    21532156    if (window) {
    21542157        [[NSNotificationCenter defaultCenter] removeObserver:self
    2155             name:NSWindowDidBecomeKeyNotification object:window];
     2158            name:NSWindowDidBecomeKeyNotification object:nil];
    21562159        [[NSNotificationCenter defaultCenter] removeObserver:self
    2157             name:NSWindowDidResignKeyNotification object:window];
     2160            name:NSWindowDidResignKeyNotification object:nil];
    21582161        [[NSNotificationCenter defaultCenter] removeObserver:self
    21592162            name:NSWindowWillCloseNotification object:window];
     
    25572560- (void)windowDidBecomeKey:(NSNotification *)notification
    25582561{
    2559     ASSERT([notification object] == [self window]);
    2560     [self addMouseMovedObserver];
    2561     [self _updateFocusState];
    2562 }
    2563 
    2564 - (void)windowDidResignKey: (NSNotification *)notification
    2565 {
    2566     ASSERT([notification object] == [self window]);
    2567     [_private->compController endRevertingChange:NO moveLeft:NO];
    2568     [self removeMouseMovedObserver];
    2569     [self _updateFocusState];
     2562    NSWindow *keyWindow = [notification object];
     2563
     2564    if (keyWindow == [self window])
     2565        [self addMouseMovedObserver];
     2566
     2567    if (keyWindow == [self window] || keyWindow == [[self window] attachedSheet])
     2568        [self _updateFocusState];
     2569}
     2570
     2571- (void)windowDidResignKey:(NSNotification *)notification
     2572{
     2573    NSWindow *formerKeyWindow = [notification object];
     2574
     2575    if (formerKeyWindow == [self window])
     2576        [self removeMouseMovedObserver];
     2577
     2578    if (formerKeyWindow == [self window] || formerKeyWindow == [[self window] attachedSheet]) {
     2579        [self _updateFocusState];
     2580        [_private->compController endRevertingChange:NO moveLeft:NO];
     2581    }
    25702582}
    25712583
Note: See TracChangeset for help on using the changeset viewer.