2009-04-19 Adele Peterson <adele@apple.com>
authoradele@apple.com <adele@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Apr 2009 06:25:49 +0000 (06:25 +0000)
committeradele@apple.com <adele@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Apr 2009 06:25:49 +0000 (06:25 +0000)
        Reviewed by Darin Adler.

        Fix for <rdar://problem/6804809> REGRESSION: In Mail, Home and End do not scroll message

        If no scrolling occurs, call tryToPerform on the next responder.  Then our WebResponderChainSink
        will correctly detect if no responders handle the selector.

        * WebView/WebFrameView.mm:
        (-[WebFrameView _scrollToBeginningOfDocument]):
        (-[WebFrameView _scrollToEndOfDocument]):
        (-[WebFrameView scrollToBeginningOfDocument:]):
        (-[WebFrameView scrollToEndOfDocument:]):
        (-[WebFrameView scrollLineUp:]):
        (-[WebFrameView scrollLineDown:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@42668 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/mac/ChangeLog
WebKit/mac/WebView/WebFrameView.mm

index b9590d8..9933b86 100644 (file)
@@ -1,3 +1,20 @@
+2009-04-19  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Fix for <rdar://problem/6804809> REGRESSION: In Mail, Home and End do not scroll message
+
+        If no scrolling occurs, call tryToPerform on the next responder.  Then our WebResponderChainSink
+        will correctly detect if no responders handle the selector.
+
+        * WebView/WebFrameView.mm:
+        (-[WebFrameView _scrollToBeginningOfDocument]):
+        (-[WebFrameView _scrollToEndOfDocument]):
+        (-[WebFrameView scrollToBeginningOfDocument:]):
+        (-[WebFrameView scrollToEndOfDocument:]):
+        (-[WebFrameView scrollLineUp:]):
+        (-[WebFrameView scrollLineDown:]):
+
 2009-04-19  David Kilzer  <ddkilzer@apple.com>
 
         Make FEATURE_DEFINES completely dynamic
index 3b5146d..cfd8d5f 100644 (file)
@@ -519,31 +519,49 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
     return frame->eventHandler()->scrollOverflow(direction, granularity);
 }
 
-- (void)scrollToBeginningOfDocument:(id)sender
+- (BOOL)_scrollToBeginningOfDocument
 {
-    if (![self _scrollOverflowInDirection:ScrollUp granularity:ScrollByDocument]) {
+    if ([self _scrollOverflowInDirection:ScrollUp granularity:ScrollByDocument])
+        return YES;
+    if (![self _hasScrollBars])
+        return NO;
+    NSPoint point = [[[self _scrollView] documentView] frame].origin;
+    return [[self _contentView] _scrollTo:&point animate:YES];
+}
 
-        if (![self _hasScrollBars]) {
-            [[self _largestChildWithScrollBars] scrollToBeginningOfDocument:sender];
-            return;
-        }
+- (BOOL)_scrollToEndOfDocument
+{
+    if ([self _scrollOverflowInDirection:ScrollDown granularity:ScrollByDocument])
+        return YES;
+    if (![self _hasScrollBars])
+        return NO;
+    NSRect frame = [[[self _scrollView] documentView] frame];
+    NSPoint point = NSMakePoint(frame.origin.x, NSMaxY(frame));
+    return [[self _contentView] _scrollTo:&point animate:YES];
+}
 
-        [[self _contentView] scrollPoint:[[[self _scrollView] documentView] frame].origin];
+- (void)scrollToBeginningOfDocument:(id)sender
+{
+    if ([self _scrollToBeginningOfDocument])
+        return;
+    
+    if (WebFrameView *child = [self _largestChildWithScrollBars]) {
+        if ([child _scrollToBeginningOfDocument])
+            return;
     }
+    [[self nextResponder] tryToPerform:@selector(scrollToBeginningOfDocument:) with:sender];
 }
 
 - (void)scrollToEndOfDocument:(id)sender
 {
-    if (![self _scrollOverflowInDirection:ScrollDown granularity:ScrollByDocument]) {
+    if ([self _scrollToEndOfDocument])
+        return;
 
-        if (![self _hasScrollBars]) {
-            [[self _largestChildWithScrollBars] scrollToEndOfDocument:sender];
+    if (WebFrameView *child = [self _largestChildWithScrollBars]) {
+        if ([child _scrollToEndOfDocument])
             return;
-        }
-        
-        NSRect frame = [[[self _scrollView] documentView] frame];
-        [[self _contentView] scrollPoint:NSMakePoint(frame.origin.x, NSMaxY(frame))];
     }
+    [[self nextResponder] tryToPerform:@selector(scrollToEndOfDocument:) with:sender];
 }
 
 - (void)_goBack
@@ -654,12 +672,14 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
 
 - (void)scrollLineUp:(id)sender
 {
-    [self _scrollLineVertically:YES];
+    if (![self _scrollLineVertically:YES])
+        [[self nextResponder] tryToPerform:@selector(scrollLineUp:) with:sender];
 }
 
 - (void)scrollLineDown:(id)sender
 {
-    [self _scrollLineVertically:NO];
+    if (![self _scrollLineVertically:NO])
+        [[self nextResponder] tryToPerform:@selector(scrollLineDown:) with:sender];
 }
 
 - (BOOL)_firstResponderIsFormControl