[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00
adele at apple.com
adele at apple.com
Wed Mar 17 18:30:11 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 9c8eefbdb1be357ad7817662bff5ccb90f8e94b2
Author: adele at apple.com <adele at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Mar 9 19:56:14 2010 +0000
Add the ability to dispatch scroll wheel events in DRT. This was
necessary in order to write a test for
https://bugs.webkit.org/show_bug.cgi?id=34700.
Patch by Andy Estes <aestes at apple.com> on 2010-03-09
Reviewed by Adele Peterson.
* DumpRenderTree/mac/EventSendingController.mm: Add support for two
new methods to EventSender: mouseScrollBy(x, y) and
continuousMouseScrollBy(x, y). The API to generate scroll events on
the mac was added in 10.5, so these methods are NOOPs on Tiger.
(+[EventSendingController isSelectorExcludedFromWebScript:]):
Regiester mouseScrollByX:andY: and continuousMouseScrollByX:andY:
(+[EventSendingController webScriptNameForSelector:]): Map JavaScript
method names to ObjC selectors.
(-[EventSendingController mouseScrollByX:andY:continuously:]): Generate
a scroll wheel event using CGEventCreateScrollWheelEvent() and dispatch
it to WebKit.
(-[EventSendingController continuousMouseScrollByX:andY:]): Generate a
continuous scrolling event by x and y pixels.
(-[EventSendingController mouseScrollByX:andY:]): Generate a notchy
scrolling event by x and y lines.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55739 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index e881cd0..4a68eba 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,27 @@
+2010-03-09 Andy Estes <aestes at apple.com>
+
+ Reviewed by Adele Peterson.
+
+ Add the ability to dispatch scroll wheel events in DRT. This was
+ necessary in order to write a test for
+ https://bugs.webkit.org/show_bug.cgi?id=34700.
+
+ * DumpRenderTree/mac/EventSendingController.mm: Add support for two
+ new methods to EventSender: mouseScrollBy(x, y) and
+ continuousMouseScrollBy(x, y). The API to generate scroll events on
+ the mac was added in 10.5, so these methods are NOOPs on Tiger.
+ (+[EventSendingController isSelectorExcludedFromWebScript:]):
+ Regiester mouseScrollByX:andY: and continuousMouseScrollByX:andY:
+ (+[EventSendingController webScriptNameForSelector:]): Map JavaScript
+ method names to ObjC selectors.
+ (-[EventSendingController mouseScrollByX:andY:continuously:]): Generate
+ a scroll wheel event using CGEventCreateScrollWheelEvent() and dispatch
+ it to WebKit.
+ (-[EventSendingController continuousMouseScrollByX:andY:]): Generate a
+ continuous scrolling event by x and y pixels.
+ (-[EventSendingController mouseScrollByX:andY:]): Generate a notchy
+ scrolling event by x and y lines.
+
2010-03-09 Chris Fleizach <cfleizach at apple.com>
DRT build fix for Tiger. No review.
diff --git a/WebKitTools/DumpRenderTree/mac/EventSendingController.mm b/WebKitTools/DumpRenderTree/mac/EventSendingController.mm
index feaeddc..6ff5abf 100644
--- a/WebKitTools/DumpRenderTree/mac/EventSendingController.mm
+++ b/WebKitTools/DumpRenderTree/mac/EventSendingController.mm
@@ -134,7 +134,9 @@ BOOL replayingSavedEvents;
|| aSelector == @selector(textZoomIn)
|| aSelector == @selector(textZoomOut)
|| aSelector == @selector(zoomPageIn)
- || aSelector == @selector(zoomPageOut))
+ || aSelector == @selector(zoomPageOut)
+ || aSelector == @selector(mouseScrollByX:andY:)
+ || aSelector == @selector(continuousMouseScrollByX:andY:))
return NO;
return YES;
}
@@ -166,6 +168,10 @@ BOOL replayingSavedEvents;
return @"mouseMoveTo";
if (aSelector == @selector(setDragMode:))
return @"setDragMode";
+ if (aSelector == @selector(mouseScrollByX:andY:))
+ return @"mouseScrollBy";
+ if (aSelector == @selector(continuousMouseScrollByX:andY:))
+ return @"continuousMouseScrollBy";
return nil;
}
@@ -453,6 +459,39 @@ static int buildModifierFlags(const WebScriptObject* modifiers)
}
}
+- (void)mouseScrollByX:(int)x andY:(int)y continuously:(BOOL)c
+{
+ // CGEventCreateScrollWheelEvent() was introduced in 10.5
+#if !defined(BUILDING_ON_TIGER)
+ CGScrollEventUnit unit = c?kCGScrollEventUnitPixel:kCGScrollEventUnitLine;
+ CGEventRef cgScrollEvent = CGEventCreateScrollWheelEvent(NULL, unit, 2, y, x);
+
+ // CGEvent locations are in global display coordinates.
+ CGPoint lastGlobalMousePosition = {
+ lastMousePosition.x,
+ [[NSScreen mainScreen] frame].size.height - lastMousePosition.y
+ };
+ CGEventSetLocation(cgScrollEvent, lastGlobalMousePosition);
+
+ NSEvent *scrollEvent = [NSEvent eventWithCGEvent:cgScrollEvent];
+ CFRelease(cgScrollEvent);
+
+ NSView *subView = [[mainFrame webView] hitTest:[scrollEvent locationInWindow]];
+ if (subView)
+ [subView scrollWheel:scrollEvent];
+#endif
+}
+
+- (void)continuousMouseScrollByX:(int)x andY:(int)y
+{
+ [self mouseScrollByX:x andY:y continuously:YES];
+}
+
+- (void)mouseScrollByX:(int)x andY:(int)y
+{
+ [self mouseScrollByX:x andY:y continuously:NO];
+}
+
- (void)contextClick
{
[[[mainFrame frameView] documentView] layout];
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list