Commit b5494b04 authored by andersca@apple.com's avatar andersca@apple.com

2008-05-01 Anders Carlsson <andersca@apple.com>

        Reviewed by Adam.

        Forward mouse move events to the Netscape plug-in view.
        
        * Plugins/WebBaseNetscapePluginView.h:
        * Plugins/WebBaseNetscapePluginView.mm:
        (-[WebBaseNetscapePluginView handleMouseMoved:]):
        New method that just calls the current event handler.
        
        * Plugins/WebNetscapePluginEventHandlerCocoa.mm:
        (WebNetscapePluginEventHandlerCocoa::flagsChanged):
        NSFlagsChanged is not a regular keyboard event and some of the NSEvent accessors
        don't work on it so don't call them.
        
        * WebCoreSupport/WebFrameLoaderClient.mm:
        (NetscapePluginWidget::NetscapePluginWidget):
        New Widget subclass to be used for Netscape plug-ins.
        
        (NetscapePluginWidget::handleEvent):
        Forward NSMouseMoved events to the plug-in.
        
        (WebFrameLoaderClient::createPlugin):
        Wrap the plug-in view in a NetscapePluginWidget.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@32770 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1c6421cb
2008-05-01 Anders Carlsson <andersca@apple.com>
Reviewed by Adam.
Forward mouse move events to the Netscape plug-in view.
* Plugins/WebBaseNetscapePluginView.h:
* Plugins/WebBaseNetscapePluginView.mm:
(-[WebBaseNetscapePluginView handleMouseMoved:]):
New method that just calls the current event handler.
* Plugins/WebNetscapePluginEventHandlerCocoa.mm:
(WebNetscapePluginEventHandlerCocoa::flagsChanged):
NSFlagsChanged is not a regular keyboard event and some of the NSEvent accessors
don't work on it so don't call them.
* WebCoreSupport/WebFrameLoaderClient.mm:
(NetscapePluginWidget::NetscapePluginWidget):
New Widget subclass to be used for Netscape plug-ins.
(NetscapePluginWidget::handleEvent):
Forward NSMouseMoved events to the plug-in.
(WebFrameLoaderClient::createPlugin):
Wrap the plug-in view in a NetscapePluginWidget.
2008-05-01 Alp Toker <alp@nuanti.com>
Rubber-stamped by Anders.
......
......@@ -183,6 +183,8 @@ typedef union PluginPort {
// See <rdar://problem/4480737>.
- (void)didCallPlugInFunction;
- (void)handleMouseMoved:(NSEvent *)event;
@end
#endif
......@@ -867,6 +867,13 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
[[NSCursor arrowCursor] set];
}
// We can't name this method mouseMoved because we don't want to override
// the NSView mouseMoved implementation.
- (void)handleMouseMoved:(NSEvent *)theEvent
{
eventHandler->mouseMoved(theEvent);
}
- (void)mouseDragged:(NSEvent *)theEvent
{
eventHandler->mouseDragged(theEvent);
......
......@@ -108,9 +108,22 @@ void WebNetscapePluginEventHandlerCocoa::keyUp(NSEvent *event)
sendKeyEvent(event, NPCocoaEventKeyUp);
}
void WebNetscapePluginEventHandlerCocoa::flagsChanged(NSEvent *event)
void WebNetscapePluginEventHandlerCocoa::flagsChanged(NSEvent *nsEvent)
{
sendKeyEvent(event, NPCocoaEventFlagsChanged);
NPCocoaEvent event;
NSPoint point = [m_pluginView convertPoint:[nsEvent locationInWindow] fromView:nil];
event.type = NPCocoaEventFlagsChanged;
event.key.modifierFlags = [nsEvent modifierFlags];
event.key.pluginX = point.x;
event.key.pluginY = point.y;
event.key.keyCode = [nsEvent keyCode];
event.key.isARepeat = false;
event.key.characters = 0;
event.key.charactersIgnoringModifiers = 0;
sendEvent(&event);
}
void WebNetscapePluginEventHandlerCocoa::sendKeyEvent(NSEvent* nsEvent, NPCocoaEventType type)
......
......@@ -1208,6 +1208,26 @@ static NSView *pluginView(WebFrame *frame, WebPluginPackage *pluginPackage,
return view;
}
class NetscapePluginWidget : public Widget {
public:
NetscapePluginWidget(WebNetscapePluginEmbeddedView *view)
: Widget(view)
{
}
virtual void handleEvent(Event*)
{
Frame* frame = Frame::frameForWidget(this);
if (!frame)
return;
NSEvent* event = frame->eventHandler()->currentNSEvent();
if ([event type] == NSMouseMoved)
[(WebNetscapePluginEmbeddedView *)getView() handleMouseMoved:event];
}
};
Widget* WebFrameLoaderClient::createPlugin(const IntSize& size, Element* element, const KURL& url,
const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually)
{
......@@ -1280,7 +1300,8 @@ Widget* WebFrameLoaderClient::createPlugin(const IntSize& size, Element* element
attributeValues:kit(paramValues)
loadManually:loadManually
DOMElement:kit(element)] autorelease];
view = embeddedView;
return new NetscapePluginWidget(embeddedView);
}
#endif
} else
......@@ -1331,7 +1352,7 @@ void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget)
END_BLOCK_OBJC_EXCEPTIONS;
}
Widget* WebFrameLoaderClient::createJavaAppletWidget(const IntSize& size, Element* element, const KURL& baseURL,
const Vector<String>& paramNames, const Vector<String>& paramValues)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment