Changeset 154949 in webkit


Ignore:
Timestamp:
Sep 1, 2013 11:36:21 PM (11 years ago)
Author:
ap@apple.com
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.
Location:
trunk
Files:
4 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r154934 r154949  
     12013-09-01  Alexey Proskuryakov  <ap@apple.com>
     2
     3        [WK2][Mac] Drag and drop tests interfere with user's UI
     4        https://bugs.webkit.org/show_bug.cgi?id=120538
     5
     6        Reviewed by Dan Bernstein.
     7
     8        * UIProcess/API/mac/WKView.mm: (-[WKView _setDragImage:at:linkDrag:]): Make it possible
     9        to override drag initiation in subclasses. It is a bit unfortunate that this exposes
     10        a deprecated API that we call, but probably not unfortunate enough to invent a new
     11        scary looking name for the same function, and conditionally call that if implemented
     12        by subclass.
     13
    1142013-08-31  Santosh Mahto  <santosh.ma@samsung.com>
    215
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r153753 r154949  
    27552755    [image setSize:size];
    27562756   
    2757     // The call to super could release this WKView.
     2757    // The call below could release this WKView.
    27582758    RetainPtr<WKView> protector(self);
    27592759   
    2760     [super dragImage:image
    2761                   at:clientPoint
    2762               offset:NSZeroSize
    2763                event:(linkDrag) ? [NSApp currentEvent] :_data->_mouseDownEvent
    2764           pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard]
    2765               source:self
    2766            slideBack:YES];
     2760    [self dragImage:image
     2761                 at:clientPoint
     2762             offset:NSZeroSize
     2763              event:(linkDrag) ? [NSApp currentEvent] :_data->_mouseDownEvent
     2764         pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard]
     2765             source:self
     2766          slideBack:YES];
    27672767}
    27682768
  • trunk/Tools/ChangeLog

    r154923 r154949  
     12013-09-01  Alexey Proskuryakov  <ap@apple.com>
     2
     3        [WK2][Mac] Drag and drop tests interfere with user's UI
     4        https://bugs.webkit.org/show_bug.cgi?id=120538
     5
     6        Reviewed by Dan Bernstein.
     7
     8        This makes running WebKit2 regression tests locally more viable. The patch doesn't
     9        fix drag and drop tests to work as expected, I posted some thought about that in
     10        <https://bugs.webkit.org/show_bug.cgi?id=68552>.
     11
     12        * WebKitTestRunner/EventSenderProxy.h:
     13        (WTR::EventSenderProxy::position):
     14        * WebKitTestRunner/TestController.h:
     15        (WTR::TestController::eventSenderProxy):
     16        Expose a way to get current mouse position from anywhere in WKTR code.
     17
     18        * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: Added new files.
     19
     20        * WebKitTestRunner/mac/EventSenderProxy.mm: (WTR::EventSenderProxy::mouseUp):
     21        Copied a FIXME comment from DumpRenderTree.
     22
     23        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
     24        (-[TestRunnerWKView dragImage:at:offset:event:pasteboard:source:slideBack:]):
     25        Override drag initiation, using a custom NSDraggingInfo implementation.
     26
     27        * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::TestController::platformInitialize):
     28        Replace NSEvent with a custom class.
     29
     30        * WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.h: Added.
     31        * WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.mm: Added.
     32        * WebKitTestRunner/mac/WebKitTestRunnerEvent.h: Added.
     33        * WebKitTestRunner/mac/WebKitTestRunnerEvent.mm: Added.
     34        Largely a copy of DumpRenderTree classes, modified to not use global variables.
     35        We should consider making these variables static in EventSenderProxy though, as
     36        it's strange that mouse state in WKTR is reset between tests without WebKit ever
     37        being told about that.
     38
    1392013-08-30  Brent Fulgham  <bfulgham@apple.com>
    240
  • trunk/Tools/WebKitTestRunner/EventSenderProxy.h

    r152530 r154949  
    2828#define EventSenderProxy_h
    2929
     30#include <wtf/Deque.h>
     31
    3032#if PLATFORM(QT)
    3133#include <QEvent>
     
    3335#elif PLATFORM(GTK)
    3436#include <gdk/gdk.h>
    35 #include <wtf/Deque.h>
    3637#elif PLATFORM(EFL)
    3738#include <WebKit2/EWebKit2.h>
    38 #include <wtf/Deque.h>
    3939#endif
    4040
     
    5353    explicit EventSenderProxy(TestController*);
    5454    ~EventSenderProxy();
     55
     56    WKPoint position() const { return m_position; }
    5557
    5658    void mouseDown(unsigned button, WKEventModifiers);
  • trunk/Tools/WebKitTestRunner/TestController.h

    r154720 r154949  
    6464    WKContextRef context() { return m_context.get(); }
    6565
     66    EventSenderProxy* eventSenderProxy() { return m_eventSenderProxy.get(); }
     67
    6668    void ensureViewSupportsOptions(WKDictionaryRef options);
    6769   
  • trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj

    r154652 r154949  
    8686                BCDA2B9A1191051F00C3BC47 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCDA2B991191051F00C3BC47 /* JavaScriptCore.framework */; };
    8787                C0CE720B1247C93300BC0EC4 /* TestRunnerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C0CE720A1247C93300BC0EC4 /* TestRunnerMac.mm */; };
     88                E132AA3A17CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = E132AA3817CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.mm */; };
     89                E132AA3D17CE776F00611DF0 /* WebKitTestRunnerEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = E132AA3B17CE776F00611DF0 /* WebKitTestRunnerEvent.mm */; };
    8890                E1BA671E1742DA6A00C20251 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1BA671D1742DA5A00C20251 /* Carbon.framework */; };
    8991                E1C642C317CBCC7300D66A3C /* PoseAsClass.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1C642C117CBCC7300D66A3C /* PoseAsClass.mm */; };
     
    222224                BCDA2B991191051F00C3BC47 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
    223225                C0CE720A1247C93300BC0EC4 /* TestRunnerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestRunnerMac.mm; path = mac/TestRunnerMac.mm; sourceTree = "<group>"; };
     226                E132AA3817CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitTestRunnerDraggingInfo.mm; sourceTree = "<group>"; };
     227                E132AA3917CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitTestRunnerDraggingInfo.h; sourceTree = "<group>"; };
     228                E132AA3B17CE776F00611DF0 /* WebKitTestRunnerEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitTestRunnerEvent.mm; sourceTree = "<group>"; };
     229                E132AA3C17CE776F00611DF0 /* WebKitTestRunnerEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitTestRunnerEvent.h; sourceTree = "<group>"; };
    224230                E1BA671D1742DA5A00C20251 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; };
    225231                E1C642C117CBCC7300D66A3C /* PoseAsClass.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PoseAsClass.mm; sourceTree = "<group>"; };
     
    423429                                BC7933FF118F7C84005EA8E2 /* main.mm */,
    424430                                BC7934E711906846005EA8E2 /* PlatformWebViewMac.mm */,
     431                                E1C642C217CBCC7300D66A3C /* PoseAsClass.h */,
    425432                                E1C642C117CBCC7300D66A3C /* PoseAsClass.mm */,
    426                                 E1C642C217CBCC7300D66A3C /* PoseAsClass.h */,
    427433                                BC8C795B11D2785D004535A1 /* TestControllerMac.mm */,
     434                                E132AA3917CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.h */,
     435                                E132AA3817CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.mm */,
     436                                E132AA3C17CE776F00611DF0 /* WebKitTestRunnerEvent.h */,
     437                                E132AA3B17CE776F00611DF0 /* WebKitTestRunnerEvent.mm */,
     438                                E1C642C517CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.h */,
    428439                                E1C642C417CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm */,
    429                                 E1C642C517CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.h */,
    430440                        );
    431441                        path = mac;
     
    546556                08FB7793FE84155DC02AAC07 /* Project object */ = {
    547557                        isa = PBXProject;
    548                         attributes = {
    549                         };
    550558                        buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "WebKitTestRunner" */;
    551559                        compatibilityVersion = "Xcode 3.1";
     
    614622                                5322FB4313FDA0CD0041ABCC /* CyclicRedundancyCheck.cpp in Sources */,
    615623                                E1C642C317CBCC7300D66A3C /* PoseAsClass.mm in Sources */,
     624                                E132AA3D17CE776F00611DF0 /* WebKitTestRunnerEvent.mm in Sources */,
    616625                                5670B8281386FCA5002EB355 /* EventSenderProxy.mm in Sources */,
    617626                                26D758E7160BECDD00268472 /* GeolocationProviderMock.cpp in Sources */,
     
    624633                                BCD7D2F811921278006DB7EE /* TestInvocation.cpp in Sources */,
    625634                                BC9192051333E4F8003011DC /* TestInvocationCG.cpp in Sources */,
     635                                E132AA3A17CD5F1000611DF0 /* WebKitTestRunnerDraggingInfo.mm in Sources */,
    626636                                3164C8F015D1ADA100EF1FE0 /* WebNotificationProvider.cpp in Sources */,
    627637                                4429FC5F1627089600F66D8B /* WorkQueueManager.cpp in Sources */,
  • trunk/Tools/WebKitTestRunner/mac/EventSenderProxy.mm

    r151757 r154949  
    3131#import "StringFunctions.h"
    3232#import "TestController.h"
    33 #import <wtf/RetainPtr.h>
    3433#import <Carbon/Carbon.h>
    3534#import <WebKit2/WKString.h>
     35#import <wtf/RetainPtr.h>
    3636
    3737namespace WTR {
     
    180180
    181181    NSView *targetView = [m_testController->mainWebView()->platformView() hitTest:[event locationInWindow]];
     182    // FIXME: Silly hack to teach WKTR to respect capturing mouse events outside the WKView.
     183    // The right solution is just to use NSApplication's built-in event sending methods,
     184    // instead of rolling our own algorithm for selecting an event target.
    182185    targetView = targetView ? targetView : m_testController->mainWebView()->platformView();
    183     assert(targetView);
     186    ASSERT(targetView);
    184187    [targetView mouseUp:event];
    185188    if (buttonNumber == LeftMouseButton)
  • trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm

    r149716 r154949  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #include "config.h"
    27 #include "PlatformWebView.h"
    28 #include "TestController.h"
    29 
     26#import "config.h"
     27#import "PlatformWebView.h"
     28
     29#import "TestController.h"
     30#import "WebKitTestRunnerDraggingInfo.h"
    3031#import <WebKit2/WKImageCG.h>
    3132#import <WebKit2/WKViewPrivate.h>
    3233#import <wtf/RetainPtr.h>
    3334
     35using namespace WTR;
     36
    3437@interface WebKitTestRunnerWindow : NSWindow {
    35     WTR::PlatformWebView* _platformWebView;
     38    PlatformWebView* _platformWebView;
    3639    NSPoint _fakeOrigin;
    3740}
    38 @property (nonatomic, assign) WTR::PlatformWebView* platformWebView;
     41@property (nonatomic, assign) PlatformWebView* platformWebView;
    3942@end
    4043
     
    6164{
    6265    return _useTiledDrawing;
     66}
     67
     68- (void)dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag
     69{
     70    RetainPtr<WebKitTestRunnerDraggingInfo> draggingInfo = adoptNS([[WebKitTestRunnerDraggingInfo alloc] initWithImage:anImage offset:initialOffset pasteboard:pboard source:sourceObj]);
     71    [self draggingUpdated:draggingInfo.get()];
    6372}
    6473
  • trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm

    r154652 r154949  
    4242{
    4343    poseAsClass("WebKitTestRunnerPasteboard", "NSPasteboard");
     44    poseAsClass("WebKitTestRunnerEvent", "NSEvent");
    4445}
    4546
Note: See TracChangeset for help on using the changeset viewer.