[OOP] Add support for NPN_ConvertPoint via IPC. b=555250 r=cjones

This commit is contained in:
Josh Aas 2010-03-26 16:55:56 -04:00
parent 2ccc87e3f1
commit 5baa1625d5
5 changed files with 81 additions and 3 deletions

View File

@ -50,6 +50,7 @@ using NPRemoteWindow;
using NPRemoteEvent;
using NPRect;
using NPNURLVariable;
using NPCoordinateSpace;
using mozilla::plugins::NativeWindowHandle;
namespace mozilla {
@ -146,6 +147,10 @@ parent:
nsCString realm)
returns (nsCString username, nsCString password, NPError result);
rpc NPN_ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
NPCoordinateSpace destSpace)
returns (double destX, bool ignoreDestX, double destY, bool ignoreDestY, bool result);
both:
async PPluginScriptableObject();

View File

@ -990,13 +990,32 @@ PluginInstanceParent::AnswerNPN_GetAuthenticationInfo(const nsCString& protocol,
return true;
}
bool
PluginInstanceParent::AnswerNPN_ConvertPoint(const double& sourceX,
const double& sourceY,
const NPCoordinateSpace& sourceSpace,
const NPCoordinateSpace& destSpace,
double *destX,
bool *ignoreDestX,
double *destY,
bool *ignoreDestY,
bool *result)
{
*result = mNPNIface->convertpoint(mNPP, sourceX, sourceY, sourceSpace,
ignoreDestX ? nsnull : destX,
ignoreDestY ? nsnull : destY,
destSpace);
return true;
}
#if defined(OS_WIN)
/*
plugin focus changes between processes
focus from dom -> child:
Focs manager calls on widget to set the focus on the window.
Focus manager calls on widget to set the focus on the window.
We pick up the resulting wm_setfocus event here, and forward
that over ipc to the child which calls set focus on itself.

View File

@ -188,6 +188,17 @@ public:
nsCString* password,
NPError* result);
NS_OVERRIDE virtual bool
AnswerNPN_ConvertPoint(const double& sourceX,
const double& sourceY,
const NPCoordinateSpace& sourceSpace,
const NPCoordinateSpace& destSpace,
double *destX,
bool *ignoreDestX,
double *destY,
bool *ignoreDestY,
bool *result);
NPError NPP_SetWindow(const NPWindow* aWindow);
NPError NPP_GetValue(NPPVariable variable, void* retval);

View File

@ -676,6 +676,35 @@ struct ParamTraits<NPNURLVariable>
}
};
template<>
struct ParamTraits<NPCoordinateSpace>
{
typedef NPCoordinateSpace paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, int32(aParam));
}
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
{
int32 intval;
if (ReadParam(aMsg, aIter, &intval)) {
switch (intval) {
case NPCoordinateSpacePlugin:
case NPCoordinateSpaceWindow:
case NPCoordinateSpaceFlippedWindow:
case NPCoordinateSpaceScreen:
case NPCoordinateSpaceFlippedScreen:
*aResult = paramType(intval);
return true;
}
}
return false;
}
};
} /* namespace IPC */

View File

@ -1451,8 +1451,22 @@ _convertpoint(NPP instance,
{
PLUGIN_LOG_DEBUG_FUNCTION;
AssertPluginThread();
NS_WARNING("Not yet implemented!");
return 0;
double rDestX = 0;
bool ignoreDestX = !destX;
double rDestY = 0;
bool ignoreDestY = !destY;
bool result = false;
InstCast(instance)->CallNPN_ConvertPoint(sourceX, sourceY, sourceSpace, destSpace,
&rDestX, &ignoreDestX, &rDestY, &ignoreDestY, &result);
if (result) {
if (destX)
*destX = rDestX;
if (destY)
*destY = rDestY;
}
return result;
}
} /* namespace child */