Title: [88712] trunk
Revision
88712
Author
commit-qu...@webkit.org
Date
2011-06-13 15:25:34 -0700 (Mon, 13 Jun 2011)

Log Message

2011-06-13  Martin Robinson  <mrobin...@igalia.com>

        Reviewed by Eric Seidel.

        [GTK] [Qt] Eliminate duplicate TestNetscapePlugin implementation
        https://bugs.webkit.org/show_bug.cgi?id=62385

        Remove adjustCursorEvent from platform-specific test expectation for Chromium Linux,
        since the TestPlugin no longer prints this event.

        * platform/chromium-linux/plugins/mouse-events-expected.txt: Remove adjustCursorEvent output.
2011-06-13  Martin Robinson  <mrobin...@igalia.com>

        Reviewed by Eric Seidel.

        [GTK] [Qt] Eliminate duplicate TestNetscapePlugin implementation
        https://bugs.webkit.org/show_bug.cgi?id=62385

        Remove duplicate TestNetscapePlugIn implementation. Having two copies
        of this code makes keeping it in sync much more difficult. The files are
        almost identical and this change ports the X11 changes to main.cpp.

        * DumpRenderTree/TestNetscapePlugIn/main.cpp:
        (NPP_New): Do not set the plugin as windowless always. Doing this breaks
        some results on Qt and this seems to be unnecessary for the moment.
        (keyEventToChar): Added this helper which converts a X11 keycode into a char.
        (handleEventX11): Use the handler to properly convert the keycode. Do not print
        adjustCursorEvent output. The tests currently do not trigger this for Cocoa and thus
        it should not be in the results.
        (NPP_GetValue): Properly handle NPPVpluginNeedsXEmbed and make it clearer why the
        XP_UNIX block is first by guarding against using a null instance.
        * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro: Update source list add
        the XP_UNIX define for Linux.
        * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp: Removed.
        * GNUmakefile.am: Update source list.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (88711 => 88712)


--- trunk/LayoutTests/ChangeLog	2011-06-13 22:23:20 UTC (rev 88711)
+++ trunk/LayoutTests/ChangeLog	2011-06-13 22:25:34 UTC (rev 88712)
@@ -1,3 +1,15 @@
+2011-06-13  Martin Robinson  <mrobin...@igalia.com>
+
+        Reviewed by Eric Seidel.
+
+        [GTK] [Qt] Eliminate duplicate TestNetscapePlugin implementation
+        https://bugs.webkit.org/show_bug.cgi?id=62385
+
+        Remove adjustCursorEvent from platform-specific test expectation for Chromium Linux,
+        since the TestPlugin no longer prints this event.
+
+        * platform/chromium-linux/plugins/mouse-events-expected.txt: Remove adjustCursorEvent output.
+
 2011-06-13  Nate Chapin  <jap...@chromium.org>
 
         Reviewed by Adam Barth.

Modified: trunk/LayoutTests/platform/chromium-linux/plugins/mouse-events-expected.txt (88711 => 88712)


--- trunk/LayoutTests/platform/chromium-linux/plugins/mouse-events-expected.txt	2011-06-13 22:23:20 UTC (rev 88711)
+++ trunk/LayoutTests/platform/chromium-linux/plugins/mouse-events-expected.txt	2011-06-13 22:25:34 UTC (rev 88712)
@@ -1,12 +1,7 @@
-CONSOLE MESSAGE: line 17: PLUGIN: adjustCursorEvent
-CONSOLE MESSAGE: line 17: PLUGIN: adjustCursorEvent
 CONSOLE MESSAGE: line 18: PLUGIN: getFocusEvent
 CONSOLE MESSAGE: line 18: PLUGIN: mouseDown at (12, 12)
 CONSOLE MESSAGE: line 19: PLUGIN: mouseUp at (12, 12)
-CONSOLE MESSAGE: line 20: PLUGIN: adjustCursorEvent
 CONSOLE MESSAGE: line 21: PLUGIN: mouseDown at (22, 22)
-CONSOLE MESSAGE: line 23: PLUGIN: adjustCursorEvent
 CONSOLE MESSAGE: line 23: PLUGIN: mouseUp at (32, 22)
-CONSOLE MESSAGE: line 24: PLUGIN: adjustCursorEvent
 
 Test for bug 11517: Flash clicks/interactivity not working properly.

Modified: trunk/Tools/ChangeLog (88711 => 88712)


--- trunk/Tools/ChangeLog	2011-06-13 22:23:20 UTC (rev 88711)
+++ trunk/Tools/ChangeLog	2011-06-13 22:25:34 UTC (rev 88712)
@@ -1,3 +1,28 @@
+2011-06-13  Martin Robinson  <mrobin...@igalia.com>
+
+        Reviewed by Eric Seidel.
+
+        [GTK] [Qt] Eliminate duplicate TestNetscapePlugin implementation
+        https://bugs.webkit.org/show_bug.cgi?id=62385
+
+        Remove duplicate TestNetscapePlugIn implementation. Having two copies
+        of this code makes keeping it in sync much more difficult. The files are
+        almost identical and this change ports the X11 changes to main.cpp.
+
+        * DumpRenderTree/TestNetscapePlugIn/main.cpp:
+        (NPP_New): Do not set the plugin as windowless always. Doing this breaks
+        some results on Qt and this seems to be unnecessary for the moment.
+        (keyEventToChar): Added this helper which converts a X11 keycode into a char.
+        (handleEventX11): Use the handler to properly convert the keycode. Do not print
+        adjustCursorEvent output. The tests currently do not trigger this for Cocoa and thus
+        it should not be in the results.
+        (NPP_GetValue): Properly handle NPPVpluginNeedsXEmbed and make it clearer why the
+        XP_UNIX block is first by guarding against using a null instance.
+        * DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro: Update source list add
+        the XP_UNIX define for Linux.
+        * DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp: Removed.
+        * GNUmakefile.am: Update source list.
+
 2011-06-13  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r88671.

Modified: trunk/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp (88711 => 88712)


--- trunk/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp	2011-06-13 22:23:20 UTC (rev 88711)
+++ trunk/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp	2011-06-13 22:25:34 UTC (rev 88712)
@@ -27,10 +27,12 @@
 
 #include "PluginTest.h"
 #include <cstdlib>
+#include <cstring>
 #include <string>
 
 #ifdef XP_UNIX
 #include <X11/Xlib.h>
+#include <X11/Xutil.h>
 #endif
 
 #if !defined(NP_NO_CARBON) && defined(QD_HEADERS_ARE_PRIVATE) && QD_HEADERS_ARE_PRIVATE
@@ -285,11 +287,6 @@
         return NPERR_GENERIC_ERROR;
     }
 
-#ifdef XP_UNIX
-    // On Unix, plugins only get events if they are windowless.
-    browser->setvalue(instance, NPPVpluginWindowBool, 0);
-#endif
-
     if (onNewScript)
         executeScript(obj, onNewScript);
 
@@ -622,32 +619,38 @@
 #endif // XP_MACOSX
 
 #ifdef XP_UNIX
+
+static char keyEventToChar(XKeyEvent* event)
+{
+    char c = ' ';
+    XLookupString(event, &c, sizeof(c), 0, 0);
+    return c;
+}
+
 static int16_t handleEventX11(NPP instance, PluginObject* obj, XEvent* event)
 {
-    XButtonPressedEvent* buttonPressEvent = reinterpret_cast<XButtonPressedEvent*>(event);
-    XButtonReleasedEvent* buttonReleaseEvent = reinterpret_cast<XButtonReleasedEvent*>(event);
     switch (event->type) {
     case ButtonPress:
         if (obj->eventLogging)
-            pluginLog(instance, "mouseDown at (%d, %d)", buttonPressEvent->x, buttonPressEvent->y);
+            pluginLog(instance, "mouseDown at (%d, %d)", event->xbutton.x, event->xbutton.y);
         if (obj->evaluateScriptOnMouseDownOrKeyDown && obj->mouseDownForEvaluateScript)
             executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
         break;
     case ButtonRelease:
         if (obj->eventLogging)
-            pluginLog(instance, "mouseUp at (%d, %d)", buttonReleaseEvent->x, buttonReleaseEvent->y);
+            pluginLog(instance, "mouseUp at (%d, %d)", event->xbutton.x, event->xbutton.y);
         break;
     case KeyPress:
         // FIXME: extract key code
         if (obj->eventLogging)
-            pluginLog(instance, "NOTIMPLEMENTED: keyDown '%c'", ' ');
+            pluginLog(instance, "keyDown '%c'", keyEventToChar(&event->xkey));
         if (obj->evaluateScriptOnMouseDownOrKeyDown && !obj->mouseDownForEvaluateScript)
             executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
         break;
     case KeyRelease:
         // FIXME: extract key code
         if (obj->eventLogging)
-            pluginLog(instance, "NOTIMPLEMENTED: keyUp '%c'", ' ');
+            pluginLog(instance, "keyUp '%c'", keyEventToChar(&event->xkey));
         break;
     case GraphicsExpose:
         if (obj->eventLogging)
@@ -667,8 +670,6 @@
     case EnterNotify:
     case LeaveNotify:
     case MotionNotify:
-        if (obj->eventLogging)
-            pluginLog(instance, "adjustCursorEvent");
         break;
     default:
         if (obj->eventLogging)
@@ -780,8 +781,14 @@
         *((char **)value) = const_cast<char*>("Simple Netscape plug-in that handles test content for WebKit");
         return NPERR_NO_ERROR;
     }
+    if (variable == NPPVpluginNeedsXEmbed) {
+        *((NPBool *)value) = TRUE;
+        return NPERR_NO_ERROR;
+    }
 #endif
 
+    if (!instance)
+        return NPERR_GENERIC_ERROR;
     PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
 
     // First, check if the PluginTest object supports getting this value.

Modified: trunk/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro (88711 => 88712)


--- trunk/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro	2011-06-13 22:23:20 UTC (rev 88711)
+++ trunk/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro	2011-06-13 22:25:34 UTC (rev 88712)
@@ -28,6 +28,7 @@
 SOURCES = PluginObject.cpp \
           PluginTest.cpp \
           TestObject.cpp \
+          main.cpp \
           Tests/DocumentOpenInDestroyStream.cpp \
           Tests/EvaluateJSAfterRemovingPluginElement.cpp \
           Tests/GetURLNotifyWithURLThatFailsToLoad.cpp \
@@ -43,15 +44,13 @@
           Tests/PluginScriptableNPObjectInvokeDefault.cpp
 
 mac {
-    SOURCES += ../../TestNetscapePlugIn/main.cpp
     OBJECTIVE_SOURCES += PluginObjectMac.mm
     LIBS += -framework Carbon -framework Cocoa -framework QuartzCore
-} else {
-    SOURCES += ../../unix/TestNetscapePlugin/TestNetscapePlugin.cpp
 }
 
 DEFINES -= QT_ASCII_CAST_WARNINGS
 
 !win32:!embedded:!mac:!symbian {
     LIBS += -lX11
+    DEFINES += XP_UNIX
 }

Deleted: trunk/Tools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp (88711 => 88712)


--- trunk/Tools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp	2011-06-13 22:23:20 UTC (rev 88711)
+++ trunk/Tools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp	2011-06-13 22:25:34 UTC (rev 88712)
@@ -1,476 +0,0 @@
-/*
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Zan Dobersek <zandober...@gmail.com>
- * Copyright (C) 2009 Holger Hans Peter Freyther
- *
- * 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. ``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
- * 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.
- */
-
-#include "config.h"
-#include "PluginObject.h"
-#include "PluginTest.h"
-
-#include "npapi.h"
-#include "npruntime.h"
-#include "npfunctions.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <string>
-
-using namespace std;
- 
-extern "C" {
-    NPError NP_Initialize (NPNetscapeFuncs *aMozillaVTable, NPPluginFuncs *aPluginVTable);
-    NPError NP_Shutdown(void);
-    NPError NP_GetValue(void *future, NPPVariable variable, void *value);
-    char* NP_GetMIMEDescription(void);
-}
-
-static void executeScript(const PluginObject* obj, const char* script);
-
-static NPError
-webkit_test_plugin_new_instance(NPMIMEType mimetype,
-                                NPP instance,
-                                uint16_t mode,
-                                int16_t argc,
-                                char *argn[],
-                                char *argv[],
-                                NPSavedData* savedData)
-{
-    if (browser->version >= 14) {
-        PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass());
-        instance->pdata = obj;
-
-        string testIdentifier;
-
-        for (int i = 0; i < argc; i++) {
-            if (strcasecmp(argn[i], "test") == 0)
-                testIdentifier = argv[i];
-            else if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
-                obj->_onStreamLoad_ = strdup(argv[i]);
-            else if (strcasecmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDestroy)
-                obj->_onStreamDestroy_ = strdup(argv[i]);
-            else if (strcasecmp(argn[i], "onURLNotify") == 0 && !obj->onURLNotify)
-                obj->_onURLNotify_ = strdup(argv[i]);
-            else if (strcasecmp(argn[i], "src") == 0 &&
-                     strcasecmp(argv[i], "data:application/x-webkit-test-netscape,returnerrorfromnewstream") == 0)
-                obj->returnErrorFromNewStream = TRUE;
-            else if (!strcasecmp(argn[i], "src")
-                     && !strcasecmp(argv[i], "data:application/x-webkit-test-netscape,alertwhenloaded"))
-                executeScript(obj, "alert('Plugin Loaded!')");
-            else if (strcasecmp(argn[i], "logfirstsetwindow") == 0)
-                obj->logSetWindow = TRUE;
-            else if (strcasecmp(argn[i], "testnpruntime") == 0)
-                testNPRuntime(instance);
-            else if (strcasecmp(argn[i], "logSrc") == 0) {
-                for (int i = 0; i < argc; i++)
-                    if (strcasecmp(argn[i], "src") == 0)
-                        pluginLog(instance, "src: %s", argv[i]);
-            } else if (strcasecmp(argn[i], "cleardocumentduringnew") == 0)
-                executeScript(obj, "document.body.innerHTML = ''");
-            else if (!strcasecmp(argn[i], "ondestroy"))
-                obj->_onDestroy_ = strdup(argv[i]);
-            else if (strcasecmp(argn[i], "testwindowopen") == 0)
-                obj->testWindowOpen = TRUE;
-            else if (strcasecmp(argn[i], "onSetWindow") == 0 && !obj->onSetWindow)
-                obj->_onSetWindow_ = strdup(argv[i]);
-            else if (!strcasecmp(argn[i], "windowedPlugin")) {
-                void* windowed = 0;
-                if (!strcasecmp(argv[i], "false") || !strcasecmp(argv[i], "0"))
-                    windowed = 0;
-                else if (!strcasecmp(argv[i], "true") || !strcasecmp(argv[i], "1"))
-                    windowed = reinterpret_cast<void*>(1);
-                else
-                    assert(false);
-                browser->setvalue(instance, NPPVpluginWindowBool, windowed);
-            } else if (!strcasecmp(argn[i], "onPaintEvent") && !obj->onPaintEvent)
-                obj->_onPaintEvent_ = strdup(argv[i]);
-            else if (!strcasecmp(argn[i], "evaluatescript")) {
-                char* script = argv[i];
-                if (script == strstr(script, "mouse::")) {
-                    obj->mouseDownForEvaluateScript = true;
-                    obj->evaluateScriptOnMouseDownOrKeyDown = strdup(script + sizeof("mouse::") - 1);
-                } else if (script == strstr(script, "key::"))
-                    obj->evaluateScriptOnMouseDownOrKeyDown = strdup(script + sizeof("key::") - 1);
-                // When testing evaluate script on mouse-down or key-down, allow event logging to handle events.
-                if (obj->evaluateScriptOnMouseDownOrKeyDown)
-                    obj->eventLogging = true;
-            }
-        }
-
-        browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode);
-
-        obj->pluginTest = PluginTest::create(instance, testIdentifier);
-
-        return obj->pluginTest->NPP_New(mimetype, mode, argc, argn, argv, savedData);
-    }
-
-    return NPERR_NO_ERROR;
-}
-
-static NPError
-webkit_test_plugin_destroy_instance(NPP instance, NPSavedData** save)
-{
-    PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
-    if (obj) {
-        if (obj->onDestroy) {
-            executeScript(obj, obj->onDestroy);
-            free(obj->onDestroy);
-        }
-
-        if (obj->onStreamLoad)
-            free(obj->onStreamLoad);
-
-        if (obj->onStreamDestroy)
-            free(obj->onStreamDestroy);
-
-        if (obj->onURLNotify)
-            free(obj->onURLNotify);
-
-        if (obj->logDestroy)
-            pluginLog(instance, "NPP_Destroy");
-
-        if (obj->onSetWindow)
-            free(obj->onSetWindow);
-
-        obj->pluginTest->NPP_Destroy(save);
-
-        browser->releaseobject(&obj->header);
-    }
-
-    return NPERR_NO_ERROR;
-}
-
-static NPError
-webkit_test_plugin_set_window(NPP instance, NPWindow *window)
-{
-    PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
-
-    if (obj) {
-        obj->lastWindow = *window;
-
-        if (obj->logSetWindow) {
-            pluginLog(instance, "NPP_SetWindow: %d %d", (int)window->width, (int)window->height);
-            obj->logSetWindow = false;
-        }
-        if (obj->onSetWindow)
-            executeScript(obj, obj->onSetWindow);
-
-        if (obj->testWindowOpen) {
-            testWindowOpen(instance);
-            obj->testWindowOpen = FALSE;
-        }
-
-    }
-
-    return obj->pluginTest->NPP_SetWindow(instance, window);
-}
-
-static void executeScript(const PluginObject* obj, const char* script)
-{
-    NPObject *windowScriptObject;
-    browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
-
-    NPString npScript;
-    npScript.UTF8Characters = script;
-    npScript.UTF8Length = strlen(script);
-
-    NPVariant browserResult;
-    browser->evaluate(obj->npp, windowScriptObject, &npScript, &browserResult);
-    browser->releasevariantvalue(&browserResult);
-}
-
-static NPError
-webkit_test_plugin_new_stream(NPP instance,
-                              NPMIMEType type,
-                              NPStream *stream,
-                              NPBool seekable,
-                              uint16_t* stype)
-{
-    PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
-    obj->stream = stream;
-    *stype = NP_NORMAL;
-
-    if (obj->returnErrorFromNewStream)
-        return NPERR_GENERIC_ERROR;
-
-    if (browser->version >= NPVERS_HAS_RESPONSE_HEADERS)
-        notifyStream(obj, stream->url, stream->headers);
-
-    if (obj->onStreamLoad)
-        executeScript(obj, obj->onStreamLoad);
-
-    return obj->pluginTest->NPP_NewStream(type, stream, seekable, stype);
-}
-
-static NPError
-webkit_test_plugin_destroy_stream(NPP instance, NPStream* stream, NPError reason)
-{
-    PluginObject* obj = (PluginObject*)instance->pdata;
-
-    if (obj->onStreamDestroy) {
-        NPObject* windowObject = 0;
-        NPError error = browser->getvalue(instance, NPNVWindowNPObject, &windowObject);
-        
-        if (error == NPERR_NO_ERROR) {
-            NPVariant onStreamDestroyVariant;
-            if (browser->getproperty(instance, windowObject, browser->getstringidentifier(obj->onStreamDestroy), &onStreamDestroyVariant)) {
-                if (NPVARIANT_IS_OBJECT(onStreamDestroyVariant)) {
-                    NPObject* _onStreamDestroyFunction_ = NPVARIANT_TO_OBJECT(onStreamDestroyVariant);
-
-                    NPVariant reasonVariant;
-                    INT32_TO_NPVARIANT(reason, reasonVariant);
-
-                    NPVariant result;
-                    browser->invokeDefault(instance, onStreamDestroyFunction, &reasonVariant, 1, &result);
-                    browser->releasevariantvalue(&result);
-                }
-                browser->releasevariantvalue(&onStreamDestroyVariant);
-            }
-            browser->releaseobject(windowObject);
-        }
-    }
-
-    return obj->pluginTest->NPP_DestroyStream(stream, reason);
-}
-
-static void
-webkit_test_plugin_stream_as_file(NPP /*instance*/, NPStream* /*stream*/, const char* /*fname*/)
-{
-}
-
-static int32_t
-webkit_test_plugin_write_ready(NPP instance, NPStream* stream)
-{
-    PluginObject* obj = (PluginObject*)instance->pdata;
-    return obj->pluginTest->NPP_WriteReady(stream);
-}
-
-static int32_t
-webkit_test_plugin_write(NPP instance,
-                         NPStream* stream,
-                         int32_t offset,
-                         int32_t len,
-                         void* buffer)
-{
-    PluginObject* obj = (PluginObject*)instance->pdata;
-
-    if (obj->returnNegativeOneFromWrite)
-        return -1;
-
-    return obj->pluginTest->NPP_Write(stream, offset, len, buffer);
-}
-
-static void
-webkit_test_plugin_print(NPP /*instance*/, NPPrint* /*platformPrint*/)
-{
-}
-
-static char keyEventToChar(XKeyEvent* event)
-{
-    char c = ' ';
-    XLookupString(event, &c, sizeof(c), 0, 0);
-    return c;
-}
-
-static int16_t
-webkit_test_plugin_handle_event(NPP instance, void* event)
-{
-    PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
-
-    XEvent* evt = static_cast<XEvent*>(event);
-
-    switch (evt->type) {
-        case ButtonRelease:
-            if (obj->eventLogging)
-                pluginLog(instance, "mouseUp at (%d, %d)", evt->xbutton.x, evt->xbutton.y);
-            break;
-        case ButtonPress:
-            if (obj->eventLogging)
-                pluginLog(instance, "mouseDown at (%d, %d)", evt->xbutton.x, evt->xbutton.y);
-           if (obj->evaluateScriptOnMouseDownOrKeyDown && obj->mouseDownForEvaluateScript)
-                executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
-            break;
-        case KeyRelease:
-            if (obj->eventLogging)
-                pluginLog(instance, "keyUp '%c'", keyEventToChar(&evt->xkey));
-            break;
-        case KeyPress:
-            if (obj->eventLogging)
-                pluginLog(instance, "keyDown '%c'", keyEventToChar(&evt->xkey));
-           if (obj->evaluateScriptOnMouseDownOrKeyDown && !obj->mouseDownForEvaluateScript)
-                executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown);
-            break;
-        case MotionNotify:
-        case EnterNotify:
-        case LeaveNotify:
-            break;
-        case FocusIn:
-            if (obj->eventLogging)
-                pluginLog(instance, "getFocusEvent");
-            break;
-        case FocusOut:
-            if (obj->eventLogging)
-                pluginLog(instance, "loseFocusEvent");
-            break;
-        case GraphicsExpose:
-            if (obj->eventLogging)
-                pluginLog(instance, "updateEvt");
-            if (obj->onPaintEvent)
-                executeScript(obj, obj->onPaintEvent);
-            break;
-        default:
-            pluginLog(instance, "event %d", evt->type);
-    }
-
-    return 0;
-}
-
-static void
-webkit_test_plugin_url_notify(NPP instance, const char* url, NPReason reason, void* notifyData)
-{
-    PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
-    if (obj->pluginTest->NPP_URLNotify(url, reason, notifyData))
-        return;
-
-    if (obj->onURLNotify)
-        executeScript(obj, obj->onURLNotify);
-
-    handleCallback(obj, url, reason, notifyData);
-}
-
-static NPError
-webkit_test_plugin_get_value(NPP instance, NPPVariable variable, void *value)
-{
-    PluginObject* obj = 0;
-    if (instance)
-        obj = static_cast<PluginObject*>(instance->pdata);
-
-    // First, check if the PluginTest object supports getting this value.
-    if (obj && obj->pluginTest->NPP_GetValue(variable, value) == NPERR_NO_ERROR)
-        return NPERR_NO_ERROR;
-    
-    NPError err = NPERR_NO_ERROR;
-
-    switch (variable) {
-        case NPPVpluginNameString:
-            *((char **)value) = const_cast<char*>("WebKit Test PlugIn");
-            break;
-        case NPPVpluginDescriptionString:
-            *((char **)value) = const_cast<char*>("Simple Netscape plug-in that handles test content for WebKit");
-            break;
-        case NPPVpluginNeedsXEmbed:
-            *((NPBool *)value) = TRUE;
-            break;
-        case NPPVpluginScriptableIID:
-        case NPPVpluginScriptableInstance:
-        case NPPVpluginScriptableNPObject:
-            err = NPERR_GENERIC_ERROR;
-            break;
-        default:
-            err = NPERR_GENERIC_ERROR;
-            break;
-    }
-
-    if (variable == NPPVpluginScriptableNPObject) {
-        void **v = (void **)value;
-        browser->retainobject((NPObject *)obj);
-        *v = obj;
-        err = NPERR_NO_ERROR;
-    }
-
-    return err;
-}
-
-static NPError
-webkit_test_plugin_set_value(NPP instance, NPNVariable variable, void* value)
-{
-    PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
-
-    switch (variable) {
-        case NPNVprivateModeBool:
-            obj->cachedPrivateBrowsingMode = *(NPBool*)value;
-            return NPERR_NO_ERROR;
-        default:
-            return NPERR_GENERIC_ERROR;
-    }
-}
-
-char *
-NP_GetMIMEDescription(void)
-{
-    // We sentence-case the mime-type here to ensure that ports are not
-    // case-sensitive when loading plugins. See https://webkit.org/b/36815
-    return const_cast<char*>("application/x-Webkit-Test-Netscape:testnetscape:test netscape content;image/png:png:PNG image");
-}
-
-NPError
-NP_Initialize (NPNetscapeFuncs *aMozillaVTable, NPPluginFuncs *aPluginVTable)
-{
-    if (aMozillaVTable == NULL || aPluginVTable == NULL)
-        return NPERR_INVALID_FUNCTABLE_ERROR;
-
-    if ((aMozillaVTable->version >> 8) > NP_VERSION_MAJOR)
-        return NPERR_INCOMPATIBLE_VERSION_ERROR;
-
-    if (aPluginVTable->size < sizeof (NPPluginFuncs))
-        return NPERR_INVALID_FUNCTABLE_ERROR;
-
-    browser = aMozillaVTable;
-    pluginFunctions = aPluginVTable;
-
-        aPluginVTable->size           = sizeof (NPPluginFuncs);
-        aPluginVTable->version        = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
-        aPluginVTable->newp           = webkit_test_plugin_new_instance;
-        aPluginVTable->destroy        = webkit_test_plugin_destroy_instance;
-        aPluginVTable->setwindow      = webkit_test_plugin_set_window;
-        aPluginVTable->newstream      = webkit_test_plugin_new_stream;
-        aPluginVTable->destroystream  = webkit_test_plugin_destroy_stream;
-        aPluginVTable->asfile         = webkit_test_plugin_stream_as_file;
-        aPluginVTable->writeready     = webkit_test_plugin_write_ready;
-        aPluginVTable->write          = webkit_test_plugin_write;
-        aPluginVTable->print          = webkit_test_plugin_print;
-        aPluginVTable->event          = webkit_test_plugin_handle_event;
-        aPluginVTable->urlnotify      = webkit_test_plugin_url_notify;
-        aPluginVTable->javaClass      = NULL;
-        aPluginVTable->getvalue       = webkit_test_plugin_get_value;
-        aPluginVTable->setvalue       = webkit_test_plugin_set_value;
-
-    return NPERR_NO_ERROR;
-}
-
-NPError
-NP_Shutdown(void)
-{
-    return NPERR_NO_ERROR;
-}
-
-NPError
-NP_GetValue(void* /*future*/, NPPVariable variable, void *value)
-{
-    return webkit_test_plugin_get_value(NULL, variable, value);
-}

Modified: trunk/Tools/GNUmakefile.am (88711 => 88712)


--- trunk/Tools/GNUmakefile.am	2011-06-13 22:23:20 UTC (rev 88711)
+++ trunk/Tools/GNUmakefile.am	2011-06-13 22:25:34 UTC (rev 88712)
@@ -266,7 +266,6 @@
 	Tools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npapi.h \
 	Tools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npfunctions.h \
 	Tools/DumpRenderTree/unix/TestNetscapePlugin/ForwardingHeaders/WebKit/npruntime.h \
-	Tools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp \
 	Tools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp \
 	Tools/DumpRenderTree/TestNetscapePlugIn/Tests/EvaluateJSAfterRemovingPluginElement.cpp \
 	Tools/DumpRenderTree/TestNetscapePlugIn/Tests/GetURLNotifyWithURLThatFailsToLoad.cpp \
@@ -285,7 +284,8 @@
 	Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp \
 	Tools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h \
 	Tools/DumpRenderTree/TestNetscapePlugIn/TestObject.cpp \
-	Tools/DumpRenderTree/TestNetscapePlugIn/TestObject.h
+	Tools/DumpRenderTree/TestNetscapePlugIn/TestObject.h \
+	Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp
 
 TestNetscapePlugin_libtestnetscapeplugin_la_LDFLAGS = \
 	-rpath ${shell pwd}/$(top_builddir)/../unix/TestNetscapePlugin/.libs \
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to