[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:57:09 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit c5b308a8110d1bff328844e36c25248cc9f3d2cd
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Sep 23 23:19:58 2003 +0000
Reviewed by John and Richard.
- fixed 3367377 -- autoscroll only works when mouse is moving
* WebView.subproj/WebHTMLView.m:
(-[WebHTMLView viewDidMoveToWindow]): Stop the auto-scroll timer. This covers
the case where a view is removed from the view hierarchy while the mouse is down.
(-[WebHTMLView mouseDown:]): Start the auto-scroll timer.
(-[WebHTMLView mouseUp:]): Stop the auto-scroll timer.
* WebView.subproj/WebHTMLViewPrivate.h: Add an auto-scroll timer, and methods
to start and stop it.
* WebView.subproj/WebHTMLViewPrivate.m:
(-[WebHTMLView _startAutoscrollTimer]): Create and schedule a timer. It uses the
same 1/10 second interval that NSTextView uses for its scrolling timer.
(-[WebHTMLView _stopAutoscrollTimer]): Invalidate and release the timer.
(-[WebHTMLView _autoscroll]): Check for a mouse up event in the queue; if one is
there, then no autoscrlling. But if not, then create a fake mouse dragged event
and dispatch it; that will lead to autoscrolling.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5040 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index f89f8f6..9b66d37 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,24 @@
+2003-09-23 Darin Adler <darin at apple.com>
+
+ Reviewed by John and Richard.
+
+ - fixed 3367377 -- autoscroll only works when mouse is moving
+
+ * WebView.subproj/WebHTMLView.m:
+ (-[WebHTMLView viewDidMoveToWindow]): Stop the auto-scroll timer. This covers
+ the case where a view is removed from the view hierarchy while the mouse is down.
+ (-[WebHTMLView mouseDown:]): Start the auto-scroll timer.
+ (-[WebHTMLView mouseUp:]): Stop the auto-scroll timer.
+ * WebView.subproj/WebHTMLViewPrivate.h: Add an auto-scroll timer, and methods
+ to start and stop it.
+ * WebView.subproj/WebHTMLViewPrivate.m:
+ (-[WebHTMLView _startAutoscrollTimer]): Create and schedule a timer. It uses the
+ same 1/10 second interval that NSTextView uses for its scrolling timer.
+ (-[WebHTMLView _stopAutoscrollTimer]): Invalidate and release the timer.
+ (-[WebHTMLView _autoscroll]): Check for a mouse up event in the queue; if one is
+ there, then no autoscrlling. But if not, then create a fake mouse dragged event
+ and dispatch it; that will lead to autoscrolling.
+
2003-09-22 Darin Adler <darin at apple.com>
Reviewed by Dave.
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index bd278bf..2af071e 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -264,7 +264,8 @@
// when decoding a WebView. When WebViews are decoded their subviews
// are created by initWithCoder: and so won't be normally
// initialized. The stub views are discarded by WebView.
- if (_private){
+ if (_private) {
+ [self _stopAutoscrollTimer];
if ([self window]) {
[self addWindowObservers];
[self addSuperviewObservers];
@@ -637,6 +638,7 @@
}
_private->ignoringMouseDraggedEvents = NO;
+ [self _startAutoscrollTimer];
// Record the mouse down position so we can determine drag hysteresis.
[_private->mouseDownEvent release];
@@ -718,8 +720,9 @@
return [NSArray arrayWithObject:[[_private->draggingImageURL path] lastPathComponent]];
}
-- (void)mouseUp: (NSEvent *)event
+- (void)mouseUp:(NSEvent *)event
{
+ [self _stopAutoscrollTimer];
[[self _bridge] mouseUp:event];
[self _updateMouseoverWithFakeEvent];
}
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.h b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
index 1806a54..58f076c 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.h
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
@@ -40,6 +40,8 @@
NSToolTipTag toolTipTag;
id trackingRectOwner;
void *trackingRectUserData;
+
+ NSTimer *autoscrollTimer;
}
@end
@@ -79,4 +81,7 @@
- (NSRect)_selectionRect;
+- (void)_startAutoscrollTimer;
+- (void)_stopAutoscrollTimer;
+
@end
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.m b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
index 6c2fc06..d0b5afc 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.m
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
@@ -28,6 +28,8 @@
#define TextDragHysteresis 3.0
#define TextDragDelay 0.15
+#define AUTOSCROLL_INTERVAL 0.1
+
#define DRAG_LABEL_BORDER_X 4.0
#define DRAG_LABEL_BORDER_Y 2.0
#define DRAG_LABEL_RADIUS 5.0
@@ -62,6 +64,8 @@ static BOOL forceRealHitTest = NO;
- (void)dealloc
{
+ ASSERT(autoscrollTimer == nil);
+
[pluginController destroyAllPlugins];
[mouseDownEvent release];
@@ -651,6 +655,39 @@ static WebHTMLView *lastHitView = nil;
return [[self _bridge] selectionRect];
}
+- (void)_startAutoscrollTimer
+{
+ if (_private->autoscrollTimer == nil) {
+ _private->autoscrollTimer = [[NSTimer scheduledTimerWithTimeInterval:AUTOSCROLL_INTERVAL
+ target:self selector:@selector(_autoscroll) userInfo:nil repeats:YES] retain];
+ }
+}
+
+- (void)_stopAutoscrollTimer
+{
+ NSTimer *timer = _private->autoscrollTimer;
+ _private->autoscrollTimer = nil;
+ [timer invalidate];
+ [timer release];
+}
+
+- (void)_autoscroll
+{
+ NSEvent *mouseUpEvent = [NSApp nextEventMatchingMask:NSLeftMouseUpMask untilDate:nil inMode:NSEventTrackingRunLoopMode dequeue:NO];
+ if (mouseUpEvent) {
+ return;
+ }
+
+ NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSLeftMouseDragged
+ location:[[self window] convertScreenToBase:[NSEvent mouseLocation]]
+ modifierFlags:[[NSApp currentEvent] modifierFlags]
+ timestamp:[NSDate timeIntervalSinceReferenceDate]
+ windowNumber:[[self window] windowNumber]
+ context:[[NSApp currentEvent] context]
+ eventNumber:0 clickCount:0 pressure:0];
+ [self mouseDragged:fakeEvent];
+}
+
@end
@implementation NSView (WebHTMLViewPrivate)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list