[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-142-g786665c

andersca at apple.com andersca at apple.com
Mon Dec 27 16:28:45 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 2133a40203e682c2b0a57fe6f09db8490c952cfc
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 22 02:01:27 2010 +0000

    2010-12-21  Anders Carlsson  <andersca at apple.com>
    
            Reviewed by Darin Adler.
    
            Can't stop QT music on santastreefarm.com
            https://bugs.webkit.org/show_bug.cgi?id=51438
            <rdar://problem/8741152>
    
            Implement NPN_ConvertPoint.
    
            * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
            (WebKit::NPN_ConvertPoint):
            Call NetscapePlugin::convertPoint.
    
            (WebKit::initializeBrowserFuncs):
            Only initialize NPN_ConvertPoint and NPN_PopUpContextMenu on Mac.
    
            * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
            (WebKit::NetscapePlugin::convertPoint):
            Implement conversion routines.
    
            (WebKit::NetscapePlugin::windowAndViewFramesChanged):
            Keep track of the window and view frames, they are needed to do coordinate conversion.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74445 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 1a800ba..649585f 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,27 @@
+2010-12-21  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Can't stop QT music on santastreefarm.com
+        https://bugs.webkit.org/show_bug.cgi?id=51438
+        <rdar://problem/8741152>
+
+        Implement NPN_ConvertPoint.
+
+        * WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
+        (WebKit::NPN_ConvertPoint):
+        Call NetscapePlugin::convertPoint.
+
+        (WebKit::initializeBrowserFuncs):
+        Only initialize NPN_ConvertPoint and NPN_PopUpContextMenu on Mac.
+
+        * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+        (WebKit::NetscapePlugin::convertPoint):
+        Implement conversion routines.
+
+        (WebKit::NetscapePlugin::windowAndViewFramesChanged):
+        Keep track of the window and view frames, they are needed to do coordinate conversion.
+
 2010-12-21  Sam Weinig  <weinig at apple.com>
 
         Reviewed by Anders Carlsson.
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
index ef186ee..e849598 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
@@ -763,17 +763,30 @@ static void NPN_UnscheduleTimer(NPP instance, uint32_t timerID)
     notImplemented();
 }
 
+#if PLATFORM(MAC)
 static NPError NPN_PopUpContextMenu(NPP instance, NPMenu* menu)
 {
     notImplemented();
     return NPERR_GENERIC_ERROR;
 }
 
-static NPBool NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double* destX, double* destY, NPCoordinateSpace destSpace)
+static NPBool NPN_ConvertPoint(NPP npp, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double* destX, double* destY, NPCoordinateSpace destSpace)
 {
-    notImplemented();
-    return false;
+    RefPtr<NetscapePlugin> plugin = NetscapePlugin::fromNPP(npp);
+
+    double destinationX;
+    double destinationY;
+
+    bool returnValue = plugin->convertPoint(sourceX, sourceY, sourceSpace, destinationX, destinationY, destSpace);
+
+    if (destX)
+        *destX = destinationX;
+    if (destY)
+        *destY = destinationY;
+
+    return returnValue;
 }
+#endif
 
 static void initializeBrowserFuncs(NPNetscapeFuncs &netscapeFuncs)
 {
@@ -831,8 +844,13 @@ static void initializeBrowserFuncs(NPNetscapeFuncs &netscapeFuncs)
     netscapeFuncs.getauthenticationinfo = NPN_GetAuthenticationInfo;
     netscapeFuncs.scheduletimer = NPN_ScheduleTimer;
     netscapeFuncs.unscheduletimer = NPN_UnscheduleTimer;
+#if PLATFORM(MAC)
     netscapeFuncs.popupcontextmenu = NPN_PopUpContextMenu;
     netscapeFuncs.convertpoint = NPN_ConvertPoint;
+#else
+    netscapeFuncs.popupcontextmenu = 0;
+    netscapeFuncs.convertpoint = 0;
+#endif
 }
     
 NPNetscapeFuncs* netscapeBrowserFuncs()
diff --git a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
index c83dc15..683a3d1 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
+++ b/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
@@ -53,6 +53,8 @@ public:
 #if PLATFORM(MAC)
     NPError setDrawingModel(NPDrawingModel);
     NPError setEventModel(NPEventModel);
+    NPBool convertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double& destX, double& destY, NPCoordinateSpace destSpace);
+
 #ifndef NP_NO_CARBON
     WindowRef windowRef() const;
     bool isWindowActive() const { return m_windowHasFocus; }
@@ -202,6 +204,9 @@ private:
     bool m_pluginHasFocus;
     bool m_windowHasFocus;
 
+    WebCore::IntRect m_windowFrameInScreenCoordinates;
+    WebCore::IntRect m_viewFrameInWindowCoordinates;
+
 #ifndef NP_NO_CARBON
     void nullEventTimerFired();
 
diff --git a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
index 5a82cba..872cb4d 100644
--- a/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
+++ b/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
@@ -86,6 +86,77 @@ NPError NetscapePlugin::setEventModel(NPEventModel eventModel)
     return NPERR_NO_ERROR;
 }
 
+static double flipScreenYCoordinate(double y)
+{
+    return [[[NSScreen screens] objectAtIndex:0] frame].size.height - y;
+}
+
+NPBool NetscapePlugin::convertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double& destX, double& destY, NPCoordinateSpace destSpace)
+{
+    if (sourceSpace == destSpace) {
+        destX = sourceX;
+        destY = sourceY;
+        return true;
+    }
+
+    double sourceXInScreenSpace;
+    double sourceYInScreenSpace;
+
+    FloatPoint sourceInScreenSpace;
+    switch (sourceSpace) {
+    case NPCoordinateSpacePlugin:
+        sourceXInScreenSpace = sourceX + m_windowFrameInScreenCoordinates.x() + m_viewFrameInWindowCoordinates.x() + m_npWindow.x;
+        sourceYInScreenSpace = m_windowFrameInScreenCoordinates.y() + m_viewFrameInWindowCoordinates.y() + m_viewFrameInWindowCoordinates.height() - (sourceY + m_npWindow.y);
+        break;
+    case NPCoordinateSpaceWindow:
+        sourceXInScreenSpace = sourceX + m_windowFrameInScreenCoordinates.x();
+        sourceYInScreenSpace = sourceY + m_windowFrameInScreenCoordinates.y();
+        break;
+    case NPCoordinateSpaceFlippedWindow:
+        sourceXInScreenSpace = sourceX + m_windowFrameInScreenCoordinates.x();
+        sourceYInScreenSpace = m_windowFrameInScreenCoordinates.y() + m_windowFrameInScreenCoordinates.height() - sourceY;
+        break;
+    case NPCoordinateSpaceScreen:
+        sourceXInScreenSpace = sourceX;
+        sourceYInScreenSpace = sourceY;
+        break;
+    case NPCoordinateSpaceFlippedScreen:
+        sourceXInScreenSpace = sourceX;
+        sourceYInScreenSpace = flipScreenYCoordinate(sourceY);
+    default:
+        return false;
+    }
+
+    // Now convert back.
+    switch (destSpace) {
+    case NPCoordinateSpacePlugin:
+        destX = sourceXInScreenSpace - (m_windowFrameInScreenCoordinates.x() + m_viewFrameInWindowCoordinates.x() + m_npWindow.x);
+        destY = m_windowFrameInScreenCoordinates.y() + m_viewFrameInWindowCoordinates.y() + m_viewFrameInWindowCoordinates.height() - (sourceYInScreenSpace + m_npWindow.y);
+        break;
+    case NPCoordinateSpaceWindow:
+        destX = sourceXInScreenSpace - m_windowFrameInScreenCoordinates.x();
+        destY = sourceYInScreenSpace - m_windowFrameInScreenCoordinates.y();
+        break;
+    case NPCoordinateSpaceFlippedWindow:
+        destX = sourceXInScreenSpace - m_windowFrameInScreenCoordinates.x();
+        destY = sourceYInScreenSpace - m_windowFrameInScreenCoordinates.y();
+        destY = m_windowFrameInScreenCoordinates.height() - destY;
+        break;
+    case NPCoordinateSpaceScreen:
+        destX = sourceXInScreenSpace;
+        destY = sourceYInScreenSpace;
+        break;
+    case NPCoordinateSpaceFlippedScreen:
+        destX = sourceXInScreenSpace;
+        destY = flipScreenYCoordinate(sourceYInScreenSpace);
+        break;
+    default:
+        return false;
+    }
+
+    return true;
+}
+
 #ifndef NP_NO_CARBON
 typedef HashMap<WindowRef, NetscapePlugin*> WindowMap;
 
@@ -395,7 +466,6 @@ static NPCocoaEvent initializeMouseEvent(const WebMouseEvent& mouseEvent, const
 
     NPCocoaEvent event = initializeEvent(eventType);
     fillInCocoaEventFromMouseEvent(event, mouseEvent, pluginLocation);
-
     return event;
 }
 
@@ -687,8 +757,11 @@ static Rect computeFakeWindowBoundsRect(const WebCore::IntRect& windowFrameInScr
 }
 #endif
 
-void NetscapePlugin::windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates)
+void NetscapePlugin::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates)
 {
+    m_windowFrameInScreenCoordinates = windowFrameInScreenCoordinates;
+    m_viewFrameInWindowCoordinates = viewFrameInWindowCoordinates;
+
     switch (m_eventModel) {
         case NPEventModelCocoa:
             // Nothing to do.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list