Changeset 30939 in webkit


Ignore:
Timestamp:
Mar 10, 2008 10:37:19 AM (16 years ago)
Author:
Darin Adler
Message:

WebCore:

Reviewed by Sam.

  • eliminate keyboard UI mode method from WebCoreFrameBridge
  • page/ChromeClient.h: Added keyboardUIMode function. (WebCore::ChromeClient::keyboardUIMode): Ditto.
  • page/mac/EventHandlerMac.mm: (WebCore::EventHandler::tabsToAllControls): Call chrome client function instead of bridge function.
  • page/mac/WebCoreFrameBridge.h: Removed keyboardUIMode method, and other unused ones.
  • WebCore.xcodeproj/project.pbxproj: Allowed Xcode to change the project. Do not try to fight the Xcode.

WebKit/mac:

Reviewed by Sam.

  • eliminate keyboard UI mode method from WebCoreFrameBridge
  • WebCoreSupport/WebChromeClient.h: Added keyboardUIMode function.
  • WebCoreSupport/WebChromeClient.mm: (WebChromeClient::keyboardUIMode): Ditto. Calls WebView.
  • WebCoreSupport/WebFrameBridge.h: Removed unused things, including the fields for keyboard UI mode.
  • WebCoreSupport/WebFrameBridge.mm: (-[WebFrameBridge dealloc]): Removed unneeded code; eliminated the fini method. (-[WebFrameBridge finalize]): Ditto.
  • WebView/WebView.mm: Moved the keyboard mode code in here. (-[WebView _close]): Remove observer from the distributed notification center as well as the normal one. (-[WebView _retrieveKeyboardUIModeFromPreferences:]): Added. Code moved here from the bridge. (-[WebView _keyboardUIMode]): Ditto.
  • WebView/WebViewInternal.h: Added _keyboardUIMode method.
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r30937 r30939  
     12008-03-10  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam.
     4
     5        - eliminate keyboard UI mode method from WebCoreFrameBridge
     6
     7        * page/ChromeClient.h: Added keyboardUIMode function.
     8        (WebCore::ChromeClient::keyboardUIMode): Ditto.
     9        * page/mac/EventHandlerMac.mm:
     10        (WebCore::EventHandler::tabsToAllControls): Call chrome client function instead
     11        of bridge function.
     12        * page/mac/WebCoreFrameBridge.h: Removed keyboardUIMode method, and other unused
     13        ones.
     14
     15        * WebCore.xcodeproj/project.pbxproj: Allowed Xcode to change the project.
     16        Do not try to fight the Xcode.
     17
    1182008-03-10  Darin Adler  <darin@apple.com>
    219
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r30923 r30939  
    86908690                                9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */,
    86918691                                9302B0BE0D79F82C00C7EE83 /* PageGroup.h */,
    8692                                 65D1C1C909932B22000CB324 /* Plugin.h */,
    86938692                                BCEC01BA0C274DAC009F4EC9 /* Screen.cpp */,
    86948693                                BCEC01BB0C274DAC009F4EC9 /* Screen.h */,
  • trunk/WebCore/page/ChromeClient.h

    r30900 r30939  
    2626#include <wtf/Vector.h>
    2727
    28 typedef class _jobject* jobject;
     28#if PLATFORM(MAC)
     29#include "WebCoreKeyboardUIMode.h"
     30#endif
    2931
    3032#ifndef __OBJC__
    3133class NSMenu;
    3234class NSResponder;
    33 class NSView;
    3435#endif
    3536
     
    124125        virtual void populateVisitedLinks();
    125126
    126 #if PLATFORM(MAC)
    127         virtual void runOpenPanel(PassRefPtr<FileChooser>);
    128 #endif
    129 
    130127        virtual FloatRect customHighlightRect(Node*, const AtomicString& type, const FloatRect& lineRect);
    131128        virtual void paintCustomHighlight(Node*, const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect,
    132129            bool behindText, bool entireLine);
     130
     131#if PLATFORM(MAC)
     132        virtual void runOpenPanel(PassRefPtr<FileChooser>);
     133
     134        virtual KeyboardUIMode keyboardUIMode() { return KeyboardAccessDefault; }
     135#endif
    133136
    134137    protected:
  • trunk/WebCore/page/mac/EventHandlerMac.mm

    r30742 r30939  
    2828
    2929#include "BlockExceptions.h"
     30#include "ChromeClient.h"
    3031#include "ClipboardMac.h"
    3132#include "EventNames.h"
     
    106107bool EventHandler::tabsToAllControls(KeyboardEvent* event) const
    107108{
    108     KeyboardUIMode keyboardUIMode = [m_frame->bridge() keyboardUIMode];
     109    Page* page = m_frame->page();
     110    if (!page)
     111        return false;
     112
     113    KeyboardUIMode keyboardUIMode = page->chrome()->client()->keyboardUIMode();
    109114    bool handlingOptionTab = isKeyboardOptionTab(event);
    110115
  • trunk/WebCore/page/mac/WebCoreFrameBridge.h

    r30935 r30939  
    179179- (void)willPopupMenu:(NSMenu *)menu;
    180180
    181 - (WebCore::KeyboardUIMode)keyboardUIMode;
    182 
    183181@end
    184182
  • trunk/WebKit/mac/ChangeLog

    r30935 r30939  
     12008-03-10  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam.
     4
     5        - eliminate keyboard UI mode method from WebCoreFrameBridge
     6
     7        * WebCoreSupport/WebChromeClient.h: Added keyboardUIMode function.
     8        * WebCoreSupport/WebChromeClient.mm:
     9        (WebChromeClient::keyboardUIMode): Ditto. Calls WebView.
     10        * WebCoreSupport/WebFrameBridge.h: Removed unused things, including the
     11        fields for keyboard UI mode.
     12        * WebCoreSupport/WebFrameBridge.mm:
     13        (-[WebFrameBridge dealloc]): Removed unneeded code; eliminated the fini
     14        method.
     15        (-[WebFrameBridge finalize]): Ditto.
     16        * WebView/WebView.mm: Moved the keyboard mode code in here.
     17        (-[WebView _close]): Remove observer from the distributed notification
     18        center as well as the normal one.
     19        (-[WebView _retrieveKeyboardUIModeFromPreferences:]): Added. Code moved
     20        here from the bridge.
     21        (-[WebView _keyboardUIMode]): Ditto.
     22        * WebView/WebViewInternal.h: Added _keyboardUIMode method.
     23
    1242008-03-10  Darin Adler  <darin@apple.com>
    225
  • trunk/WebKit/mac/WebCoreSupport/WebChromeClient.h

    r30900 r30939  
    115115        bool behindText, bool entireLine);
    116116
     117    virtual WebCore::KeyboardUIMode keyboardUIMode();
     118
    117119private:
    118120    WebView *m_webView;
  • trunk/WebKit/mac/WebCoreSupport/WebChromeClient.mm

    r30935 r30939  
    487487}
    488488
     489KeyboardUIMode WebChromeClient::keyboardUIMode()
     490{
     491    return [m_webView _keyboardUIMode];
     492}
     493
    489494@implementation WebOpenPanelResultListener
    490495
  • trunk/WebKit/mac/WebCoreSupport/WebFrameBridge.h

    r30741 r30939  
    3737@class WebFrameView;
    3838
    39 @protocol WebOpenPanelResultListener;
    40 
    4139@interface WebFrameBridge : WebCoreFrameBridge <WebCoreFrameBridge> {
    4240@public
    4341    WebFrame *_frame;
    44 
    45 @private
    46     WebCore::KeyboardUIMode _keyboardUIMode;
    47     BOOL _keyboardUIModeAccessed;
    4842}
    49 
    5043- (id)initMainFrameWithPage:(WebCore::Page*)page frameName:(const WebCore::String&)name frameView:(WebFrameView *)frameView;
    5144- (id)initSubframeWithOwnerElement:(WebCore::HTMLFrameOwnerElement*)ownerElement frameName:(const WebCore::String&)name frameView:(WebFrameView *)frameView;
    5245- (void)close;
    53 
    5446- (WebFrame *)webFrame;
    55 
    5647@end
  • trunk/WebKit/mac/WebCoreSupport/WebFrameBridge.mm

    r30935 r30939  
    103103using namespace WebCore;
    104104
    105 #define KeyboardUIModeDidChangeNotification @"com.apple.KeyboardUIModeDidChange"
    106 #define AppleKeyboardUIMode CFSTR("AppleKeyboardUIMode")
    107 #define UniversalAccessDomain CFSTR("com.apple.universalaccess")
    108 
    109105@implementation WebFrameBridge
    110106
     
    154150}
    155151
    156 - (void)fini
    157 {
    158     if (_keyboardUIModeAccessed) {
    159         [[NSDistributedNotificationCenter defaultCenter]
    160             removeObserver:self name:KeyboardUIModeDidChangeNotification object:nil];
    161         [[NSNotificationCenter defaultCenter]
    162             removeObserver:self name:WebPreferencesChangedNotification object:nil];
    163     }
    164 
     152- (void)dealloc
     153{
    165154    ASSERT(_frame == nil);
    166155    --WebBridgeCount;
    167 }
    168 
    169 - (void)dealloc
    170 {
    171     [_frame release];
    172    
    173     [self fini];
    174156    [super dealloc];
    175157}
     
    177159- (void)finalize
    178160{
    179     ASSERT_MAIN_THREAD();
    180     [self fini];
     161    ASSERT(_frame == nil);
     162    --WebBridgeCount;
    181163    [super finalize];
    182164}
    183165
    184 - (WebPreferences *)_preferences
    185 {
    186     return [[self webView] preferences];
    187 }
    188 
    189 - (void)_retrieveKeyboardUIModeFromPreferences:(NSNotification *)notification
    190 {
    191     CFPreferencesAppSynchronize(UniversalAccessDomain);
    192 
    193     Boolean keyExistsAndHasValidFormat;
    194     int mode = CFPreferencesGetAppIntegerValue(AppleKeyboardUIMode, UniversalAccessDomain, &keyExistsAndHasValidFormat);
    195    
    196     // The keyboard access mode is reported by two bits:
    197     // Bit 0 is set if feature is on
    198     // Bit 1 is set if full keyboard access works for any control, not just text boxes and lists
    199     // We require both bits to be on.
    200     // I do not know that we would ever get one bit on and the other off since
    201     // checking the checkbox in system preferences which is marked as "Turn on full keyboard access"
    202     // turns on both bits.
    203     _keyboardUIMode = (mode & 0x2) ? KeyboardAccessFull : KeyboardAccessDefault;
    204    
    205     // check for tabbing to links
    206     if ([[self _preferences] tabsToLinks])
    207         _keyboardUIMode = (KeyboardUIMode)(_keyboardUIMode | KeyboardAccessTabsToLinks);
    208 }
    209 
    210 - (KeyboardUIMode)keyboardUIMode
    211 {
    212     if (!_keyboardUIModeAccessed) {
    213         _keyboardUIModeAccessed = YES;
    214         [self _retrieveKeyboardUIModeFromPreferences:nil];
    215        
    216         [[NSDistributedNotificationCenter defaultCenter]
    217             addObserver:self selector:@selector(_retrieveKeyboardUIModeFromPreferences:)
    218             name:KeyboardUIModeDidChangeNotification object:nil];
    219 
    220         [[NSNotificationCenter defaultCenter]
    221             addObserver:self selector:@selector(_retrieveKeyboardUIModeFromPreferences:)
    222                    name:WebPreferencesChangedNotification object:nil];
    223     }
    224     return _keyboardUIMode;
    225 }
    226 
    227166- (WebFrame *)webFrame
    228167{
    229168    return _frame;
    230 }
    231 
    232 - (WebCoreFrameBridge *)mainFrame
    233 {
    234     ASSERT(_frame != nil);
    235     return [[[self webView] mainFrame] _bridge];
    236169}
    237170
     
    255188}
    256189
    257 - (WebDataSource *)dataSource
    258 {
    259     ASSERT(_frame != nil);
    260     WebDataSource *dataSource = [_frame _dataSource];
    261 
    262     ASSERT(dataSource != nil);
    263 
    264     return dataSource;
    265 }
    266 
    267190- (void)close
    268191{
  • trunk/WebKit/mac/WebView/WebView.mm

    r30923 r30939  
    261261#define WebKitOriginalBottomPrintingMarginKey @"WebKitOriginalBottomMargin"
    262262
     263#define KeyboardUIModeDidChangeNotification @"com.apple.KeyboardUIModeDidChange"
     264#define AppleKeyboardUIMode CFSTR("AppleKeyboardUIMode")
     265#define UniversalAccessDomain CFSTR("com.apple.universalaccess")
     266
    263267static BOOL s_didSetCacheModel;
    264268static WebCacheModel s_cacheModel = WebCacheModelDocumentViewer;
     
    294298@end
    295299
    296 @interface WebViewPrivate : NSObject
    297 {
     300@interface WebViewPrivate : NSObject {
    298301@public
    299302    Page* page;
     
    365368   
    366369    HashMap<unsigned long, RetainPtr<id> >* identifierMap;
     370
     371    BOOL _keyboardUIModeAccessed;
     372    KeyboardUIMode _keyboardUIMode;
    367373}
    368374@end
     
    721727    }
    722728   
     729    [[NSDistributedNotificationCenter defaultCenter] removeObserver:self];
    723730    [[NSNotificationCenter defaultCenter] removeObserver:self];
    724731
     
    41854192}
    41864193
     4194- (void)_retrieveKeyboardUIModeFromPreferences:(NSNotification *)notification
     4195{
     4196    CFPreferencesAppSynchronize(UniversalAccessDomain);
     4197
     4198    Boolean keyExistsAndHasValidFormat;
     4199    int mode = CFPreferencesGetAppIntegerValue(AppleKeyboardUIMode, UniversalAccessDomain, &keyExistsAndHasValidFormat);
     4200   
     4201    // The keyboard access mode is reported by two bits:
     4202    // Bit 0 is set if feature is on
     4203    // Bit 1 is set if full keyboard access works for any control, not just text boxes and lists
     4204    // We require both bits to be on.
     4205    // I do not know that we would ever get one bit on and the other off since
     4206    // checking the checkbox in system preferences which is marked as "Turn on full keyboard access"
     4207    // turns on both bits.
     4208    _private->_keyboardUIMode = (mode & 0x2) ? KeyboardAccessFull : KeyboardAccessDefault;
     4209   
     4210    // check for tabbing to links
     4211    if ([_private->preferences tabsToLinks])
     4212        _private->_keyboardUIMode = (KeyboardUIMode)(_private->_keyboardUIMode | KeyboardAccessTabsToLinks);
     4213}
     4214
     4215- (KeyboardUIMode)_keyboardUIMode
     4216{
     4217    if (!_private->_keyboardUIModeAccessed) {
     4218        _private->_keyboardUIModeAccessed = YES;
     4219
     4220        [self _retrieveKeyboardUIModeFromPreferences:nil];
     4221       
     4222        [[NSDistributedNotificationCenter defaultCenter]
     4223            addObserver:self selector:@selector(_retrieveKeyboardUIModeFromPreferences:)
     4224            name:KeyboardUIModeDidChangeNotification object:nil];
     4225
     4226        [[NSNotificationCenter defaultCenter]
     4227            addObserver:self selector:@selector(_retrieveKeyboardUIModeFromPreferences:)
     4228            name:WebPreferencesChangedNotification object:nil];
     4229    }
     4230    return _private->_keyboardUIMode;
     4231}
     4232
    41874233@end
    41884234
  • trunk/WebKit/mac/WebView/WebViewInternal.h

    r29698 r30939  
    2727 */
    2828
    29 // This header contains WebView declarations that can be used anywhere in the Web Kit, but are neither SPI nor API.
     29// This header contains WebView declarations that can be used anywhere in WebKit, but are neither SPI nor API.
    3030
    3131#import "WebPreferences.h"
    3232#import "WebViewPrivate.h"
    3333#import "WebTypesInternal.h"
     34
     35#ifdef __cplusplus
     36#import <WebCore/WebCoreKeyboardUIMode.h>
     37#endif
    3438
    3539#ifdef __cplusplus
     
    6468#ifdef __cplusplus
    6569- (WebCore::String)_userAgentForURL:(const WebCore::KURL&)url;
     70- (WebCore::KeyboardUIMode)_keyboardUIMode;
    6671#endif
    6772@end
Note: See TracChangeset for help on using the changeset viewer.