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

sullivan sullivan at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:04:28 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit f22893593b0da29bafd27a0be182f960acd01ed3
Author: sullivan <sullivan at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Oct 23 19:25:24 2003 +0000

    	- fixed 3459272 -- Can't set up keyboard loop inside a
    	WebDocumentView without subclassing views
    	- fixed 3179062 -- can't tab back to address bar from image-only
    	page
    	- fixed 3252009 -- tabbing from address bar to content area does
    	not work with WebTextView
    	- fixed 3461398 -- Can't click on a standalone image to focus it
    	(for later keyboard scrolling)
    
    	I redid the way WebView and WebFrameView splice themselves into
    	the keyview loop in a way very similar to what NSScrollView and
    	NSClipView do. This means that contained and sibling views won't
    	need to do anything special to put themselves into the key loop.
    
            Reviewed by Chris.
    
            * WebView.subproj/WebFrameView.m:
            (-[WebFrameView _scrollView]):
    	check for nil pointer before dereferencing; this can happen
    	during [super dealloc]'s keyview-loop-fixup code
    	(-[WebFrameView initWithFrame:]):
    	wire our nextKeyView link to the contained scrollview (so
    	previousKeyView will work correctly from scrollview)
            (-[WebFrameView acceptsFirstResponder]):
    	return what the contained scrollview says
            (-[WebFrameView becomeFirstResponder]):
    	in previous direction, use previousValidKeyView (follows normal
    	NSView keyview links); in forward direction, hand first
    	responder-ness to contained scrollview (which will in turn hand
    	it down to clipview, which will in turn hand it down to document)
            (-[WebFrameView setNextKeyView:]):
    	wire up scrollview instead of self, if it exists
    
            * WebView.subproj/WebImageView.m:
            (-[WebImageView acceptsFirstResponder]):
    	overridden to return YES; this fixes 3461398 and puts the finishing
    	touches on 3179062
    
            * WebView.subproj/WebView.m:
            (-[WebView _commonInitializationWithFrameName:groupName:]):
    	wire our nextKeyView link to the contained webframeview (so
    	previousKeyView will work correctly from webframeview). Also,
    	if there's a nextKeyView already set (in a nib, e.g.), wire
    	it to our contained webframeview.
            (-[WebView acceptsFirstResponder]):
    	return what the contained webframeview says
            (-[WebView becomeFirstResponder]):
    	in previous direction, use previousValidKeyView (follows normal
    	NSView keyview links); in forward direction, hand first
    	responder-ness to contained webframeview (which will in turn hand
    	it down to scrollview, etc.)
            (-[WebView setNextKeyView:]):
    	wire up webframeview instead of self, if it exists
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5248 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index b97b701..c336d38 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,59 @@
+2003-10-23  John Sullivan  <sullivan at apple.com>
+
+	- fixed 3459272 -- Can't set up keyboard loop inside a 
+	WebDocumentView without subclassing views
+	- fixed 3179062 -- can't tab back to address bar from image-only 
+	page
+	- fixed 3252009 -- tabbing from address bar to content area does 
+	not work with WebTextView
+	- fixed 3461398 -- Can't click on a standalone image to focus it 
+	(for later keyboard scrolling)
+
+	I redid the way WebView and WebFrameView splice themselves into
+	the keyview loop in a way very similar to what NSScrollView and
+	NSClipView do. This means that contained and sibling views won't 
+	need to do anything special to put themselves into the key loop.
+
+        Reviewed by Chris.
+
+        * WebView.subproj/WebFrameView.m:
+        (-[WebFrameView _scrollView]):
+	check for nil pointer before dereferencing; this can happen
+	during [super dealloc]'s keyview-loop-fixup code
+	(-[WebFrameView initWithFrame:]):
+	wire our nextKeyView link to the contained scrollview (so
+	previousKeyView will work correctly from scrollview)
+        (-[WebFrameView acceptsFirstResponder]):
+	return what the contained scrollview says
+        (-[WebFrameView becomeFirstResponder]):
+	in previous direction, use previousValidKeyView (follows normal
+	NSView keyview links); in forward direction, hand first
+	responder-ness to contained scrollview (which will in turn hand
+	it down to clipview, which will in turn hand it down to document)
+        (-[WebFrameView setNextKeyView:]):
+	wire up scrollview instead of self, if it exists
+
+        * WebView.subproj/WebImageView.m:
+        (-[WebImageView acceptsFirstResponder]):
+	overridden to return YES; this fixes 3461398 and puts the finishing
+	touches on 3179062
+
+        * WebView.subproj/WebView.m:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+	wire our nextKeyView link to the contained webframeview (so
+	previousKeyView will work correctly from webframeview). Also,
+	if there's a nextKeyView already set (in a nib, e.g.), wire
+	it to our contained webframeview.
+        (-[WebView acceptsFirstResponder]):
+	return what the contained webframeview says
+        (-[WebView becomeFirstResponder]):
+	in previous direction, use previousValidKeyView (follows normal
+	NSView keyview links); in forward direction, hand first
+	responder-ness to contained webframeview (which will in turn hand
+	it down to scrollview, etc.)
+        (-[WebView setNextKeyView:]):
+	wire up webframeview instead of self, if it exists
+
 2003-10-22  Richard Williamson   <rjw at apple.com>
 
 	Match WebCore's notion of distributing linegap between top and bottom of 
diff --git a/WebKit/WebView.subproj/WebFrameView.m b/WebKit/WebView.subproj/WebFrameView.m
index f513776..4363ae8 100644
--- a/WebKit/WebView.subproj/WebFrameView.m
+++ b/WebKit/WebView.subproj/WebFrameView.m
@@ -118,6 +118,11 @@ enum {
 
 - (NSScrollView *)_scrollView
 {
+    // this can be called by [super dealloc] when cleaning up the keyview loop,
+    // after _private has been nilled out.
+    if (_private == nil) {
+        return nil;
+    }
     return _private->frameScrollView;
 }
 
@@ -424,6 +429,10 @@ static NSMutableDictionary *viewTypes;
     [scrollView setHasHorizontalScroller: NO];
     [scrollView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
     [self addSubview: scrollView];
+    // don't call our overridden version here; we need to make the standard NSView link between us
+    // and our subview so that previousKeyView and previousValidKeyView work as expected. This works
+    // together with our becomeFirstResponder and setNextKeyView overrides.
+    [super setNextKeyView:scrollView];
     
     ++WebFrameViewCount;
     
@@ -461,17 +470,45 @@ static NSMutableDictionary *viewTypes;
     return [[self _scrollView] documentView];
 }
 
--(BOOL)acceptsFirstResponder
+- (BOOL)acceptsFirstResponder
 {
-    return YES;
+    return [[self _scrollView] acceptsFirstResponder];
 }
 
 - (BOOL)becomeFirstResponder
 {
-    if ([self documentView]) {
-        [[self window] makeFirstResponder:[self documentView]];
+    // This works together with setNextKeyView to splice the WebFrameView into
+    // the key loop similar to the way NSScrollView does this. Note that
+    // WebView has very similar code.
+    NSWindow *window = [self window];    
+    if ([window keyViewSelectionDirection] == NSSelectingPrevious) {
+        NSView *previousValidKeyView = [self previousValidKeyView];
+        if ((previousValidKeyView != self) && (previousValidKeyView != [self _scrollView])) {
+            [window makeFirstResponder:previousValidKeyView];
+            return YES;
+        } else {
+            return NO;
+        }
+    }
+    
+    if ([[self _scrollView] acceptsFirstResponder]) {
+        [window makeFirstResponder:[self _scrollView]];
+        return YES;
+    } else {
+        return NO;
+    }
+}
+
+- (void)setNextKeyView:(NSView *)aView
+{
+    // This works together with becomeFirstResponder to splice the WebFrameView into
+    // the key loop similar to the way NSScrollView does this. Note that
+    // WebView has very similar code.
+    if ([self _scrollView] != nil) {
+        [[self _scrollView] setNextKeyView:aView];
+    } else {
+        [super setNextKeyView:aView];
     }
-    return YES;
 }
 
 - (BOOL)isOpaque
diff --git a/WebKit/WebView.subproj/WebImageView.m b/WebKit/WebView.subproj/WebImageView.m
index 8078989..b9e5dbd 100644
--- a/WebKit/WebView.subproj/WebImageView.m
+++ b/WebKit/WebView.subproj/WebImageView.m
@@ -57,6 +57,12 @@
     return YES;
 }
 
+- (BOOL)acceptsFirstResponder
+{
+    // Being first responder is useful for scrolling from the keyboard at least.
+    return YES;
+}
+
 - (NSRect)drawingRect
 {
     NSSize imageSize = [[rep image] size];
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 1480f97..c922b0f 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -1075,6 +1075,16 @@ NSMutableDictionary *countInvocations;
 
     _private->mainFrame = [[WebFrame alloc] initWithName: frameName webFrameView: wv  webView: self];
     [self setGroupName:groupName];
+    
+    // If there's already a next key view (e.g., from a nib), wire it up to our
+    // contained frame view. In any case, wire our next key view up to the our
+    // contained frame view. This works together with our becomeFirstResponder 
+    // and setNextKeyView overrides.
+    NSView *nextKeyView = [self nextKeyView];
+    if (nextKeyView != nil && nextKeyView != wv) {
+        [wv setNextKeyView:nextKeyView];
+    }
+    [super setNextKeyView:wv];
 
     ++WebViewCount;
 
@@ -1551,15 +1561,46 @@ NS_ENDHANDLER
 
 - (BOOL)acceptsFirstResponder
 {
-    return YES;
+    return [[[self mainFrame] frameView] acceptsFirstResponder];
 }
 
 - (BOOL)becomeFirstResponder
 {
-    if ([[self mainFrame] frameView]) {
-        [[self window] makeFirstResponder:[[self mainFrame] frameView]];
+    // This works together with setNextKeyView to splice the WebView into
+    // the key loop similar to the way NSScrollView does this. Note that
+    // WebFrameView has very similar code.
+    NSWindow *window = [self window];
+    WebFrameView *mainFrameView = [[self mainFrame] frameView];
+    
+    if ([window keyViewSelectionDirection] == NSSelectingPrevious) {
+        NSView *previousValidKeyView = [self previousValidKeyView];
+        if ((previousValidKeyView != self) && (previousValidKeyView != mainFrameView)) {
+            [window makeFirstResponder:previousValidKeyView];
+            return YES;
+        } else {
+            return NO;
+        }
+    }
+    
+    if ([mainFrameView acceptsFirstResponder]) {
+        [window makeFirstResponder:mainFrameView];
+        return YES;
+    } 
+    
+    return NO;
+}
+
+- (void)setNextKeyView:(NSView *)aView
+{
+    // This works together with becomeFirstResponder to splice the WebView into
+    // the key loop similar to the way NSScrollView does this. Note that
+    // WebFrameView has very similar code.
+    WebFrameView *mainFrameView = [[self mainFrame] frameView];
+    if (mainFrameView != nil) {
+        [mainFrameView setNextKeyView:aView];
+    } else {
+        [super setNextKeyView:aView];
     }
-    return YES;
 }
 
 // Return the frame holding first responder

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list