[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:09:19 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 47dc4338e4f84c91aee547f0c9e9c284b8668d5a
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 5 16:49:32 2003 +0000

    WebCore:
    
            Reviewed by Maciej
    
    	Fix for these bugs:
    
    	<rdar://problem/3467558>: Cannot tab to form file input widgets
    	<rdar://problem/3473631>: WebFileButton sends notifications to communicate with WebCore
    
    	Tabbing now works for these widgets. While I was in the neighborhood,
    	I improved the communication mechanism between the WebKit and WebCore
    	sides of the file button implementation, replacing notifications
    	with a callback object.
    
            * WebCore-combined.exp: Remove no-longer used WebCoreFileButtonClicked
        	and WebCoreFileButtonFilenameChanged notofication strings.
            * WebCore.exp: Ditto.
            * kwq/KWQFileButton.h: Changed declarations to match changes in
            callback functions.
            * kwq/KWQFileButton.mm:
            (KWQFileButton::KWQFileButton): Now sets the view after creating
            the delegate object.
            (KWQFileButton::filenameChanged): Now takes a QString argument
            which indicates the filename.
            (KWQFileButton::focusChanged): New function. Sends DOM focus and
            blur events.
            (-[KWQFileButtonAdapter initWithKWQFileButton:]): No longer needs
            to register for notifications.
            (-[KWQFileButtonAdapter dealloc]): No longer needs to remove itself
            from the notification center.
            (-[KWQFileButtonAdapter filenameChanged:]): No longer a notification
            callback. Now a WebCoreFileButtonCallback callback.
            (-[KWQFileButtonAdapter focusChanged:]): New WebCoreFileButtonCallback
            callback.
            (-[KWQFileButtonAdapter clicked]): No longer a notification
            callback. Now a WebCoreFileButtonCallback callback.
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::nextKeyViewInFrame): Unrelated cleanup.
            * kwq/WebCoreBridge.h: Declared new WebCoreFileButtonDelegate protocol.
    
    WebKit:
    
            Reviewed by Maciej
    
            Fix for these bugs:
    
            <rdar://problem/3467558>: Cannot tab to form file input widgets
            <rdar://problem/3473631>: WebFileButton sends notifications to communicate with WebCore
    
            Tabbing now works for these widgets. While I was in the neighborhood,
            I improved the communication mechanism between the WebKit and WebCore
            sides of the file button implementation, replacing notifications
            with a callback object.
    
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge fileButtonWithDelegate:]): Method now takes a
    	delegate object.
            * WebCoreSupport.subproj/WebFileButton.h:
            * WebCoreSupport.subproj/WebFileButton.m:
            (-[WebFileButton initWithBridge:delegate:]):
            (-[WebFileButton initWithFrame:]):
            (-[WebFileButton dealloc]):
            (-[WebFileButton chooseFilename:]): Sends callback rather than posting
    	a notification.
            (-[WebFileButton chooseButtonPressed:]): Ditto.
            (-[WebFileButton mouseDown:]):
            (-[WebFileButton acceptsFirstResponder]):
            (-[WebFileButton becomeFirstResponder]): Make the button subview
            first responder.
            (-[WebFileButton nextKeyView]): Hook up to WebBridge key view machinery.
            (-[WebFileButton previousKeyView]): Ditto.
            (-[WebFileButton nextValidKeyView]): Ditto.
            (-[WebFileButton previousValidKeyView]): Ditto.
            (-[WebFileChooserButton initWithDelegate:]):
            (-[WebFileChooserButton nextValidKeyView]): Ditto.
            (-[WebFileChooserButton previousValidKeyView]): Ditto.
            (-[WebFileChooserButton resignFirstResponder]): Sends a focus change
            callback.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5388 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 705819d..6c39c67 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,43 @@
+2003-11-05  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Maciej
+
+	Fix for these bugs:
+
+	<rdar://problem/3467558>: Cannot tab to form file input widgets
+	<rdar://problem/3473631>: WebFileButton sends notifications to communicate with WebCore
+
+	Tabbing now works for these widgets. While I was in the neighborhood,
+	I improved the communication mechanism between the WebKit and WebCore
+	sides of the file button implementation, replacing notifications
+	with a callback object.
+
+        * WebCore-combined.exp: Remove no-longer used WebCoreFileButtonClicked
+    	and WebCoreFileButtonFilenameChanged notofication strings.
+        * WebCore.exp: Ditto.
+        * kwq/KWQFileButton.h: Changed declarations to match changes in
+        callback functions.
+        * kwq/KWQFileButton.mm:
+        (KWQFileButton::KWQFileButton): Now sets the view after creating
+        the delegate object.
+        (KWQFileButton::filenameChanged): Now takes a QString argument
+        which indicates the filename.
+        (KWQFileButton::focusChanged): New function. Sends DOM focus and
+        blur events.
+        (-[KWQFileButtonAdapter initWithKWQFileButton:]): No longer needs
+        to register for notifications.
+        (-[KWQFileButtonAdapter dealloc]): No longer needs to remove itself
+        from the notification center.
+        (-[KWQFileButtonAdapter filenameChanged:]): No longer a notification
+        callback. Now a WebCoreFileButtonCallback callback.
+        (-[KWQFileButtonAdapter focusChanged:]): New WebCoreFileButtonCallback
+        callback.
+        (-[KWQFileButtonAdapter clicked]): No longer a notification
+        callback. Now a WebCoreFileButtonCallback callback.
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::nextKeyViewInFrame): Unrelated cleanup.
+        * kwq/WebCoreBridge.h: Declared new WebCoreFileButtonDelegate protocol.
+
 2003-11-05  Maciej Stachowiak  <mjs at apple.com>
 
 	- fixed deployment build
diff --git a/WebCore/WebCore-combined.exp b/WebCore/WebCore-combined.exp
index a0df609..93c6c17 100644
--- a/WebCore/WebCore-combined.exp
+++ b/WebCore/WebCore-combined.exp
@@ -22,8 +22,6 @@ _WebCoreElementLinkTargetFrameKey
 _WebCoreElementLinkTitleKey
 _WebCoreElementLinkURLKey
 _WebCoreElementTitleKey
-_WebCoreFileButtonClicked
-_WebCoreFileButtonFilenameChanged
 _WebCoreInitializeEmptyTextStyle
 _WebCoreInitializeTextRun
 _WebCorePageCacheStateKey
diff --git a/WebCore/WebCore.exp b/WebCore/WebCore.exp
index 42297ae..99766ee 100644
--- a/WebCore/WebCore.exp
+++ b/WebCore/WebCore.exp
@@ -22,8 +22,6 @@ _WebCoreElementLinkTargetFrameKey
 _WebCoreElementLinkTitleKey
 _WebCoreElementLinkURLKey
 _WebCoreElementTitleKey
-_WebCoreFileButtonClicked
-_WebCoreFileButtonFilenameChanged
 _WebCoreInitializeEmptyTextStyle
 _WebCoreInitializeTextRun
 _WebCorePageCacheStateKey
diff --git a/WebCore/kwq/KWQFileButton.h b/WebCore/kwq/KWQFileButton.h
index a8743e7..3a58dc6 100644
--- a/WebCore/kwq/KWQFileButton.h
+++ b/WebCore/kwq/KWQFileButton.h
@@ -47,7 +47,8 @@ public:
     void setFrameGeometry(const QRect &);
     int baselinePosition(int height) const;
     
-    void filenameChanged();
+    void filenameChanged(const QString &);
+    void focusChanged(bool);
     void clicked();
 
 private:
diff --git a/WebCore/kwq/KWQFileButton.mm b/WebCore/kwq/KWQFileButton.mm
index 9f35561..e09945d 100644
--- a/WebCore/kwq/KWQFileButton.mm
+++ b/WebCore/kwq/KWQFileButton.mm
@@ -30,17 +30,17 @@
 #import "KWQKHTMLPart.h"
 #import "WebCoreBridge.h"
 
-NSString *WebCoreFileButtonFilenameChanged = @"WebCoreFileButtonFilenameChanged";
-NSString *WebCoreFileButtonClicked = @"WebCoreFileButtonClicked";
-
-
- at interface KWQFileButtonAdapter : NSObject
+ at interface KWQFileButtonAdapter : NSObject <WebCoreFileButtonDelegate>
 {
     KWQFileButton *button;
 }
 
 - initWithKWQFileButton:(KWQFileButton *)button;
 
+- (void)filenameChanged:(NSString *)filename;
+- (void)focusChanged:(BOOL)nowHasFocus;
+- (void)clicked;
+
 @end
 
 KWQFileButton::KWQFileButton(KHTMLPart *part)
@@ -50,8 +50,8 @@ KWQFileButton::KWQFileButton(KHTMLPart *part)
 {
     KWQ_BLOCK_EXCEPTIONS;
 
-    setView([KWQ(part)->bridge() fileButton]);
     _adapter = [[KWQFileButtonAdapter alloc] initWithKWQFileButton:this];
+    setView([KWQ(part)->bridge() fileButtonWithDelegate:_adapter]);
 
     KWQ_UNBLOCK_EXCEPTIONS;
 }
@@ -118,19 +118,23 @@ int KWQFileButton::baselinePosition(int height) const
     return 0;
 }
 
-void KWQFileButton::filenameChanged()
+void KWQFileButton::filenameChanged(const QString &filename)
 {
-    NSView <WebCoreFileButton> *button = getView();
-
-    QString filename;
-
-    KWQ_BLOCK_EXCEPTIONS;
-    filename = QString::fromNSString([button filename]);
-    KWQ_UNBLOCK_EXCEPTIONS;
-
     _textChanged.call(filename);
 }
 
+void KWQFileButton::focusChanged(bool nowHasFocus)
+{
+    if (nowHasFocus) {
+        QFocusEvent event(QEvent::FocusIn);
+        const_cast<QObject *>(eventFilterObject())->eventFilter(this, &event);
+    }
+    else {
+        QFocusEvent event(QEvent::FocusOut);
+        const_cast<QObject *>(eventFilterObject())->eventFilter(this, &event);
+    }
+}
+
 void KWQFileButton::clicked()
 {
     _clicked.call();
@@ -143,25 +147,25 @@ void KWQFileButton::clicked()
 {
     [super init];
     button = b;
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(filenameChanged:)
-        name:WebCoreFileButtonFilenameChanged object:b->getView()];
-    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clicked:)
-        name:WebCoreFileButtonClicked object:b->getView()];
     return self;
 }
 
 - (void)dealloc
 {
-    [[NSNotificationCenter defaultCenter] removeObserver:self];
     [super dealloc];
 }
 
-- (void)filenameChanged:(NSNotification *)notification
+- (void)filenameChanged:(NSString *)filename
+{
+    button->filenameChanged(QString::fromNSString(filename));
+}
+
+- (void)focusChanged:(BOOL)nowHasFocus
 {
-    button->filenameChanged();
+    button->focusChanged(nowHasFocus);
 }
 
--(void)clicked:(NSNotification *)notification
+-(void)clicked
 {
     button->sendConsumedMouseUp();
     button->clicked();
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 08b1e24..bcd2728 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -951,10 +951,6 @@ NSView *KWQKHTMLPart::nextKeyViewInFrame(NodeImpl *node, KWQSelectionDirection d
             }
         }
         else if ([_bridge keyboardUIMode] == WebCoreFullKeyboardAccess) {
-            DocumentImpl *doc = xmlDocImpl();
-            if (!doc) {
-                return nil;
-            }
             doc->setFocusNode(node);
             if (view()) {
                 QRect rect = node->getRect();
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 311a913..4523fe7 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -56,6 +56,7 @@ typedef khtml::RenderPart KHTMLRenderPart;
 @protocol WebCoreResourceHandle;
 @protocol WebCoreResourceLoader;
 @protocol WebCoreFileButton;
+ at protocol WebCoreFileButtonDelegate;
 @protocol WebDOMDocument;
 @protocol WebDOMNode;
 @protocol WebDOMElement;
@@ -349,7 +350,7 @@ typedef enum {
 - (BOOL)control:(NSControl *)control isValidObject:(id)obj;
 - (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector;
 
-- (NSView <WebCoreFileButton> *)fileButton;
+- (NSView <WebCoreFileButton> *)fileButtonWithDelegate:(id <WebCoreFileButtonDelegate>)delegate;
 
 - (void)setHasBorder:(BOOL)hasBorder;
 
@@ -385,5 +386,8 @@ typedef enum {
 - (NSSize)bestVisualFrameSizeForCharacterCount:(int)count;
 @end
 
-extern NSString *WebCoreFileButtonFilenameChanged;
-extern NSString *WebCoreFileButtonClicked;
+ at protocol WebCoreFileButtonDelegate <NSObject>
+- (void)filenameChanged:(NSString *)filename;
+- (void)focusChanged:(BOOL)nowHasFocus;
+- (void)clicked;
+ at end
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 8c10dc5..cd94fd9 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,42 @@
+2003-11-05  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Maciej
+
+        Fix for these bugs:
+
+        <rdar://problem/3467558>: Cannot tab to form file input widgets
+        <rdar://problem/3473631>: WebFileButton sends notifications to communicate with WebCore
+
+        Tabbing now works for these widgets. While I was in the neighborhood,
+        I improved the communication mechanism between the WebKit and WebCore
+        sides of the file button implementation, replacing notifications
+        with a callback object.
+
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge fileButtonWithDelegate:]): Method now takes a 
+	delegate object.
+        * WebCoreSupport.subproj/WebFileButton.h:
+        * WebCoreSupport.subproj/WebFileButton.m:
+        (-[WebFileButton initWithBridge:delegate:]):
+        (-[WebFileButton initWithFrame:]):
+        (-[WebFileButton dealloc]):
+        (-[WebFileButton chooseFilename:]): Sends callback rather than posting
+	a notification.
+        (-[WebFileButton chooseButtonPressed:]): Ditto.
+        (-[WebFileButton mouseDown:]):
+        (-[WebFileButton acceptsFirstResponder]):
+        (-[WebFileButton becomeFirstResponder]): Make the button subview
+        first responder.
+        (-[WebFileButton nextKeyView]): Hook up to WebBridge key view machinery.
+        (-[WebFileButton previousKeyView]): Ditto.
+        (-[WebFileButton nextValidKeyView]): Ditto.
+        (-[WebFileButton previousValidKeyView]): Ditto.
+        (-[WebFileChooserButton initWithDelegate:]):
+        (-[WebFileChooserButton nextValidKeyView]): Ditto.
+        (-[WebFileChooserButton previousValidKeyView]): Ditto.
+        (-[WebFileChooserButton resignFirstResponder]): Sends a focus change 
+        callback.
+
 2003-11-04  Darin Adler  <darin at apple.com>
 
         Reviewed by John, except for one bit reviewed by Maciej.
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index cb7d7a1..e35173e 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -301,9 +301,9 @@
     return *result != nil;
 }
 
-- (NSView <WebCoreFileButton> *)fileButton
+- (NSView <WebCoreFileButton> *)fileButtonWithDelegate:(id <WebCoreFileButtonDelegate>)delegate
 {
-    return [[WebFileButton alloc] initWithBridge:self];
+    return [[WebFileButton alloc] initWithBridge:self delegate:delegate];
 }
 
 - (void)runOpenPanelForFileButtonWithResultListener:(id<WebOpenPanelResultListener>)resultListener
diff --git a/WebKit/WebCoreSupport.subproj/WebFileButton.h b/WebKit/WebCoreSupport.subproj/WebFileButton.h
index b95cd41..98fbf33 100644
--- a/WebKit/WebCoreSupport.subproj/WebFileButton.h
+++ b/WebKit/WebCoreSupport.subproj/WebFileButton.h
@@ -9,16 +9,20 @@
 #import <Cocoa/Cocoa.h>
 
 @protocol WebCoreFileButton;
+ at protocol WebCoreFileButtonDelegate;
 @protocol WebOpenPanelResultListener;
 @class WebBridge;
+ at class WebFileChooserButton;
 
 @interface WebFileButton : NSView <WebCoreFileButton, WebOpenPanelResultListener>
 {
     NSString *_filename;
-    NSButton *_button;
+    WebFileChooserButton *_button;
     NSImage *_icon;
     NSString *_label;
     WebBridge *_bridge;
+    BOOL _inNextValidKeyView;
+    id <WebCoreFileButtonDelegate> _delegate;
 }
-- (id)initWithBridge:(WebBridge *)bridge;
+- (id)initWithBridge:(WebBridge *)bridge delegate:(id <WebCoreFileButtonDelegate>)delegate;
 @end
diff --git a/WebKit/WebCoreSupport.subproj/WebFileButton.m b/WebKit/WebCoreSupport.subproj/WebFileButton.m
index 2d65720..ab20008 100644
--- a/WebKit/WebCoreSupport.subproj/WebFileButton.m
+++ b/WebKit/WebCoreSupport.subproj/WebFileButton.m
@@ -30,6 +30,13 @@
 // AppKit calls this kThemePushButtonSmallTextOffset.
 #define BUTTON_VERTICAL_FUDGE_FACTOR 2
 
+ at interface WebFileChooserButton : NSButton
+{
+    id <WebCoreFileButtonDelegate> _delegate;
+}
+- (id)initWithDelegate:(id <WebCoreFileButtonDelegate>)delegate;
+ at end
+
 @implementation WebFileButton
 
 - (void)positionButton
@@ -38,11 +45,12 @@
     [_button setFrameOrigin:NSMakePoint(0, 0)];
 }
 
-- (id)initWithBridge:(WebBridge *)bridge
+- (id)initWithBridge:(WebBridge *)bridge delegate:(id <WebCoreFileButtonDelegate>)delegate
 {
     self = [super init];
     if (self) {
 	_bridge = bridge; // Don't retain to avoid cycle
+        _delegate = [delegate retain];
     }
     return self;
 }
@@ -51,7 +59,7 @@
 {
     self = [super initWithFrame:frame];
     if (self) {
-        _button = [[NSButton alloc] init];
+        _button = [[WebFileChooserButton alloc] initWithDelegate:_delegate];
         
         [_button setTitle:UI_STRING("Choose File", "title for file button used in HTML forms")];
         [[_button cell] setControlSize:NSSmallControlSize];
@@ -59,6 +67,7 @@
         [_button setBezelStyle:NSRoundedBezelStyle];
         [_button setTarget:self];
         [_button setAction:@selector(chooseButtonPressed:)];
+        [_button setNextResponder:self];
         
         [self addSubview:_button];
         
@@ -74,6 +83,7 @@
     [_button release];
     [_icon release];
     [_label release];
+    [_delegate release];
     [super dealloc];
 }
 
@@ -213,7 +223,7 @@
 - (void)chooseFilename:(NSString *)fileName
 {
     [self setFilename:fileName];
-    [[NSNotificationCenter defaultCenter] postNotificationName:WebCoreFileButtonFilenameChanged object:self];
+    [_delegate filenameChanged:fileName];
     [_bridge release];
 }
 
@@ -225,7 +235,7 @@
 
 - (void)chooseButtonPressed:(id)sender
 {
-    [[NSNotificationCenter defaultCenter] postNotificationName:WebCoreFileButtonClicked object:self];
+    [_delegate clicked];
     [self beginSheet];
 }
 
@@ -234,4 +244,76 @@
     [self beginSheet];
 }
 
+- (BOOL)acceptsFirstResponder
+{
+    return YES;
+}
+
+- (BOOL)becomeFirstResponder
+{
+    BOOL become = [_button acceptsFirstResponder];
+    if (become) {
+        [_delegate focusChanged:YES];
+        [[self window] makeFirstResponder:_button];
+    }
+    return become;
+}
+
+- (NSView *)nextKeyView
+{
+    return (_inNextValidKeyView && ![_bridge inNextKeyViewOutsideWebFrameViews])
+    ? [_bridge nextKeyView]
+    : [super nextKeyView];
+}
+
+- (NSView *)previousKeyView
+{
+    return (_inNextValidKeyView)
+    ? [_bridge previousKeyView]
+    : [super previousKeyView];
+}
+
+- (NSView *)nextValidKeyView
+{
+    _inNextValidKeyView = YES;
+    NSView *view = [super nextValidKeyView];
+    _inNextValidKeyView = NO;
+    return view;
+}
+
+- (NSView *)previousValidKeyView
+{
+    _inNextValidKeyView = YES;
+    NSView *view = [super previousValidKeyView];
+    _inNextValidKeyView = NO;
+    return view;
+}
+
+ at end
+
+ at implementation WebFileChooserButton
+
+- (id)initWithDelegate:(id <WebCoreFileButtonDelegate>)delegate
+{
+    [super init];
+    _delegate = delegate; // Don't retain to avoid cycle
+    return self;
+}
+
+- (NSView *)nextValidKeyView
+{
+    return [[self superview] nextValidKeyView];
+}
+
+- (NSView *)previousValidKeyView
+{
+    return [[self superview] previousValidKeyView];
+}
+
+- (BOOL)resignFirstResponder
+{
+    [_delegate focusChanged:NO];
+    return YES;
+}
+
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list