[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
cblu
cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:23:33 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit ca8e252b9eb755dfe96bd1729522446f41023454
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Jul 9 00:09:59 2002 +0000
WebKit:
Fixes for:
2955757 - Keyboard scrolling code needs to move to WebKit
2937231 - Left and right arrows should scroll the content area
* Misc.subproj/IFNSEventExtras.h: Added.
* Misc.subproj/IFNSEventExtras.m: Added.
(-[NSEvent _IF_isScrollEvent]): new
* Plugins.subproj/IFPluginView.mm:
(-[IFPluginView keyUp:]): if plug-in doesn't accept it, send to nextResponder
(-[IFPluginView keyDown:]): if plug-in doesn't accept it, send to nextResponder
* WebKit.pbproj/project.pbxproj:
* WebView.subproj/IFHTMLView.mm:
(-[IFHTMLView keyDown:]): calls _IF_isScrollEvent, if so send to nextResponder
(-[IFHTMLView keyUp:]): calls _IF_isScrollEvent, if so send to nextResponder
* WebView.subproj/IFWebView.mm:
(-[IFWebView acceptsFirstResponder]): added
(-[IFWebView window]): no changes
(-[IFWebView keyDown:]): added, does the scroll
* WebView.subproj/IFWebViewPrivate.h:
* WebView.subproj/IFWebViewPrivate.mm:
(-[IFWebView _contentView]): added
(-[IFWebView _scrollVerticallyBy:]): added, moved from BrowserWindow.m
(-[IFWebView _scrollHorizontallyBy:]): added, moved from BrowserWindow.m
(-[IFWebView _pageVertically:]): added, moved from BrowserWindow.m
(-[IFWebView _scrollLineVertically:]): added, moved from BrowserWindow.m
(-[IFWebView _scrollLineHorizontally:]): added, moved from BrowserWindow.m
(-[IFWebView _pageDown]): added, moved from BrowserWindow.m
(-[IFWebView _pageUp]): added, moved from BrowserWindow.m
(-[IFWebView _scrollToTopLeft]): added, moved from BrowserWindow.m
(-[IFWebView _scrollToBottomLeft]): added, moved from BrowserWindow.m
(-[IFWebView _lineDown]): added, moved from BrowserWindow.m
(-[IFWebView _lineUp]): added, moved from BrowserWindow.m
(-[IFWebView _lineLeft]): added, moved from BrowserWindow.m
(-[IFWebView _lineRight]): added, moved from BrowserWindow.m
WebBrowser:
Fixes for:
2955757 - Keyboard scrolling code needs to move to WebKit
2937231 - Left and right arrows should scroll the content area
* BrowserWindow.m:
(-[BrowserWindow windowDidLoad]): no changes
(-[BrowserWindow windowWillHandleKeyEvent:]): causes scroll in _largestNonFramesetWebView
(-[BrowserWindow mouseDownInRightSearchButton:]): no changes
(-[IFWebView _area]): added
(-[IFWebView _largestNonFramesetWebView]): added
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1520 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index ec9c3a1..4d3ed18 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,40 @@
+2002-07-08 Chris Blumenberg <cblu at apple.com>
+
+ Fixes for:
+ 2955757 - Keyboard scrolling code needs to move to WebKit
+ 2937231 - Left and right arrows should scroll the content area
+
+ * Misc.subproj/IFNSEventExtras.h: Added.
+ * Misc.subproj/IFNSEventExtras.m: Added.
+ (-[NSEvent _IF_isScrollEvent]): new
+ * Plugins.subproj/IFPluginView.mm:
+ (-[IFPluginView keyUp:]): if plug-in doesn't accept it, send to nextResponder
+ (-[IFPluginView keyDown:]): if plug-in doesn't accept it, send to nextResponder
+ * WebKit.pbproj/project.pbxproj:
+ * WebView.subproj/IFHTMLView.mm:
+ (-[IFHTMLView keyDown:]): calls _IF_isScrollEvent, if so send to nextResponder
+ (-[IFHTMLView keyUp:]): calls _IF_isScrollEvent, if so send to nextResponder
+ * WebView.subproj/IFWebView.mm:
+ (-[IFWebView acceptsFirstResponder]): added
+ (-[IFWebView window]): no changes
+ (-[IFWebView keyDown:]): added, does the scroll
+ * WebView.subproj/IFWebViewPrivate.h:
+ * WebView.subproj/IFWebViewPrivate.mm:
+ (-[IFWebView _contentView]): added
+ (-[IFWebView _scrollVerticallyBy:]): added, moved from BrowserWindow.m
+ (-[IFWebView _scrollHorizontallyBy:]): added, moved from BrowserWindow.m
+ (-[IFWebView _pageVertically:]): added, moved from BrowserWindow.m
+ (-[IFWebView _scrollLineVertically:]): added, moved from BrowserWindow.m
+ (-[IFWebView _scrollLineHorizontally:]): added, moved from BrowserWindow.m
+ (-[IFWebView _pageDown]): added, moved from BrowserWindow.m
+ (-[IFWebView _pageUp]): added, moved from BrowserWindow.m
+ (-[IFWebView _scrollToTopLeft]): added, moved from BrowserWindow.m
+ (-[IFWebView _scrollToBottomLeft]): added, moved from BrowserWindow.m
+ (-[IFWebView _lineDown]): added, moved from BrowserWindow.m
+ (-[IFWebView _lineUp]): added, moved from BrowserWindow.m
+ (-[IFWebView _lineLeft]): added, moved from BrowserWindow.m
+ (-[IFWebView _lineRight]): added, moved from BrowserWindow.m
+
2002-07-08 Darin Adler <darin at apple.com>
* WebCoreSupport.subproj/IFWebCoreBridge.mm: Fix compiles under newer compiler
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index ec9c3a1..4d3ed18 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,40 @@
+2002-07-08 Chris Blumenberg <cblu at apple.com>
+
+ Fixes for:
+ 2955757 - Keyboard scrolling code needs to move to WebKit
+ 2937231 - Left and right arrows should scroll the content area
+
+ * Misc.subproj/IFNSEventExtras.h: Added.
+ * Misc.subproj/IFNSEventExtras.m: Added.
+ (-[NSEvent _IF_isScrollEvent]): new
+ * Plugins.subproj/IFPluginView.mm:
+ (-[IFPluginView keyUp:]): if plug-in doesn't accept it, send to nextResponder
+ (-[IFPluginView keyDown:]): if plug-in doesn't accept it, send to nextResponder
+ * WebKit.pbproj/project.pbxproj:
+ * WebView.subproj/IFHTMLView.mm:
+ (-[IFHTMLView keyDown:]): calls _IF_isScrollEvent, if so send to nextResponder
+ (-[IFHTMLView keyUp:]): calls _IF_isScrollEvent, if so send to nextResponder
+ * WebView.subproj/IFWebView.mm:
+ (-[IFWebView acceptsFirstResponder]): added
+ (-[IFWebView window]): no changes
+ (-[IFWebView keyDown:]): added, does the scroll
+ * WebView.subproj/IFWebViewPrivate.h:
+ * WebView.subproj/IFWebViewPrivate.mm:
+ (-[IFWebView _contentView]): added
+ (-[IFWebView _scrollVerticallyBy:]): added, moved from BrowserWindow.m
+ (-[IFWebView _scrollHorizontallyBy:]): added, moved from BrowserWindow.m
+ (-[IFWebView _pageVertically:]): added, moved from BrowserWindow.m
+ (-[IFWebView _scrollLineVertically:]): added, moved from BrowserWindow.m
+ (-[IFWebView _scrollLineHorizontally:]): added, moved from BrowserWindow.m
+ (-[IFWebView _pageDown]): added, moved from BrowserWindow.m
+ (-[IFWebView _pageUp]): added, moved from BrowserWindow.m
+ (-[IFWebView _scrollToTopLeft]): added, moved from BrowserWindow.m
+ (-[IFWebView _scrollToBottomLeft]): added, moved from BrowserWindow.m
+ (-[IFWebView _lineDown]): added, moved from BrowserWindow.m
+ (-[IFWebView _lineUp]): added, moved from BrowserWindow.m
+ (-[IFWebView _lineLeft]): added, moved from BrowserWindow.m
+ (-[IFWebView _lineRight]): added, moved from BrowserWindow.m
+
2002-07-08 Darin Adler <darin at apple.com>
* WebCoreSupport.subproj/IFWebCoreBridge.mm: Fix compiles under newer compiler
diff --git a/WebKit/Misc.subproj/IFNSEventExtras.h b/WebKit/Misc.subproj/IFNSEventExtras.h
new file mode 100644
index 0000000..9beac55
--- /dev/null
+++ b/WebKit/Misc.subproj/IFNSEventExtras.h
@@ -0,0 +1,13 @@
+/*
+ IFNSEventExtras.h
+ Copyright (c) 2002, Apple, Inc. All rights reserved.
+*/
+
+#import <Foundation/Foundation.h>
+
+
+ at interface NSEvent (IFExtensions)
+
+- (BOOL) _IF_isScrollEvent;
+
+ at end
diff --git a/WebKit/Misc.subproj/IFNSEventExtras.m b/WebKit/Misc.subproj/IFNSEventExtras.m
new file mode 100644
index 0000000..8d106b6
--- /dev/null
+++ b/WebKit/Misc.subproj/IFNSEventExtras.m
@@ -0,0 +1,39 @@
+/*
+ IFNSEventExtras.m
+ Copyright (c) 2002, Apple, Inc. All rights reserved.
+*/
+
+#import "IFNSEventExtras.h"
+
+
+ at implementation NSEvent (IFExtensions)
+
+- (BOOL) _IF_isScrollEvent
+{
+ NSEventType eventType = [self type];
+
+ if (eventType == NSKeyDown || eventType == NSKeyUp) {
+ NSString *characters = [self characters];
+ int index, count;
+
+ count = [characters length];
+ for (index = 0; index < count; ++index) {
+ switch ([characters characterAtIndex:index]) {
+ case NSPageUpFunctionKey:
+ case NSPageDownFunctionKey:
+ case NSHomeFunctionKey:
+ case NSEndFunctionKey:
+ case NSUpArrowFunctionKey:
+ case NSDownArrowFunctionKey:
+ case NSLeftArrowFunctionKey:
+ case NSRightArrowFunctionKey:
+ return YES;
+ default: break;
+ }
+ }
+ }
+
+ return NO;
+}
+
+ at end
diff --git a/WebKit/Plugins.subproj/IFPluginView.mm b/WebKit/Plugins.subproj/IFPluginView.mm
index 5f302df..bca9a50 100644
--- a/WebKit/Plugins.subproj/IFPluginView.mm
+++ b/WebKit/Plugins.subproj/IFPluginView.mm
@@ -16,6 +16,7 @@
#import <WebKit/IFPluginNullEventSender.h>
#import <WebKit/IFNullPluginView.h>
#import <WebKit/IFPlugin.h>
+#import <WebKit/IFNSEventExtras.h>
#import <WebKit/IFNSViewExtras.h>
#import <WebKit/WebKitDebug.h>
@@ -236,6 +237,11 @@
acceptedEvent = NPP_HandleEvent(instance, &event);
WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(keyUp): %d key:%c\n", acceptedEvent, (char) (event.message & charCodeMask));
+
+ // If the plug-in didn't accept this event and this event can be used for scrolling,
+ // pass it along so that keyboard scrolling continues to work
+ if([theEvent _IF_isScrollEvent] && !acceptedEvent)
+ [[self nextResponder] keyUp:theEvent];
}
- (void)keyDown:(NSEvent *)theEvent
@@ -250,6 +256,11 @@
acceptedEvent = NPP_HandleEvent(instance, &event);
WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(keyDown): %d key:%c\n", acceptedEvent, (char) (event.message & charCodeMask));
+
+ // If the plug-in didn't accept this event and this event can be used for scrolling,
+ // pass it along so that keyboard scrolling continues to work
+ if([theEvent _IF_isScrollEvent] && !acceptedEvent)
+ [[self nextResponder] keyDown:theEvent];
}
#pragma mark IFPLUGINVIEW
diff --git a/WebKit/Plugins.subproj/WebPluginView.m b/WebKit/Plugins.subproj/WebPluginView.m
index 5f302df..bca9a50 100644
--- a/WebKit/Plugins.subproj/WebPluginView.m
+++ b/WebKit/Plugins.subproj/WebPluginView.m
@@ -16,6 +16,7 @@
#import <WebKit/IFPluginNullEventSender.h>
#import <WebKit/IFNullPluginView.h>
#import <WebKit/IFPlugin.h>
+#import <WebKit/IFNSEventExtras.h>
#import <WebKit/IFNSViewExtras.h>
#import <WebKit/WebKitDebug.h>
@@ -236,6 +237,11 @@
acceptedEvent = NPP_HandleEvent(instance, &event);
WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(keyUp): %d key:%c\n", acceptedEvent, (char) (event.message & charCodeMask));
+
+ // If the plug-in didn't accept this event and this event can be used for scrolling,
+ // pass it along so that keyboard scrolling continues to work
+ if([theEvent _IF_isScrollEvent] && !acceptedEvent)
+ [[self nextResponder] keyUp:theEvent];
}
- (void)keyDown:(NSEvent *)theEvent
@@ -250,6 +256,11 @@
acceptedEvent = NPP_HandleEvent(instance, &event);
WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_HandleEvent(keyDown): %d key:%c\n", acceptedEvent, (char) (event.message & charCodeMask));
+
+ // If the plug-in didn't accept this event and this event can be used for scrolling,
+ // pass it along so that keyboard scrolling continues to work
+ if([theEvent _IF_isScrollEvent] && !acceptedEvent)
+ [[self nextResponder] keyDown:theEvent];
}
#pragma mark IFPLUGINVIEW
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index ed142ae..0336cb0 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -259,6 +259,7 @@
F5488CF602CB04EE01FF6274,
F5927D4B02D253C401CA2DBB,
F5927D4F02D26C5E01CA2DBB,
+ F558FF8402DA308B01CA2DBB,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -340,6 +341,7 @@
F5E0E10B02BC45F8018635CA,
F5A7B11C02BC8413018635CA,
F5488CF702CB04EE01FF6274,
+ F558FF8502DA308B01CA2DBB,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -419,6 +421,8 @@
F5FBAB9002B88CBF01FF6074,
3944607A020F50ED0ECA1767,
3944607B020F50ED0ECA1767,
+ F558FF8202DA308B01CA2DBB,
+ F558FF8302DA308B01CA2DBB,
F508946902B71D59018A9CD4,
F508946A02B71D59018A9CD4,
F59668C802AD2923018635CA,
@@ -1483,6 +1487,30 @@
settings = {
};
};
+ F558FF8202DA308B01CA2DBB = {
+ isa = PBXFileReference;
+ name = IFNSEventExtras.h;
+ path = Misc.subproj/IFNSEventExtras.h;
+ refType = 4;
+ };
+ F558FF8302DA308B01CA2DBB = {
+ isa = PBXFileReference;
+ name = IFNSEventExtras.m;
+ path = Misc.subproj/IFNSEventExtras.m;
+ refType = 4;
+ };
+ F558FF8402DA308B01CA2DBB = {
+ fileRef = F558FF8202DA308B01CA2DBB;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F558FF8502DA308B01CA2DBB = {
+ fileRef = F558FF8302DA308B01CA2DBB;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
F567433E026B5B7B01A80181 = {
isa = PBXFileReference;
name = IFLocationChangeHandler.h;
diff --git a/WebKit/WebView.subproj/IFHTMLView.mm b/WebKit/WebView.subproj/IFHTMLView.mm
index 72a508c..7061417 100644
--- a/WebKit/WebView.subproj/IFHTMLView.mm
+++ b/WebKit/WebView.subproj/IFHTMLView.mm
@@ -6,6 +6,7 @@
#import <WebKit/IFDynamicScrollBarsView.h>
#import <WebKit/IFException.h>
#import <WebKit/IFHTMLViewPrivate.h>
+#import <WebKit/IFNSEventExtras.h>
#import <WebKit/IFNSViewExtras.h>
#import <WebKit/IFWebController.h>
#import <WebKit/IFWebCoreBridge.h>
@@ -521,6 +522,12 @@
WEBKITDEBUGLEVEL(WEBKIT_LOG_EVENTS, "keyDown: %s\n", DEBUG_OBJECT(event));
int state = 0;
+ // If this is a scroll event, pass it to the IFWebView to cause a scroll
+ if([event _IF_isScrollEvent]){
+ [[self nextResponder] keyDown:event];
+ return;
+ }
+
[self _addModifiers:[event modifierFlags] toState:&state];
QKeyEvent kEvent(QEvent::KeyPress, 0, 0, state, NSSTRING_TO_QSTRING([event characters]), [event isARepeat], 1);
@@ -535,6 +542,12 @@
WEBKITDEBUGLEVEL(WEBKIT_LOG_EVENTS, "keyUp: %s\n", DEBUG_OBJECT(event));
int state = 0;
+ // If this is a scroll event, pass it to the IFWebView to cause a scroll
+ if([event _IF_isScrollEvent]){
+ [[self nextResponder] keyUp:event];
+ return;
+ }
+
[self _addModifiers:[event modifierFlags] toState:&state];
QKeyEvent kEvent(QEvent::KeyPress, 0, 0, state, NSSTRING_TO_QSTRING([event characters]), [event isARepeat], 1);
diff --git a/WebKit/WebView.subproj/IFWebView.mm b/WebKit/WebView.subproj/IFWebView.mm
index 1416e15..74cadaf 100644
--- a/WebKit/WebView.subproj/IFWebView.mm
+++ b/WebKit/WebView.subproj/IFWebView.mm
@@ -82,13 +82,11 @@
return [[self frameScrollView] allowsScrolling];
}
-
- frameScrollView
{
return _private->frameScrollView;
}
-
- documentView
{
return [[self frameScrollView] documentView];
@@ -201,6 +199,11 @@
return nil;
}
+-(BOOL)acceptsFirstResponder
+{
+ return YES;
+}
+
- (BOOL)isOpaque
{
return YES;
@@ -226,4 +229,43 @@
return window;
}
+- (void)keyDown: (NSEvent *)event
+{
+ if ([event type] == NSKeyDown) {
+ NSString *characters = [event characters];
+ int index, count;
+
+ count = [characters length];
+ for (index = 0; index < count; ++index) {
+ switch ([characters characterAtIndex:index]) {
+ case NSPageUpFunctionKey:
+ [self _pageUp];
+ break;
+ case NSPageDownFunctionKey:
+ [self _pageDown];
+ break;
+ case NSHomeFunctionKey:
+ [self _scrollToTopLeft];
+ break;
+ case NSEndFunctionKey:
+ [self _scrollToBottomLeft];
+ break;
+ case NSUpArrowFunctionKey:
+ [self _lineUp];
+ break;
+ case NSDownArrowFunctionKey:
+ [self _lineDown];
+ break;
+ case NSLeftArrowFunctionKey:
+ [self _lineLeft];
+ break;
+ case NSRightArrowFunctionKey:
+ [self _lineRight];
+ break;
+ default: break;
+ }
+ }
+ }
+}
+
@end
diff --git a/WebKit/WebView.subproj/IFWebViewPrivate.h b/WebKit/WebView.subproj/IFWebViewPrivate.h
index 1befe28..683e5a2 100644
--- a/WebKit/WebView.subproj/IFWebViewPrivate.h
+++ b/WebKit/WebView.subproj/IFWebViewPrivate.h
@@ -36,6 +36,17 @@ class QWidget;
- (int)_marginHeight;
- (void)_setMarginWidth:(int)w;
- (void)_setMarginHeight:(int)h;
+- (NSClipView *)_contentView;
+- (void)_scrollLineVertically: (BOOL)up;
+- (void)_scrollLineHorizontally: (BOOL)left;
+- (void)_pageDown;
+- (void)_pageUp;
+- (void)_scrollToTopLeft;
+- (void)_scrollToBottomLeft;
+- (void)_lineDown;
+- (void)_lineUp;
+- (void)_lineLeft;
+- (void)_lineRight;
+ (NSMutableDictionary *)_viewTypes;
+ (BOOL)_canShowMIMEType:(NSString *)MIMEType;
@end
diff --git a/WebKit/WebView.subproj/IFWebViewPrivate.mm b/WebKit/WebView.subproj/IFWebViewPrivate.mm
index 10cecbb..07344cc 100644
--- a/WebKit/WebView.subproj/IFWebViewPrivate.mm
+++ b/WebKit/WebView.subproj/IFWebViewPrivate.mm
@@ -75,6 +75,108 @@ static NSMutableDictionary *_viewTypes=nil;
return _private->controller;
}
+- (NSClipView *)_contentView
+{
+ return [[self frameScrollView] contentView];
+}
+
+- (void)_scrollVerticallyBy: (float)delta
+{
+ NSPoint point;
+
+ point = [[self _contentView] bounds].origin;
+ point.y += delta;
+ [[self _contentView] scrollPoint: point];
+}
+
+- (void)_scrollHorizontallyBy: (float)delta
+{
+ NSPoint point;
+
+ point = [[self _contentView] bounds].origin;
+ point.x += delta;
+ [[self _contentView] scrollPoint: point];
+}
+
+- (void)_pageVertically: (BOOL)up
+{
+ float pageOverlap = [[self frameScrollView] verticalPageScroll];
+ float delta = [[self _contentView] bounds].size.height;
+
+ delta = (delta < pageOverlap) ? delta / 2.0 : delta - pageOverlap;
+
+ if (up) {
+ delta = -delta;
+ }
+
+ [self _scrollVerticallyBy: delta];
+}
+
+- (void)_scrollLineVertically: (BOOL)up
+{
+ // verticalLineScroll is quite small, to make scrolling from the scroll bar
+ // arrows relatively smooth. But this seemed too small for scrolling with
+ // the arrow keys, so we bump up the number here. Cheating? Perhaps.
+ float delta = [[self frameScrollView] verticalLineScroll] * 4;
+
+ if (up) {
+ delta = -delta;
+ }
+
+ [self _scrollVerticallyBy: delta];
+}
+
+- (void)_scrollLineHorizontally: (BOOL)left
+{
+ float delta = [[self frameScrollView] horizontalLineScroll] * 4;
+
+ if (left) {
+ delta = -delta;
+ }
+
+ [self _scrollHorizontallyBy: delta];
+}
+
+- (void)_pageDown
+{
+ [self _pageVertically: NO];
+}
+
+- (void)_pageUp
+{
+ [self _pageVertically: YES];
+}
+
+- (void)_scrollToTopLeft
+{
+ [[self _contentView] scrollPoint: NSMakePoint(0, 0)];
+}
+
+- (void)_scrollToBottomLeft
+{
+ [[self _contentView] scrollPoint: NSMakePoint(0, [[self _contentView] bounds].size.height)];
+}
+
+- (void)_lineDown
+{
+ [self _scrollLineVertically: NO];
+}
+
+- (void)_lineUp
+{
+ [self _scrollLineVertically: YES];
+}
+
+- (void)_lineLeft
+{
+ [self _scrollLineHorizontally: YES];
+}
+
+- (void)_lineRight
+{
+ [self _scrollLineHorizontally: NO];
+}
+
+ (NSMutableDictionary *)_viewTypes
{
if(!_viewTypes){
diff --git a/WebKit/WebView.subproj/WebFrameView.m b/WebKit/WebView.subproj/WebFrameView.m
index 1416e15..74cadaf 100644
--- a/WebKit/WebView.subproj/WebFrameView.m
+++ b/WebKit/WebView.subproj/WebFrameView.m
@@ -82,13 +82,11 @@
return [[self frameScrollView] allowsScrolling];
}
-
- frameScrollView
{
return _private->frameScrollView;
}
-
- documentView
{
return [[self frameScrollView] documentView];
@@ -201,6 +199,11 @@
return nil;
}
+-(BOOL)acceptsFirstResponder
+{
+ return YES;
+}
+
- (BOOL)isOpaque
{
return YES;
@@ -226,4 +229,43 @@
return window;
}
+- (void)keyDown: (NSEvent *)event
+{
+ if ([event type] == NSKeyDown) {
+ NSString *characters = [event characters];
+ int index, count;
+
+ count = [characters length];
+ for (index = 0; index < count; ++index) {
+ switch ([characters characterAtIndex:index]) {
+ case NSPageUpFunctionKey:
+ [self _pageUp];
+ break;
+ case NSPageDownFunctionKey:
+ [self _pageDown];
+ break;
+ case NSHomeFunctionKey:
+ [self _scrollToTopLeft];
+ break;
+ case NSEndFunctionKey:
+ [self _scrollToBottomLeft];
+ break;
+ case NSUpArrowFunctionKey:
+ [self _lineUp];
+ break;
+ case NSDownArrowFunctionKey:
+ [self _lineDown];
+ break;
+ case NSLeftArrowFunctionKey:
+ [self _lineLeft];
+ break;
+ case NSRightArrowFunctionKey:
+ [self _lineRight];
+ break;
+ default: break;
+ }
+ }
+ }
+}
+
@end
diff --git a/WebKit/WebView.subproj/WebFrameViewInternal.h b/WebKit/WebView.subproj/WebFrameViewInternal.h
index 1befe28..683e5a2 100644
--- a/WebKit/WebView.subproj/WebFrameViewInternal.h
+++ b/WebKit/WebView.subproj/WebFrameViewInternal.h
@@ -36,6 +36,17 @@ class QWidget;
- (int)_marginHeight;
- (void)_setMarginWidth:(int)w;
- (void)_setMarginHeight:(int)h;
+- (NSClipView *)_contentView;
+- (void)_scrollLineVertically: (BOOL)up;
+- (void)_scrollLineHorizontally: (BOOL)left;
+- (void)_pageDown;
+- (void)_pageUp;
+- (void)_scrollToTopLeft;
+- (void)_scrollToBottomLeft;
+- (void)_lineDown;
+- (void)_lineUp;
+- (void)_lineLeft;
+- (void)_lineRight;
+ (NSMutableDictionary *)_viewTypes;
+ (BOOL)_canShowMIMEType:(NSString *)MIMEType;
@end
diff --git a/WebKit/WebView.subproj/WebFrameViewPrivate.h b/WebKit/WebView.subproj/WebFrameViewPrivate.h
index 1befe28..683e5a2 100644
--- a/WebKit/WebView.subproj/WebFrameViewPrivate.h
+++ b/WebKit/WebView.subproj/WebFrameViewPrivate.h
@@ -36,6 +36,17 @@ class QWidget;
- (int)_marginHeight;
- (void)_setMarginWidth:(int)w;
- (void)_setMarginHeight:(int)h;
+- (NSClipView *)_contentView;
+- (void)_scrollLineVertically: (BOOL)up;
+- (void)_scrollLineHorizontally: (BOOL)left;
+- (void)_pageDown;
+- (void)_pageUp;
+- (void)_scrollToTopLeft;
+- (void)_scrollToBottomLeft;
+- (void)_lineDown;
+- (void)_lineUp;
+- (void)_lineLeft;
+- (void)_lineRight;
+ (NSMutableDictionary *)_viewTypes;
+ (BOOL)_canShowMIMEType:(NSString *)MIMEType;
@end
diff --git a/WebKit/WebView.subproj/WebFrameViewPrivate.m b/WebKit/WebView.subproj/WebFrameViewPrivate.m
index 10cecbb..07344cc 100644
--- a/WebKit/WebView.subproj/WebFrameViewPrivate.m
+++ b/WebKit/WebView.subproj/WebFrameViewPrivate.m
@@ -75,6 +75,108 @@ static NSMutableDictionary *_viewTypes=nil;
return _private->controller;
}
+- (NSClipView *)_contentView
+{
+ return [[self frameScrollView] contentView];
+}
+
+- (void)_scrollVerticallyBy: (float)delta
+{
+ NSPoint point;
+
+ point = [[self _contentView] bounds].origin;
+ point.y += delta;
+ [[self _contentView] scrollPoint: point];
+}
+
+- (void)_scrollHorizontallyBy: (float)delta
+{
+ NSPoint point;
+
+ point = [[self _contentView] bounds].origin;
+ point.x += delta;
+ [[self _contentView] scrollPoint: point];
+}
+
+- (void)_pageVertically: (BOOL)up
+{
+ float pageOverlap = [[self frameScrollView] verticalPageScroll];
+ float delta = [[self _contentView] bounds].size.height;
+
+ delta = (delta < pageOverlap) ? delta / 2.0 : delta - pageOverlap;
+
+ if (up) {
+ delta = -delta;
+ }
+
+ [self _scrollVerticallyBy: delta];
+}
+
+- (void)_scrollLineVertically: (BOOL)up
+{
+ // verticalLineScroll is quite small, to make scrolling from the scroll bar
+ // arrows relatively smooth. But this seemed too small for scrolling with
+ // the arrow keys, so we bump up the number here. Cheating? Perhaps.
+ float delta = [[self frameScrollView] verticalLineScroll] * 4;
+
+ if (up) {
+ delta = -delta;
+ }
+
+ [self _scrollVerticallyBy: delta];
+}
+
+- (void)_scrollLineHorizontally: (BOOL)left
+{
+ float delta = [[self frameScrollView] horizontalLineScroll] * 4;
+
+ if (left) {
+ delta = -delta;
+ }
+
+ [self _scrollHorizontallyBy: delta];
+}
+
+- (void)_pageDown
+{
+ [self _pageVertically: NO];
+}
+
+- (void)_pageUp
+{
+ [self _pageVertically: YES];
+}
+
+- (void)_scrollToTopLeft
+{
+ [[self _contentView] scrollPoint: NSMakePoint(0, 0)];
+}
+
+- (void)_scrollToBottomLeft
+{
+ [[self _contentView] scrollPoint: NSMakePoint(0, [[self _contentView] bounds].size.height)];
+}
+
+- (void)_lineDown
+{
+ [self _scrollLineVertically: NO];
+}
+
+- (void)_lineUp
+{
+ [self _scrollLineVertically: YES];
+}
+
+- (void)_lineLeft
+{
+ [self _scrollLineHorizontally: YES];
+}
+
+- (void)_lineRight
+{
+ [self _scrollLineHorizontally: NO];
+}
+
+ (NSMutableDictionary *)_viewTypes
{
if(!_viewTypes){
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 72a508c..7061417 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -6,6 +6,7 @@
#import <WebKit/IFDynamicScrollBarsView.h>
#import <WebKit/IFException.h>
#import <WebKit/IFHTMLViewPrivate.h>
+#import <WebKit/IFNSEventExtras.h>
#import <WebKit/IFNSViewExtras.h>
#import <WebKit/IFWebController.h>
#import <WebKit/IFWebCoreBridge.h>
@@ -521,6 +522,12 @@
WEBKITDEBUGLEVEL(WEBKIT_LOG_EVENTS, "keyDown: %s\n", DEBUG_OBJECT(event));
int state = 0;
+ // If this is a scroll event, pass it to the IFWebView to cause a scroll
+ if([event _IF_isScrollEvent]){
+ [[self nextResponder] keyDown:event];
+ return;
+ }
+
[self _addModifiers:[event modifierFlags] toState:&state];
QKeyEvent kEvent(QEvent::KeyPress, 0, 0, state, NSSTRING_TO_QSTRING([event characters]), [event isARepeat], 1);
@@ -535,6 +542,12 @@
WEBKITDEBUGLEVEL(WEBKIT_LOG_EVENTS, "keyUp: %s\n", DEBUG_OBJECT(event));
int state = 0;
+ // If this is a scroll event, pass it to the IFWebView to cause a scroll
+ if([event _IF_isScrollEvent]){
+ [[self nextResponder] keyUp:event];
+ return;
+ }
+
[self _addModifiers:[event modifierFlags] toState:&state];
QKeyEvent kEvent(QEvent::KeyPress, 0, 0, state, NSSTRING_TO_QSTRING([event characters]), [event isARepeat], 1);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list