Changeset 63000 in webkit
- Timestamp:
- Jul 9, 2010 3:07:50 PM (14 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r62996 r63000 1 2010-07-09 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig and Dan Bernstein. 4 5 Handle setting of drawing and event models 6 https://bugs.webkit.org/show_bug.cgi?id=41994 7 8 * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp: 9 Handle NPPVpluginDrawingModel and NPPVpluginEventModel. 10 11 * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: 12 (WebKit::NetscapePlugin::NetscapePlugin): 13 Initialize m_inNPPNew. 14 15 (WebKit::NetscapePlugin::~NetscapePlugin): 16 Assert that we aren't still running. 17 18 (WebKit::NetscapePlugin::fromNPP): 19 New function that returns a NetscapePlugin object given a NPP pointer. 20 21 (WebKit::NetscapePlugin::initialize): 22 * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.cpp: 23 (WebKit::NetscapePlugin::setDrawingModel): 24 Set the drawing model. 25 26 (WebKit::NetscapePlugin::setEventModel): 27 Set the event model. 28 29 (WebKit::initializeEvent): 30 (WebKit::NetscapePlugin::platformPaint): 31 Only send the Cocoa event when using the Cocoa event model. 32 1 33 2010-07-09 Sam Weinig <sam@webkit.org> 2 34 -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
r62964 r63000 26 26 #include "NetscapeBrowserFuncs.h" 27 27 28 #include "NetscapePlugin.h" 28 29 #include "NotImplemented.h" 29 30 … … 223 224 } 224 225 225 NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value) 226 { 227 notImplemented(); 228 return NPERR_GENERIC_ERROR; 226 NPError NPN_SetValue(NPP npp, NPPVariable variable, void *value) 227 { 228 switch (variable) { 229 #if PLATFORM(MAC) 230 case NPPVpluginDrawingModel: { 231 RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); 232 233 NPDrawingModel drawingModel = static_cast<NPDrawingModel>(reinterpret_cast<uintptr_t>(value)); 234 return plugin->setDrawingModel(drawingModel); 235 } 236 237 case NPPVpluginEventModel: { 238 RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp); 239 240 NPEventModel eventModel = static_cast<NPEventModel>(reinterpret_cast<uintptr_t>(value)); 241 return plugin->setEventModel(eventModel); 242 } 243 #endif 244 245 default: 246 notImplemented(); 247 return NPERR_GENERIC_ERROR; 248 } 249 250 return NPERR_NO_ERROR; 229 251 } 230 252 -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
r62993 r63000 37 37 , m_npWindow() 38 38 , m_isStarted(false) 39 , m_inNPPNew(false) 39 40 #if PLATFORM(MAC) 40 41 , m_drawingModel(static_cast<NPDrawingModel>(-1)) … … 48 49 NetscapePlugin::~NetscapePlugin() 49 50 { 51 ASSERT(!m_isStarted); 52 } 53 54 PassRefPtr<NetscapePlugin> NetscapePlugin::fromNPP(NPP npp) 55 { 56 if (npp) { 57 NetscapePlugin* plugin = static_cast<NetscapePlugin*>(npp->ndata); 58 ASSERT(npp == &plugin->m_npp); 59 60 return plugin; 61 } 62 63 // FIXME: Return the current NetscapePlugin here. 64 ASSERT_NOT_REACHED(); 65 return 0; 50 66 } 51 67 … … 68 84 uint16_t mode = loadManually ? NP_FULL : NP_EMBED; 69 85 86 m_inNPPNew = true; 87 70 88 // FIXME: Pass arguments to NPP_New. 71 89 NPError error = m_pluginModule->pluginFuncs().newp(0, &m_npp, mode, 0, 0, 0, 0); 90 91 m_inNPPNew = false; 92 72 93 if (error != NPERR_NO_ERROR) 73 94 return false; -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
r62993 r63000 41 41 virtual ~NetscapePlugin(); 42 42 43 static PassRefPtr<NetscapePlugin> fromNPP(NPP); 44 45 #if PLATFORM(MAC) 46 NPError setDrawingModel(NPDrawingModel); 47 NPError setEventModel(NPEventModel); 48 #endif 49 43 50 private: 44 51 NetscapePlugin(PassRefPtr<NetscapePluginModule> pluginModule); … … 63 70 64 71 bool m_isStarted; 72 bool m_inNPPNew; 65 73 66 74 #if PLATFORM(MAC) -
trunk/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.cpp
r62993 r63000 31 31 32 32 namespace WebKit { 33 34 NPError NetscapePlugin::setDrawingModel(NPDrawingModel drawingModel) 35 { 36 // The drawing model can only be set from NPP_New. 37 if (!m_inNPPNew) 38 return NPERR_GENERIC_ERROR; 39 40 switch (drawingModel) { 41 #ifndef NP_NO_QUICKDRAW 42 case NPDrawingModelQuickDraw: 43 #endif 44 case NPDrawingModelCoreGraphics: 45 case NPDrawingModelCoreAnimation: 46 m_drawingModel = drawingModel; 47 break; 48 49 default: 50 return NPERR_GENERIC_ERROR; 51 } 52 53 return NPERR_NO_ERROR; 54 } 55 56 NPError NetscapePlugin::setEventModel(NPEventModel eventModel) 57 { 58 // The event model can only be set from NPP_New. 59 if (!m_inNPPNew) 60 return NPERR_GENERIC_ERROR; 61 62 switch (eventModel) { 63 #ifndef NP_NO_CARBON 64 case NPEventModelCarbon: 65 #endif 66 case NPEventModelCocoa: 67 m_eventModel = eventModel; 68 break; 69 70 default: 71 return NPERR_GENERIC_ERROR; 72 } 73 74 return NPERR_NO_ERROR; 75 } 33 76 34 77 bool NetscapePlugin::platformPostInitialize() … … 72 115 } 73 116 117 static inline NPCocoaEvent initializeEvent(NPCocoaEventType type) 118 { 119 NPCocoaEvent event; 120 121 event.type = type; 122 event.version = 0; 123 124 return event; 125 } 126 74 127 void NetscapePlugin::platformPaint(GraphicsContext* context, const IntRect& dirtyRect) 75 128 { 76 NPCocoaEvent event; 77 event.type = NPCocoaEventDrawRect; 78 event.version = 0; 79 event.data.draw.context = context->platformContext(); 80 event.data.draw.x = dirtyRect.x() - m_frameRect.x(); 81 event.data.draw.y = dirtyRect.y() - m_frameRect.y(); 82 event.data.draw.width = dirtyRect.width(); 83 event.data.draw.height = dirtyRect.height(); 129 switch (m_eventModel) { 130 case NPEventModelCocoa: { 131 NPCocoaEvent event = initializeEvent(NPCocoaEventDrawRect); 84 132 85 m_pluginModule->pluginFuncs().event(&m_npp, &event); 133 event.data.draw.context = context->platformContext(); 134 event.data.draw.x = dirtyRect.x() - m_frameRect.x(); 135 event.data.draw.y = dirtyRect.y() - m_frameRect.y(); 136 event.data.draw.width = dirtyRect.width(); 137 event.data.draw.height = dirtyRect.height(); 138 139 m_pluginModule->pluginFuncs().event(&m_npp, &event); 140 break; 141 } 142 143 default: 144 ASSERT_NOT_REACHED(); 145 } 86 146 } 87 147
Note: See TracChangeset
for help on using the changeset viewer.