+2008-05-09 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Anders Carlsson.
+
+ Update TestNetscapePlugIn to build 64-bit using the Cocoa event model.
+
+ It currently does not attempt to print events which means that plugins/mouse-events.html
+ will fail when run 64-bit. All other tests that use this plugin pass.
+
+ * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp:
+ (testGetIntIdentifier):
+ * DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp:
+ (NPP_New):
+ (NPP_HandleEvent):
+
2008-05-09 Brady Eidson <beidson@apple.com>
Reviewed by Adam Roben
#import "PluginObject.h"
+#if __LP64__
+#define USE_COCOA_EVENT_MODEL 1
+#endif
+
// Mach-o entry points
extern "C" {
NPError NP_Initialize(NPNetscapeFuncs *browserFuncs);
NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved)
{
+#if USE_COCOA_EVENT_MODEL
+ // If the browser supports the Cocoa event model, enable it.
+ NPBool supportsCocoa;
+ if (browser->getvalue(instance, NPNVsupportsCocoaBool, &supportsCocoa) != NPERR_NO_ERROR)
+ supportsCocoa = FALSE;
+
+ if (!supportsCocoa)
+ return NPERR_INCOMPATIBLE_VERSION_ERROR;
+
+ browser->setvalue(instance, NPPVpluginEventModel, (void *)NPEventModelCocoa);
+#endif
+
if (browser->version >= 14) {
PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass());
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
if (!obj->eventLogging)
return 0;
-
+
+#if USE_COCOA_EVENT_MODEL
+ // FIXME: Generate output that will match the Carbon event model
+ // so that the layout tests using this plug-in will work in either model.
+ NPCocoaEvent *cocoaEvent = static_cast<NPCocoaEvent*>(event);
+ switch (cocoaEvent->type) {
+ case NPCocoaEventWindowFocusChanged:
+ case NPCocoaEventFocusChanged:
+ return 1;
+
+ case NPCocoaEventDrawRect:
+ return 1;
+
+ case NPCocoaEventKeyDown:
+ case NPCocoaEventKeyUp:
+ case NPCocoaEventFlagsChanged:
+ return 1;
+
+ case NPCocoaEventMouseDown:
+ case NPCocoaEventMouseUp:
+
+ case NPCocoaEventMouseMoved:
+ case NPCocoaEventMouseEntered:
+ case NPCocoaEventMouseExited:
+ case NPCocoaEventMouseDragged:
+ case NPCocoaEventScrollWheel:
+ return 1;
+ }
+#else
EventRecord* evt = static_cast<EventRecord*>(event);
Point pt = { evt->where.v, evt->where.h };
switch (evt->what) {
default:
printf("PLUGIN: event %d\n", evt->what);
}
-
+#endif
return 0;
}