Reviewed by Maciej.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Nov 2006 08:43:00 +0000 (08:43 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Nov 2006 08:43:00 +0000 (08:43 +0000)
        http://bugs.webkit.org/show_bug.cgi?id=11517
        REGRESSION: Flash clicks/interactivity not working properly

WebCore:
        * bridge/mac/FrameMac.mm:
        (WebCore::FrameMac::handleMouseMoveEvent):
        (WebCore::FrameMac::handleMouseReleaseEvent):
        Restore parts of event dispatching that were removed when fixing
        bug 7323 - just bypass those for subframes.

WebKitTools:
        Teach TestNetscapePlugin to log events passed to it. To enable, set eventLoggingEnabled to true:

        <embed name="plg" type="application/x-webkit-test-netscape" width=100 height=100></embed>
        <script>
            plg.eventLoggingEnabled = true;
            // use eventSender to simulate events...
        </script>

        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.c:
        (pluginGetProperty):
        (pluginSetProperty):
        (pluginAllocate):
        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
        * DumpRenderTree/TestNetscapePlugIn.subproj/main.c:
        (NPP_HandleEvent):

LayoutTests:
        * plugins/mouse-events-expected.txt: Added.
        * plugins/mouse-events.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17611 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/plugins/mouse-events-expected.txt [new file with mode: 0644]
LayoutTests/plugins/mouse-events.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/bridge/mac/FrameMac.mm
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.c
WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h
WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.c

index 849f6ff..1b15943 100644 (file)
@@ -1,3 +1,13 @@
+2006-11-06  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Maciej.
+
+        Test for http://bugs.webkit.org/show_bug.cgi?id=11517
+        REGRESSION: Flash clicks/interactivity not working properly
+
+        * plugins/mouse-events-expected.txt: Added.
+        * plugins/mouse-events.html: Added.
+
 2006-11-06  Mark Rowe  <bdash@webkit.org>
 
         Reviewed by the wonderful Mitz Pettel.
diff --git a/LayoutTests/plugins/mouse-events-expected.txt b/LayoutTests/plugins/mouse-events-expected.txt
new file mode 100644 (file)
index 0000000..b99b9a4
--- /dev/null
@@ -0,0 +1,9 @@
+PLUGIN: getFocusEvent
+PLUGIN: mouseDown at (12, 12)
+PLUGIN: mouseUp at (12, 12)
+PLUGIN: mouseDown at (22, 22)
+PLUGIN: mouseUp at (32, 22)
+
+Test for bug 11517: Flash clicks/interactivity not working properly.
+
+
diff --git a/LayoutTests/plugins/mouse-events.html b/LayoutTests/plugins/mouse-events.html
new file mode 100644 (file)
index 0000000..a7c1ee6
--- /dev/null
@@ -0,0 +1,29 @@
+<html>
+<body>
+<embed name="plg" type="application/x-webkit-test-netscape" width=100 height=100></embed>
+<p>Test for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=11517">bug 11517</a>:
+Flash clicks/interactivity not working properly.</p>
+<script>
+
+    plg.eventLoggingEnabled = true;
+
+    if (!window.layoutTestController) {
+        document.write("This test does not work in manual mode.");
+        return;
+    }
+
+    layoutTestController.dumpAsText();
+    
+    eventSender.mouseMoveTo(0,0);
+    eventSender.mouseMoveTo(20,20);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+    eventSender.mouseMoveTo(30,30);
+    eventSender.mouseDown();
+    eventSender.mouseMoveTo(40,30);
+    eventSender.mouseUp();
+    eventSender.mouseMoveTo(0,0);
+
+</script>
+</body>
+</html>
index 806a211..2908171 100644 (file)
@@ -1,3 +1,16 @@
+2006-11-06  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Maciej.
+
+        http://bugs.webkit.org/show_bug.cgi?id=11517
+        REGRESSION: Flash clicks/interactivity not working properly
+
+        * bridge/mac/FrameMac.mm:
+        (WebCore::FrameMac::handleMouseMoveEvent):
+        (WebCore::FrameMac::handleMouseReleaseEvent):
+        Restore parts of event dispatching that were removed when fixing
+        bug 7323 - just bypass those for subframes.
+
 2006-11-05  Darin Adler  <darin@apple.com>
 
         - quick attempt to fix the no-SVG build
index 624bb57..77008f4 100644 (file)
@@ -1538,8 +1538,16 @@ void FrameMac::handleMouseMoveEvent(const MouseEventWithHitTestResults& event)
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
     if ([_currentEvent type] == NSLeftMouseDragged) {
-        if (mouseDownViewIfStillGood())
-            return; // The event has been already dispatched to a subframe
+        NSView *view = mouseDownViewIfStillGood();
+
+        if (view) {
+            if (!_mouseDownWasInSubframe) {
+                _sendingEventToSubview = true;
+                [view mouseDragged:_currentEvent];
+                _sendingEventToSubview = false;
+            }
+            return;
+        }
 
         // Careful that the drag starting logic stays in sync with eventMayStartDrag()
     
@@ -1762,6 +1770,14 @@ void FrameMac::handleMouseReleaseEvent(const MouseEventWithHitTestResults& event
         return;
     }
     stopAutoscrollTimer();
+
+    if (!_mouseDownWasInSubframe) {
+        _sendingEventToSubview = true;
+        BEGIN_BLOCK_OBJC_EXCEPTIONS;
+        [view mouseUp:_currentEvent];
+        END_BLOCK_OBJC_EXCEPTIONS;
+        _sendingEventToSubview = false;
+    }
 }
 
 bool FrameMac::passSubframeEventToSubframe(MouseEventWithHitTestResults& event, Frame* subframe)
index da6bc7f..713fbaa 100644 (file)
@@ -1,3 +1,26 @@
+2006-11-06  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Maciej.
+
+        Test for http://bugs.webkit.org/show_bug.cgi?id=11517
+        REGRESSION: Flash clicks/interactivity not working properly
+
+        Teach TestNetscapePlugin to log events passed to it. To enable, set eventLoggingEnabled to true:
+
+        <embed name="plg" type="application/x-webkit-test-netscape" width=100 height=100></embed>
+        <script>
+            plg.eventLoggingEnabled = true;
+            // use eventSender to simulate events...
+        </script>
+
+        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.c:
+        (pluginGetProperty):
+        (pluginSetProperty):
+        (pluginAllocate):
+        * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h:
+        * DumpRenderTree/TestNetscapePlugIn.subproj/main.c:
+        (NPP_HandleEvent):
+
 2006-11-04  David Smith  <catfish.man@gmail.com>
 
         Reviewed by Tim H.
index d05cc14..4d68f93 100644 (file)
@@ -66,11 +66,13 @@ NPClass *getPluginClass(void)
 static bool identifiersInitialized = false;
 
 #define ID_PROPERTY_PROPERTY        0
-#define NUM_PROPERTY_IDENTIFIERS    1
+#define ID_PROPERTY_EVENT_LOGGING   1
+#define NUM_PROPERTY_IDENTIFIERS    2
 
 static NPIdentifier pluginPropertyIdentifiers[NUM_PROPERTY_IDENTIFIERS];
 static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
-    "property"
+    "property",
+    "eventLoggingEnabled"
 };
 
 #define ID_TEST_CALLBACK_METHOD     0
@@ -124,12 +126,19 @@ static bool pluginGetProperty(NPObject *obj, NPIdentifier name, NPVariant *varia
     if (name == pluginPropertyIdentifiers[ID_PROPERTY_PROPERTY]) {
         STRINGZ_TO_NPVARIANT("property", *variant);
         return true;
+    } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_EVENT_LOGGING]) {
+        BOOLEAN_TO_NPVARIANT(((PluginObject *)obj)->eventLogging, *variant);
+        return true;
     }
     return false;
 }
 
 static bool pluginSetProperty(NPObject *obj, NPIdentifier name, const NPVariant *variant)
 {
+    if (name == pluginPropertyIdentifiers[ID_PROPERTY_EVENT_LOGGING]) {
+        ((PluginObject *)obj)->eventLogging = NPVARIANT_TO_BOOLEAN(*variant);
+        return true;
+    }
     return false;
 }
 
@@ -226,6 +235,8 @@ static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
 
     newInstance->npp = npp;
     
+    newInstance->eventLogging = FALSE;
+    
     return (NPObject *)newInstance;
 }
 
index 0a9eb20..93296dd 100644 (file)
@@ -38,6 +38,7 @@ extern NPNetscapeFuncs *browser;
 typedef struct {
     NPObject header;
     NPP npp;
+    Boolean eventLogging;
 } PluginObject;
 
 extern NPClass *getPluginClass(void);
index c96141e..9ad97ac 100644 (file)
@@ -121,6 +121,72 @@ void NPP_Print(NPP instance, NPPrint *platformPrint)
 
 int16 NPP_HandleEvent(NPP instance, void *event)
 {
+    PluginObject *obj = instance->pdata;
+    if (!obj->eventLogging)
+        return 0;
+    
+    EventRecord *evt = event;
+    Point pt = { evt->where.v, evt->where.h };
+    switch (evt->what) {
+        case nullEvent:
+            // these are delivered non-deterministically, don't log.
+            break;
+        case mouseDown:
+            GlobalToLocal(&pt);
+            printf("PLUGIN: mouseDown at (%d, %d)\n", pt.h, pt.v);
+            break;
+        case mouseUp:
+            GlobalToLocal(&pt);
+            printf("PLUGIN: mouseUp at (%d, %d)\n", pt.h, pt.v);
+            break;
+        case keyDown:
+            printf("PLUGIN: keyDown '%c'\n", (char)(evt->message & 0xFF));
+            break;
+        case keyUp:
+            printf("PLUGIN: keyUp '%c'\n", (char)(evt->message & 0xFF));
+            break;
+        case autoKey:
+            printf("PLUGIN: autoKey '%c'\n", (char)(evt->message & 0xFF));
+            break;
+        case updateEvt:
+            printf("PLUGIN: updateEvt\n");
+            break;
+        case diskEvt:
+            printf("PLUGIN: diskEvt\n");
+            break;
+        case activateEvt:
+            printf("PLUGIN: activateEvt\n");
+            break;
+        case osEvt:
+            printf("PLUGIN: osEvt - ");
+            switch ((evt->message & 0xFF000000) >> 24) {
+                case suspendResumeMessage:
+                    printf("%s\n", (evt->message & 0x1) ? "resume" : "suspend");
+                    break;
+                case mouseMovedMessage:
+                    printf("mouseMoved\n");
+                    break;
+                default:
+                    printf("%08lX\n", evt->message);
+            }
+            break;
+        case kHighLevelEvent:
+            printf("PLUGIN: kHighLevelEvent\n");
+            break;
+        // NPAPI events
+        case getFocusEvent:
+            printf("PLUGIN: getFocusEvent\n");
+            break;
+        case loseFocusEvent:
+            printf("PLUGIN: loseFocusEvent\n");
+            break;
+        case adjustCursorEvent:
+            printf("PLUGIN: adjustCursorEvent\n");
+            break;
+        default:
+            printf("PLUGIN: event %d\n", evt->what);
+    }
+    
     return 0;
 }