Changeset 64063 in webkit
- Timestamp:
- Jul 26, 2010 12:41:59 PM (14 years ago)
- Location:
- trunk/WebKit2
- Files:
-
- 1 added
- 1 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r64059 r64063 23 23 * WebProcess/WebPage/LayerBackedDrawingArea.cpp: 24 24 (WebKit::LayerBackedDrawingArea::LayerBackedDrawingArea): 25 26 2010-07-26 Anders Carlsson <andersca@apple.com> 27 28 Reviewed by Sam Weinig. 29 30 Deliver mouse and wheel events to plug-ins 31 https://bugs.webkit.org/show_bug.cgi?id=42988 32 33 * Shared/WebEvent.h: 34 (WebKit::WebMouseEvent::WebMouseEvent): 35 (WebKit::WebMouseEvent::deltaX): 36 (WebKit::WebMouseEvent::deltaY): 37 (WebKit::WebMouseEvent::deltaZ): 38 * Shared/mac/WebEventFactory.mm: 39 (WebKit::WebEventFactory::createWebMouseEvent): 40 Add deltaX, deltaY and deltaZ member variables to WebMosueEvent. 41 42 * WebKit2.xcodeproj/project.pbxproj: 43 Rename NetscapePluginMac.cpp to NetscapePluginMac.mm. 44 45 * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: 46 (WebKit::NetscapePlugin::NPP_HandleEvent): 47 Add NPP_ wrapper. 48 49 (WebKit::NetscapePlugin::handleMouseEvent): 50 (WebKit::NetscapePlugin::handleWheelEvent): 51 Call the platform variants. 52 53 * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm: Added. 54 (WebKit::modifierFlags): 55 (WebKit::buttonNumber): 56 (WebKit::initializeMouseEvent): 57 (WebKit::NetscapePlugin::platformHandleMouseEvent): 58 Create an NPCocoaEvent and send it to the plug-in. 59 60 (WebKit::NetscapePlugin::platformHandleWheelEvent): 61 Ditto. 62 63 * WebProcess/Plugins/PluginView.cpp: 64 (WebKit::PluginView::handleEvent): 65 Get the current WebEvent and send it to the plug-in if necessary. 66 67 * WebProcess/WebPage/WebPage.cpp: 68 (WebKit::WebPage::currentEvent): 69 (WebKit::CurrentEvent::CurrentEvent): 70 (WebKit::CurrentEvent::~CurrentEvent): 71 (WebKit::WebPage::mouseEvent): 72 (WebKit::WebPage::wheelEvent): 73 (WebKit::WebPage::keyEvent): 74 * WebProcess/WebPage/WebPage.h: 75 Add RAII object for keeping track of the current event. 25 76 26 77 2010-07-26 Anders Carlsson <andersca@apple.com> -
trunk/WebKit2/Shared/WebEvent.h
r61719 r64063 121 121 } 122 122 123 WebMouseEvent(Type type, Button button, int x, int y, int globalX, int globalY, int clickCount, Modifiers modifiers, double timestamp)123 WebMouseEvent(Type type, Button button, int x, int y, int globalX, int globalY, float deltaX, float deltaY, float deltaZ, int clickCount, Modifiers modifiers, double timestamp) 124 124 : WebEvent(type, modifiers, timestamp) 125 125 , m_button(button) … … 128 128 , m_globalPositionX(globalX) 129 129 , m_globalPositionY(globalY) 130 , m_deltaX(deltaX) 131 , m_deltaY(deltaY) 132 , m_deltaZ(deltaZ) 130 133 , m_clickCount(clickCount) 131 134 { … … 138 141 int globalPositionX() const { return m_globalPositionX; } 139 142 int globalPositionY() const { return m_globalPositionY; } 143 float deltaX() const { return m_deltaX; } 144 float deltaY() const { return m_deltaY; } 145 float deltaZ() const { return m_deltaZ; } 140 146 int clickCount() const { return m_clickCount; } 141 147 … … 161 167 int m_globalPositionX; 162 168 int m_globalPositionY; 169 float m_deltaX; 170 float m_deltaY; 171 float m_deltaZ; 163 172 int m_clickCount; 164 173 }; -
trunk/WebKit2/Shared/mac/WebEventFactory.mm
r57308 r64063 964 964 int globalPositionX = globalPosition.x; 965 965 int globalPositionY = globalPosition.y; 966 float deltaX = [event deltaX]; 967 float deltaY = [event deltaY]; 968 float deltaZ = [event deltaZ]; 966 969 int clickCount = clickCountForEvent(event); 967 970 WebEvent::Modifiers modifiers = modifiersForEvent(event); 968 971 double timestamp = [event timestamp]; 969 972 970 return WebMouseEvent(type, button, positionX, positionY, globalPositionX, globalPositionY, clickCount, modifiers, timestamp);973 return WebMouseEvent(type, button, positionX, positionY, globalPositionX, globalPositionY, deltaX, deltaY, deltaZ, clickCount, modifiers, timestamp); 971 974 } 972 975 -
trunk/WebKit2/Shared/win/WebEventFactory.cpp
r57308 r64063 404 404 WebEvent::Modifiers modifiers = modifiersForEvent(wParam); 405 405 406 return WebMouseEvent(type, button, positionX, positionY, globalPositionX, globalPositionY, clickCount, modifiers, timestamp);406 return WebMouseEvent(type, button, positionX, positionY, globalPositionX, globalPositionY, 0, 0, 0, clickCount, modifiers, timestamp); 407 407 } 408 408 -
trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj
r63930 r64063 74 74 1AADE6FF10D855FC00D3D63D /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AADE6FE10D855FC00D3D63D /* ApplicationServices.framework */; }; 75 75 1AE117F611DBB30900981615 /* ProcessLauncher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE117F511DBB30900981615 /* ProcessLauncher.cpp */; }; 76 1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac. cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.cpp*/; };76 1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */; }; 77 77 1AEFCC1211D01F96008219D3 /* PluginInfoStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEFCC1011D01F96008219D3 /* PluginInfoStore.h */; }; 78 78 1AEFCC1311D01F96008219D3 /* PluginInfoStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AEFCC1111D01F96008219D3 /* PluginInfoStore.cpp */; }; … … 359 359 1AADE6FE10D855FC00D3D63D /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = System/Library/Frameworks/ApplicationServices.framework; sourceTree = SDKROOT; }; 360 360 1AE117F511DBB30900981615 /* ProcessLauncher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessLauncher.cpp; sourceTree = "<group>"; }; 361 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac. cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetscapePluginMac.cpp; sourceTree = "<group>"; };361 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetscapePluginMac.mm; sourceTree = "<group>"; }; 362 362 1AEFCC1011D01F96008219D3 /* PluginInfoStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginInfoStore.h; sourceTree = "<group>"; }; 363 363 1AEFCC1111D01F96008219D3 /* PluginInfoStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginInfoStore.cpp; sourceTree = "<group>"; }; … … 709 709 isa = PBXGroup; 710 710 children = ( 711 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac. cpp*/,711 1AE5B7F911E7AED200BA6767 /* NetscapePluginMac.mm */, 712 712 1A6FBA0211E6813E00DB1371 /* NetscapePluginModuleMac.cpp */, 713 713 ); … … 1402 1402 1A6FBA2B11E6862700DB1371 /* NetscapeBrowserFuncs.cpp in Sources */, 1403 1403 1A6FBD2911E69BC200DB1371 /* NetscapePlugin.cpp in Sources */, 1404 1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac. cppin Sources */,1404 1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */, 1405 1405 1A6FB90C11E66FBC00DB1371 /* NetscapePluginModule.cpp in Sources */, 1406 1406 1A6FBA0311E6813E00DB1371 /* NetscapePluginModuleMac.cpp in Sources */, -
trunk/WebKit2/WebProcess/Plugins/DummyPlugin.cpp
r63493 r64063 96 96 } 97 97 98 bool DummyPlugin::handleMouseEvent(const WebMouseEvent&) 99 { 100 return false; 101 } 102 103 bool DummyPlugin::handleWheelEvent(const WebWheelEvent&) 104 { 105 return false; 106 } 107 98 108 } // namespace WebKit -
trunk/WebKit2/WebProcess/Plugins/DummyPlugin.h
r63493 r64063 55 55 virtual void streamDidFinishLoading(uint64_t streamID); 56 56 virtual void streamDidFail(uint64_t streamID, bool wasCancelled); 57 57 virtual bool handleMouseEvent(const WebMouseEvent&); 58 virtual bool handleWheelEvent(const WebWheelEvent&); 59 58 60 virtual PluginController* controller(); 59 61 }; -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
r63704 r64063 206 206 } 207 207 208 int16_t NetscapePlugin::NPP_HandleEvent(void* event) 209 { 210 return m_pluginModule->pluginFuncs().event(&m_npp, event); 211 } 212 208 213 void NetscapePlugin::NPP_URLNotify(const char* url, NPReason reason, void* notifyData) 209 214 { … … 409 414 } 410 415 416 bool NetscapePlugin::handleMouseEvent(const WebMouseEvent& mouseEvent) 417 { 418 return platformHandleMouseEvent(mouseEvent); 419 } 420 421 bool NetscapePlugin::handleWheelEvent(const WebWheelEvent& wheelEvent) 422 { 423 return platformHandleWheelEvent(wheelEvent); 424 } 425 411 426 PluginController* NetscapePlugin::controller() 412 427 { -
trunk/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
r63704 r64063 75 75 NPError NPP_DestroyStream(NPStream*, NPReason); 76 76 void NPP_StreamAsFile(NPStream*, const char* filename); 77 78 77 int32_t NPP_WriteReady(NPStream*); 79 78 int32_t NPP_Write(NPStream*, int32_t offset, int32_t len, void* buffer); 79 int16_t NPP_HandleEvent(void* event); 80 80 void NPP_URLNotify(const char* url, NPReason, void* notifyData); 81 81 NPError NPP_GetValue(NPPVariable, void *value); … … 93 93 void platformPaint(WebCore::GraphicsContext*, const WebCore::IntRect& dirtyRect); 94 94 95 bool platformHandleMouseEvent(const WebMouseEvent&); 96 bool platformHandleWheelEvent(const WebWheelEvent&); 97 95 98 // Plugin 96 99 virtual bool initialize(PluginController*, const Parameters&); … … 106 109 virtual void streamDidFinishLoading(uint64_t streamID); 107 110 virtual void streamDidFail(uint64_t streamID, bool wasCancelled); 111 virtual bool handleMouseEvent(const WebMouseEvent&); 112 virtual bool handleWheelEvent(const WebWheelEvent&); 108 113 109 114 virtual PluginController* controller(); … … 146 151 { 147 152 } 153 154 bool NetscapePlugin::platformHandleMouseEvent(const WebMouseEvent&) 155 { 156 return false; 157 } 158 159 bool NetscapePlugin::platformHandleWheelEvent(const WebWheelEvent&) 160 { 161 return false; 162 } 163 148 164 #endif 149 165 -
trunk/WebKit2/WebProcess/Plugins/Plugin.h
r63493 r64063 38 38 namespace WebKit { 39 39 40 class WebMouseEvent; 41 class WebWheelEvent; 42 40 43 class PluginController; 41 44 … … 87 90 virtual void streamDidFail(uint64_t streamID, bool wasCancelled) = 0; 88 91 92 // Tells the plug-in to handle the passed in mouse event. The plug-in should return true if it processed the event. 93 virtual bool handleMouseEvent(const WebMouseEvent&) = 0; 94 95 // Tells the plug-in to handle the passed in wheel event. The plug-in should return true if it processed the event. 96 virtual bool handleWheelEvent(const WebWheelEvent&) = 0; 97 89 98 // Returns the plug-in controller for this plug-in. 90 99 // FIXME: We could just have the controller be a member variable of Plugin. -
trunk/WebKit2/WebProcess/Plugins/PluginView.cpp
r63846 r64063 27 27 28 28 #include "Plugin.h" 29 #include "WebEvent.h" 30 #include "WebPage.h" 29 31 #include <WebCore/DocumentLoader.h> 30 32 #include <WebCore/Event.h> … … 319 321 } 320 322 321 void PluginView::handleEvent(Event*) 322 { 323 // FIXME: Implement. 323 void PluginView::handleEvent(Event* event) 324 { 325 const WebEvent* currentEvent = WebPage::currentEvent(); 326 if (!currentEvent) 327 return; 328 329 bool didHandleEvent = false; 330 331 if ((event->type() == eventNames().mousemoveEvent && currentEvent->type() == WebEvent::MouseMove) 332 || (event->type() == eventNames().mousedownEvent && currentEvent->type() == WebEvent::MouseDown) 333 || (event->type() == eventNames().mouseupEvent && currentEvent->type() == WebEvent::MouseUp)) { 334 // We have a mouse event. 335 didHandleEvent = m_plugin->handleMouseEvent(static_cast<const WebMouseEvent&>(*currentEvent)); 336 } else if (event->type() == eventNames().mousewheelEvent && currentEvent->type() == WebEvent::Wheel) { 337 // We have a wheel event. 338 didHandleEvent = m_plugin->handleWheelEvent(static_cast<const WebWheelEvent&>(*currentEvent)); 339 } 340 341 if (didHandleEvent) 342 event->setDefaultHandled(); 324 343 } 325 344 -
trunk/WebKit2/WebProcess/WebPage/WebPage.cpp
r64050 r64063 278 278 // Events 279 279 280 static const WebEvent* g_currentEvent = 0; 281 282 // FIXME: WebPage::currentEvent is used by the plug-in code to avoid having to convert from DOM events back to 283 // WebEvents. When we get the event handling sorted out, this should go away and the Widgets should get the correct 284 // platform events passed to the event handler code. 285 const WebEvent* WebPage::currentEvent() 286 { 287 return g_currentEvent; 288 } 289 290 class CurrentEvent { 291 public: 292 explicit CurrentEvent(const WebEvent& event) 293 : m_previousCurrentEvent(g_currentEvent) 294 { 295 g_currentEvent = &event; 296 } 297 298 ~CurrentEvent() 299 { 300 g_currentEvent = m_previousCurrentEvent; 301 } 302 303 private: 304 const WebEvent* m_previousCurrentEvent; 305 }; 306 280 307 void WebPage::mouseEvent(const WebMouseEvent& mouseEvent) 281 308 { 309 CurrentEvent currentEvent(mouseEvent); 310 282 311 WebProcess::shared().connection()->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In(static_cast<uint32_t>(mouseEvent.type()))); 283 312 … … 305 334 void WebPage::wheelEvent(const WebWheelEvent& wheelEvent) 306 335 { 336 CurrentEvent currentEvent(wheelEvent); 337 307 338 WebProcess::shared().connection()->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In(static_cast<uint32_t>(wheelEvent.type()))); 308 339 if (!m_mainFrame->coreFrame()->view()) … … 315 346 void WebPage::keyEvent(const WebKeyboardEvent& keyboardEvent) 316 347 { 348 CurrentEvent currentEvent(keyboardEvent); 349 317 350 WebProcess::shared().connection()->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In(static_cast<uint32_t>(keyboardEvent.type()))); 318 351 -
trunk/WebKit2/WebProcess/WebPage/WebPage.h
r64050 r64063 55 55 56 56 class DrawingArea; 57 class WebEvent; 57 58 class WebFrame; 58 59 class WebKeyboardEvent; … … 110 111 #endif 111 112 113 static const WebEvent* currentEvent(); 114 112 115 private: 113 116 WebPage(uint64_t pageID, const WebCore::IntSize& viewSize, const WebPreferencesStore&, DrawingArea::Type);
Note: See TracChangeset
for help on using the changeset viewer.