Title: [154949] trunk
Revision
154949
Author
[email protected]
Date
2013-09-01 23:36:21 -0700 (Sun, 01 Sep 2013)

Log Message

        [WK2][Mac] Drag and drop tests interfere with user's UI
        https://bugs.webkit.org/show_bug.cgi?id=120538

        Reviewed by Dan Bernstein.

        This makes running WebKit2 regression tests locally more viable. The patch doesn't
        fix drag and drop tests to work as expected, I posted some thought about that in
        <https://bugs.webkit.org/show_bug.cgi?id=68552>.

        * WebKitTestRunner/EventSenderProxy.h:
        (WTR::EventSenderProxy::position):
        * WebKitTestRunner/TestController.h:
        (WTR::TestController::eventSenderProxy):
        Expose a way to get current mouse position from anywhere in WKTR code.

        * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: Added new files.

        * WebKitTestRunner/mac/EventSenderProxy.mm: (WTR::EventSenderProxy::mouseUp):
        Copied a FIXME comment from DumpRenderTree.

        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
        (-[TestRunnerWKView dragImage:at:offset:event:pasteboard:source:slideBack:]):
        Override drag initiation, using a custom NSDraggingInfo implementation.

        * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::TestController::platformInitialize):
        Replace NSEvent with a custom class.

        * WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.h: Added.
        * WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.mm: Added.
        * WebKitTestRunner/mac/WebKitTestRunnerEvent.h: Added.
        * WebKitTestRunner/mac/WebKitTestRunnerEvent.mm: Added.
        Largely a copy of DumpRenderTree classes, modified to not use global variables.
        We should consider making these variables static in EventSenderProxy though, as
        it's strange that mouse state in WKTR is reset between tests without WebKit ever
        being told about that.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (154948 => 154949)


--- trunk/Source/WebKit2/ChangeLog	2013-09-02 04:53:46 UTC (rev 154948)
+++ trunk/Source/WebKit2/ChangeLog	2013-09-02 06:36:21 UTC (rev 154949)
@@ -1,3 +1,16 @@
+2013-09-01  Alexey Proskuryakov  <[email protected]>
+
+        [WK2][Mac] Drag and drop tests interfere with user's UI
+        https://bugs.webkit.org/show_bug.cgi?id=120538
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/API/mac/WKView.mm: (-[WKView _setDragImage:at:linkDrag:]): Make it possible
+        to override drag initiation in subclasses. It is a bit unfortunate that this exposes
+        a deprecated API that we call, but probably not unfortunate enough to invent a new
+        scary looking name for the same function, and conditionally call that if implemented
+        by subclass.
+
 2013-08-31  Santosh Mahto  <[email protected]>
 
         warning: unused parameter point and area in EwkView.cpp:1390

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (154948 => 154949)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-09-02 04:53:46 UTC (rev 154948)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-09-02 06:36:21 UTC (rev 154949)
@@ -2754,16 +2754,16 @@
     size.scale(1.0 / _data->_page->deviceScaleFactor());
     [image setSize:size];
     
-    // The call to super could release this WKView.
+    // The call below could release this WKView.
     RetainPtr<WKView> protector(self);
     
-    [super dragImage:image
-                  at:clientPoint
-              offset:NSZeroSize
-               event:(linkDrag) ? [NSApp currentEvent] :_data->_mouseDownEvent
-          pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard]
-              source:self
-           slideBack:YES];
+    [self dragImage:image
+                 at:clientPoint
+             offset:NSZeroSize
+              event:(linkDrag) ? [NSApp currentEvent] :_data->_mouseDownEvent
+         pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard]
+             source:self
+          slideBack:YES];
 }
 
 static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension)

Modified: trunk/Tools/ChangeLog (154948 => 154949)


--- trunk/Tools/ChangeLog	2013-09-02 04:53:46 UTC (rev 154948)
+++ trunk/Tools/ChangeLog	2013-09-02 06:36:21 UTC (rev 154949)
@@ -1,3 +1,41 @@
+2013-09-01  Alexey Proskuryakov  <[email protected]>
+
+        [WK2][Mac] Drag and drop tests interfere with user's UI
+        https://bugs.webkit.org/show_bug.cgi?id=120538
+
+        Reviewed by Dan Bernstein.
+
+        This makes running WebKit2 regression tests locally more viable. The patch doesn't
+        fix drag and drop tests to work as expected, I posted some thought about that in
+        <https://bugs.webkit.org/show_bug.cgi?id=68552>.
+
+        * WebKitTestRunner/EventSenderProxy.h:
+        (WTR::EventSenderProxy::position):
+        * WebKitTestRunner/TestController.h:
+        (WTR::TestController::eventSenderProxy):
+        Expose a way to get current mouse position from anywhere in WKTR code.
+
+        * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: Added new files.
+
+        * WebKitTestRunner/mac/EventSenderProxy.mm: (WTR::EventSenderProxy::mouseUp):
+        Copied a FIXME comment from DumpRenderTree.
+
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (-[TestRunnerWKView dragImage:at:offset:event:pasteboard:source:slideBack:]):
+        Override drag initiation, using a custom NSDraggingInfo implementation.
+
+        * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::TestController::platformInitialize):
+        Replace NSEvent with a custom class.
+
+        * WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.h: Added.
+        * WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.mm: Added.
+        * WebKitTestRunner/mac/WebKitTestRunnerEvent.h: Added.
+        * WebKitTestRunner/mac/WebKitTestRunnerEvent.mm: Added.
+        Largely a copy of DumpRenderTree classes, modified to not use global variables.
+        We should consider making these variables static in EventSenderProxy though, as
+        it's strange that mouse state in WKTR is reset between tests without WebKit ever
+        being told about that.
+
 2013-08-30  Brent Fulgham  <[email protected]>
 
         [Windows] Unreviewed build fix.

Modified: trunk/Tools/WebKitTestRunner/EventSenderProxy.h (154948 => 154949)


--- trunk/Tools/WebKitTestRunner/EventSenderProxy.h	2013-09-02 04:53:46 UTC (rev 154948)
+++ trunk/Tools/WebKitTestRunner/EventSenderProxy.h	2013-09-02 06:36:21 UTC (rev 154949)
@@ -27,15 +27,15 @@
 #ifndef EventSenderProxy_h
 #define EventSenderProxy_h
 
+#include <wtf/Deque.h>
+
 #if PLATFORM(QT)
 #include <QEvent>
 #include <QTouchEvent>
 #elif PLATFORM(GTK)
 #include <gdk/gdk.h>
-#include <wtf/Deque.h>
 #elif PLATFORM(EFL)
 #include <WebKit2/EWebKit2.h>
-#include <wtf/Deque.h>
 #endif
 
 namespace WTR {
@@ -53,6 +53,8 @@
     explicit EventSenderProxy(TestController*);
     ~EventSenderProxy();
 
+    WKPoint position() const { return m_position; }
+
     void mouseDown(unsigned button, WKEventModifiers);
     void mouseUp(unsigned button, WKEventModifiers);
     void mouseMoveTo(double x, double y);

Modified: trunk/Tools/WebKitTestRunner/TestController.h (154948 => 154949)


--- trunk/Tools/WebKitTestRunner/TestController.h	2013-09-02 04:53:46 UTC (rev 154948)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2013-09-02 06:36:21 UTC (rev 154949)
@@ -63,6 +63,8 @@
     PlatformWebView* mainWebView() { return m_mainWebView.get(); }
     WKContextRef context() { return m_context.get(); }
 
+    EventSenderProxy* eventSenderProxy() { return m_eventSenderProxy.get(); }
+
     void ensureViewSupportsOptions(WKDictionaryRef options);
     
     // Runs the run loop until `done` is true or the timeout elapses.

Modified: trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj (154948 => 154949)


--- trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj	2013-09-02 04:53:46 UTC (rev 154948)
+++ trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj	2013-09-02 06:36:21 UTC (rev 154949)
@@ -85,6 +85,8 @@
 		BCD7D2F811921278006DB7EE /* TestInvocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD7D2F711921278006DB7EE /* TestInvocation.cpp */; };
 		BCDA2B9A1191051F00C3BC47 /* _javascript_Core.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCDA2B991191051F00C3BC47 /* _javascript_Core.framework */; };
 		C0CE720B1247C93300BC0EC4 /* TestRunnerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0CE720A1247C93300BC0EC4 /* TestRunnerMac.mm */; };
+		E132AA3A17CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = E132AA3817CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.mm */; };
+		E132AA3D17CE776F00611DF0 /* WebKitTestRunnerEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = E132AA3B17CE776F00611DF0 /* WebKitTestRunnerEvent.mm */; };
 		E1BA671E1742DA6A00C20251 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1BA671D1742DA5A00C20251 /* Carbon.framework */; };
 		E1C642C317CBCC7300D66A3C /* PoseAsClass.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1C642C117CBCC7300D66A3C /* PoseAsClass.mm */; };
 		E1C642C617CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1C642C417CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm */; };
@@ -221,6 +223,10 @@
 		BCD7D2F711921278006DB7EE /* TestInvocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestInvocation.cpp; sourceTree = "<group>"; };
 		BCDA2B991191051F00C3BC47 /* _javascript_Core.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = _javascript_Core.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		C0CE720A1247C93300BC0EC4 /* TestRunnerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestRunnerMac.mm; path = mac/TestRunnerMac.mm; sourceTree = "<group>"; };
+		E132AA3817CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitTestRunnerDraggingInfo.mm; sourceTree = "<group>"; };
+		E132AA3917CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitTestRunnerDraggingInfo.h; sourceTree = "<group>"; };
+		E132AA3B17CE776F00611DF0 /* WebKitTestRunnerEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitTestRunnerEvent.mm; sourceTree = "<group>"; };
+		E132AA3C17CE776F00611DF0 /* WebKitTestRunnerEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitTestRunnerEvent.h; sourceTree = "<group>"; };
 		E1BA671D1742DA5A00C20251 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; };
 		E1C642C117CBCC7300D66A3C /* PoseAsClass.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PoseAsClass.mm; sourceTree = "<group>"; };
 		E1C642C217CBCC7300D66A3C /* PoseAsClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PoseAsClass.h; sourceTree = "<group>"; };
@@ -422,11 +428,15 @@
 				5670B8271386FCA5002EB355 /* EventSenderProxy.mm */,
 				BC7933FF118F7C84005EA8E2 /* main.mm */,
 				BC7934E711906846005EA8E2 /* PlatformWebViewMac.mm */,
+				E1C642C217CBCC7300D66A3C /* PoseAsClass.h */,
 				E1C642C117CBCC7300D66A3C /* PoseAsClass.mm */,
-				E1C642C217CBCC7300D66A3C /* PoseAsClass.h */,
 				BC8C795B11D2785D004535A1 /* TestControllerMac.mm */,
+				E132AA3917CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.h */,
+				E132AA3817CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.mm */,
+				E132AA3C17CE776F00611DF0 /* WebKitTestRunnerEvent.h */,
+				E132AA3B17CE776F00611DF0 /* WebKitTestRunnerEvent.mm */,
+				E1C642C517CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.h */,
 				E1C642C417CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm */,
-				E1C642C517CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.h */,
 			);
 			path = mac;
 			sourceTree = "<group>";
@@ -545,8 +555,6 @@
 /* Begin PBXProject section */
 		08FB7793FE84155DC02AAC07 /* Project object */ = {
 			isa = PBXProject;
-			attributes = {
-			};
 			buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "WebKitTestRunner" */;
 			compatibilityVersion = "Xcode 3.1";
 			developmentRegion = English;
@@ -613,6 +621,7 @@
 			files = (
 				5322FB4313FDA0CD0041ABCC /* CyclicRedundancyCheck.cpp in Sources */,
 				E1C642C317CBCC7300D66A3C /* PoseAsClass.mm in Sources */,
+				E132AA3D17CE776F00611DF0 /* WebKitTestRunnerEvent.mm in Sources */,
 				5670B8281386FCA5002EB355 /* EventSenderProxy.mm in Sources */,
 				26D758E7160BECDD00268472 /* GeolocationProviderMock.cpp in Sources */,
 				BC793400118F7C84005EA8E2 /* main.mm in Sources */,
@@ -623,6 +632,7 @@
 				BC8C795C11D2785D004535A1 /* TestControllerMac.mm in Sources */,
 				BCD7D2F811921278006DB7EE /* TestInvocation.cpp in Sources */,
 				BC9192051333E4F8003011DC /* TestInvocationCG.cpp in Sources */,
+				E132AA3A17CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.mm in Sources */,
 				3164C8F015D1ADA100EF1FE0 /* WebNotificationProvider.cpp in Sources */,
 				4429FC5F1627089600F66D8B /* WorkQueueManager.cpp in Sources */,
 			);

Modified: trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm (154948 => 154949)


--- trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm	2013-09-02 04:53:46 UTC (rev 154948)
+++ trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm	2013-09-02 06:36:21 UTC (rev 154949)
@@ -30,9 +30,9 @@
 #import "PlatformWebView.h"
 #import "StringFunctions.h"
 #import "TestController.h"
-#import <wtf/RetainPtr.h>
 #import <Carbon/Carbon.h>
 #import <WebKit2/WKString.h>
+#import <wtf/RetainPtr.h>
 
 namespace WTR {
 
@@ -179,8 +179,11 @@
                                         pressure:0.0];
 
     NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:[event locationInWindow]];
+    // FIXME: Silly hack to teach WKTR to respect capturing mouse events outside the WKView.
+    // The right solution is just to use NSApplication's built-in event sending methods, 
+    // instead of rolling our own algorithm for selecting an event target.
     targetView = targetView ? targetView : m_testController->mainWebView()->platformView();
-    assert(targetView);
+    ASSERT(targetView);
     [targetView mouseUp:event];
     if (buttonNumber == LeftMouseButton)
         m_leftMouseButtonDown = false;

Modified: trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm (154948 => 154949)


--- trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm	2013-09-02 04:53:46 UTC (rev 154948)
+++ trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm	2013-09-02 06:36:21 UTC (rev 154949)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2013 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -23,19 +23,22 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
-#include "PlatformWebView.h"
-#include "TestController.h"
+#import "config.h"
+#import "PlatformWebView.h"
 
+#import "TestController.h"
+#import "WebKitTestRunnerDraggingInfo.h"
 #import <WebKit2/WKImageCG.h>
 #import <WebKit2/WKViewPrivate.h>
 #import <wtf/RetainPtr.h>
 
+using namespace WTR;
+
 @interface WebKitTestRunnerWindow : NSWindow {
-    WTR::PlatformWebView* _platformWebView;
+    PlatformWebView* _platformWebView;
     NSPoint _fakeOrigin;
 }
-@property (nonatomic, assign) WTR::PlatformWebView* platformWebView;
+@property (nonatomic, assign) PlatformWebView* platformWebView;
 @end
 
 @interface TestRunnerWKView : WKView {
@@ -62,6 +65,12 @@
     return _useTiledDrawing;
 }
 
+- (void)dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag
+{
+    RetainPtr<WebKitTestRunnerDraggingInfo> draggingInfo = adoptNS([[WebKitTestRunnerDraggingInfo alloc] initWithImage:anImage offset:initialOffset pasteboard:pboard source:sourceObj]);
+    [self draggingUpdated:draggingInfo.get()];
+}
+
 @end
 
 @implementation WebKitTestRunnerWindow

Modified: trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm (154948 => 154949)


--- trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm	2013-09-02 04:53:46 UTC (rev 154948)
+++ trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm	2013-09-02 06:36:21 UTC (rev 154949)
@@ -41,6 +41,7 @@
 void TestController::platformInitialize()
 {
     poseAsClass("WebKitTestRunnerPasteboard", "NSPasteboard");
+    poseAsClass("WebKitTestRunnerEvent", "NSEvent");
 }
 
 void TestController::platformDestroy()

Added: trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.h (0 => 154949)


--- trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.h	                        (rev 0)
+++ trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.h	2013-09-02 06:36:21 UTC (rev 154949)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2005, 2006, 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+@interface WebKitTestRunnerDraggingInfo : NSObject <NSDraggingInfo> {
+@private
+    NSSize _offset;
+    NSImage *_draggedImage;
+    NSPasteboard *_draggingPasteboard;
+    id _draggingSource;
+}
+
+- (id)initWithImage:(NSImage *)image offset:(NSSize)offset pasteboard:(NSPasteboard *)pasteboard source:(id)source;
+
+- (NSWindow *)draggingDestinationWindow;
+- (NSDragOperation)draggingSourceOperationMask;
+- (NSPoint)draggingLocation;
+- (NSPoint)draggedImageLocation;
+- (NSImage *)draggedImage;
+- (NSPasteboard *)draggingPasteboard;
+- (id)draggingSource;
+- (int)draggingSequenceNumber;
+
+- (void)slideDraggedImageTo:(NSPoint)screenPoint;
+- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination;
+@end
Property changes on: trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.h
___________________________________________________________________

Added: svn:eol-style

Added: trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.mm (0 => 154949)


--- trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.mm	                        (rev 0)
+++ trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.mm	2013-09-02 06:36:21 UTC (rev 154949)
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2005, 2006, 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WebKitTestRunnerDraggingInfo.h"
+
+#import "EventSenderProxy.h"
+#import "PlatformWebView.h"
+#import "TestController.h"
+
+using namespace WTR;
+
+@implementation WebKitTestRunnerDraggingInfo
+
+- (id)initWithImage:(NSImage *)image offset:(NSSize)offset pasteboard:(NSPasteboard *)pasteboard source:(id)source
+{
+    self = [super init];
+    if (!self)
+        return nil;
+
+    _draggedImage = [image retain];
+    _draggingPasteboard = [pasteboard retain];
+    _draggingSource = [source retain];
+    _offset = offset;
+    
+    return self;
+}
+
+- (void)dealloc
+{
+    [_draggedImage release];
+    [_draggingPasteboard release];
+    [_draggingSource release];
+    [super dealloc];
+}
+
+- (NSWindow *)draggingDestinationWindow 
+{
+    return [TestController::shared().mainWebView()->platformView() window];
+}
+
+- (NSDragOperation)draggingSourceOperationMask 
+{
+    // WKView currently implements neither draggingSourceOperationMaskForLocal: nor draggingSession:sourceOperationMaskForDraggingContext:.
+    return NSDragOperationAll;
+}
+
+- (NSPoint)draggingLocation
+{
+    WKPoint location = TestController::shared().eventSenderProxy()->position();
+    return NSMakePoint(location.x, location.y);
+}
+
+- (NSPoint)draggedImageLocation 
+{
+    WKPoint location = TestController::shared().eventSenderProxy()->position();
+    return NSMakePoint(location.x + _offset.width, location.y + _offset.height);
+}
+
+- (NSImage *)draggedImage
+{
+    return _draggedImage;
+}
+
+- (NSPasteboard *)draggingPasteboard
+{
+    return _draggingPasteboard;
+}
+
+- (id)draggingSource
+{
+    return _draggingSource;
+}
+
+- (int)draggingSequenceNumber
+{
+    NSLog(@"WebKitTestRunner doesn't support draggingSequenceNumber");
+    return 0;
+}
+
+- (void)slideDraggedImageTo:(NSPoint)screenPoint
+{
+    NSLog(@"WebKitTestRunner doesn't support slideDraggedImageTo:");
+}
+
+- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
+{
+    NSLog(@"WebKitTestRunner doesn't support namesOfPromisedFilesDroppedAtDestination:");
+    return nil;
+}
+
+- (NSDraggingFormation)draggingFormation
+{
+    return NSDraggingFormationDefault;
+}
+
+- (void)setDraggingFormation:(NSDraggingFormation)formation
+{
+    // Ignored.
+}
+
+- (BOOL)animatesToDestination
+{
+    return NO;
+}
+
+- (void)setAnimatesToDestination:(BOOL)flag
+{
+    // Ignored.
+}
+
+- (NSInteger)numberOfValidItemsForDrop
+{
+    return 1;
+}
+
+- (void)setNumberOfValidItemsForDrop:(NSInteger)number
+{
+    // Ignored.
+}
+
+- (void)enumerateDraggingItemsWithOptions:(NSEnumerationOptions)enumOpts forView:(NSView *)view classes:(NSArray *)classArray searchOptions:(NSDictionary *)searchOptions usingBlock:(void (^)(NSDraggingItem *draggingItem, NSInteger idx, BOOL *stop))block
+{
+    // Ignored.
+}
+
+@end
Property changes on: trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.mm
___________________________________________________________________

Added: svn:eol-style

Added: trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerEvent.h (0 => 154949)


--- trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerEvent.h	                        (rev 0)
+++ trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerEvent.h	2013-09-02 06:36:21 UTC (rev 154949)
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+@interface WebKitTestRunnerEvent : NSEvent
+@end
Property changes on: trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerEvent.h
___________________________________________________________________

Added: svn:eol-style

Added: trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerEvent.mm (0 => 154949)


--- trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerEvent.mm	                        (rev 0)
+++ trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerEvent.mm	2013-09-02 06:36:21 UTC (rev 154949)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WebKitTestRunnerEvent.h"
+
+#import "EventSenderProxy.h"
+#import "TestController.h"
+#import "PlatformWebView.h"
+
+using namespace WTR;
+
+@implementation WebKitTestRunnerEvent
+
++ (NSPoint)mouseLocation
+{
+    WKPoint location = TestController::shared().eventSenderProxy()->position();
+    return [TestController::shared().mainWebView()->platformWindow() convertBaseToScreen:NSMakePoint(location.x, location.y)];
+}
+
+@end
Property changes on: trunk/Tools/WebKitTestRunner/mac/WebKitTestRunnerEvent.mm
___________________________________________________________________

Added: svn:eol-style

_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to