mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 20:49:27 +00:00
Gecko should use NPAPI directly, remove nsplugindefs.h abstractions. b=516661 r/sr=jst
This commit is contained in:
parent
785911363a
commit
2a7ea592aa
@ -347,8 +347,8 @@ nsPluginDocument::Print()
|
||||
objectFrame->GetPluginInstance(*getter_AddRefs(pi));
|
||||
|
||||
if (pi) {
|
||||
nsPluginPrint npprint;
|
||||
npprint.mode = nsPluginMode_Full;
|
||||
NPPrint npprint;
|
||||
npprint.mode = NP_FULL;
|
||||
npprint.print.fullPrint.pluginPrinted = PR_FALSE;
|
||||
npprint.print.fullPrint.printOne = PR_FALSE;
|
||||
npprint.print.fullPrint.platformPrint = nsnull;
|
||||
|
@ -411,7 +411,7 @@ public:
|
||||
PRUint32 aPostDataLen, void *aHeadersData,
|
||||
PRUint32 aHeadersDataLen, PRBool aIsFile = PR_FALSE);
|
||||
NS_IMETHOD ShowStatus(const PRUnichar *aStatusMsg);
|
||||
NPError ShowNativeContextMenu(NPMenu* menu, nsPluginEvent* event);
|
||||
NPError ShowNativeContextMenu(NPMenu* menu, void* event);
|
||||
NPBool ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
|
||||
double *destX, double *destY, NPCoordinateSpace destSpace);
|
||||
|
||||
@ -464,7 +464,7 @@ nsDummyJavaPluginOwner::GetInstance(nsIPluginInstance *&aInstance)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDummyJavaPluginOwner::GetWindow(nsPluginWindow *&aWindow)
|
||||
nsDummyJavaPluginOwner::GetWindow(NPWindow *&aWindow)
|
||||
{
|
||||
aWindow = nsnull;
|
||||
|
||||
@ -472,10 +472,10 @@ nsDummyJavaPluginOwner::GetWindow(nsPluginWindow *&aWindow)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDummyJavaPluginOwner::GetMode(nsPluginMode *aMode)
|
||||
nsDummyJavaPluginOwner::GetMode(PRInt32 *aMode)
|
||||
{
|
||||
// This is wrong, but there's no better alternative.
|
||||
*aMode = nsPluginMode_Embedded;
|
||||
*aMode = NP_EMBED;
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
@ -508,7 +508,7 @@ nsDummyJavaPluginOwner::ShowStatus(const PRUnichar *aStatusMsg)
|
||||
}
|
||||
|
||||
NPError
|
||||
nsDummyJavaPluginOwner::ShowNativeContextMenu(NPMenu* menu, nsPluginEvent* event)
|
||||
nsDummyJavaPluginOwner::ShowNativeContextMenu(NPMenu* menu, void* event)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
@ -529,13 +529,13 @@ nsDummyJavaPluginOwner::GetDocument(nsIDocument **aDocument)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDummyJavaPluginOwner::InvalidateRect(nsPluginRect *invalidRect)
|
||||
nsDummyJavaPluginOwner::InvalidateRect(NPRect *invalidRect)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDummyJavaPluginOwner::InvalidateRegion(nsPluginRegion invalidRegion)
|
||||
nsDummyJavaPluginOwner::InvalidateRegion(NPRegion invalidRegion)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -254,9 +254,9 @@ public:
|
||||
|
||||
NS_IMETHOD GetInstance(nsIPluginInstance *&aInstance);
|
||||
|
||||
NS_IMETHOD GetWindow(nsPluginWindow *&aWindow);
|
||||
NS_IMETHOD GetWindow(NPWindow *&aWindow);
|
||||
|
||||
NS_IMETHOD GetMode(nsPluginMode *aMode);
|
||||
NS_IMETHOD GetMode(PRInt32 *aMode);
|
||||
|
||||
NS_IMETHOD CreateWidget(void);
|
||||
|
||||
@ -270,15 +270,15 @@ public:
|
||||
|
||||
NS_IMETHOD GetDocument(nsIDocument* *aDocument);
|
||||
|
||||
NS_IMETHOD InvalidateRect(nsPluginRect *invalidRect);
|
||||
NS_IMETHOD InvalidateRect(NPRect *invalidRect);
|
||||
|
||||
NS_IMETHOD InvalidateRegion(nsPluginRegion invalidRegion);
|
||||
NS_IMETHOD InvalidateRegion(NPRegion invalidRegion);
|
||||
|
||||
NS_IMETHOD ForceRedraw();
|
||||
|
||||
NS_IMETHOD GetNetscapeWindow(void *value);
|
||||
|
||||
NPError ShowNativeContextMenu(NPMenu* menu, nsPluginEvent* event);
|
||||
NPError ShowNativeContextMenu(NPMenu* menu, void* event);
|
||||
|
||||
NPBool ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
|
||||
double *destX, double *destY, NPCoordinateSpace destSpace);
|
||||
@ -371,8 +371,8 @@ public:
|
||||
nsresult Init(nsPresContext* aPresContext, nsObjectFrame* aFrame,
|
||||
nsIContent* aContent);
|
||||
|
||||
nsPluginPort* GetPluginPort();
|
||||
void ReleasePluginPort(nsPluginPort * pluginPort);
|
||||
void* GetPluginPort();
|
||||
void ReleasePluginPort(void* pluginPort);
|
||||
|
||||
void SetPluginHost(nsIPluginHost* aHost);
|
||||
|
||||
@ -387,12 +387,12 @@ public:
|
||||
void SetPluginPortChanged(PRBool aState) { mPluginPortChanged = aState; }
|
||||
// Return a pointer to the internal nsPluginPort structure that's used to
|
||||
// store a copy of plugin port info and to detect when it's been changed.
|
||||
nsPluginPort* GetPluginPortCopy() { return &mPluginPortCopy; }
|
||||
void* GetPluginPortCopy();
|
||||
// Set plugin port info in the plugin (in the 'window' member of the
|
||||
// nsPluginWindow structure passed to the plugin by SetWindow()) and set a
|
||||
// NPWindow structure passed to the plugin by SetWindow()) and set a
|
||||
// flag (mPluginPortChanged) to indicate whether or not this info has
|
||||
// changed, and SetWindow() needs to be called again.
|
||||
nsPluginPort* SetPluginPortAndDetectChange();
|
||||
void* SetPluginPortAndDetectChange();
|
||||
// Flag when we've set up a Thebes (and CoreGraphics) context in
|
||||
// nsObjectFrame::PaintPlugin(). We need to know this in
|
||||
// FixUpPluginWindow() (i.e. we need to know when FixUpPluginWindow() has
|
||||
@ -459,7 +459,8 @@ private:
|
||||
nsCOMPtr<nsIPluginHost> mPluginHost;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
nsPluginPort mPluginPortCopy;
|
||||
NP_CGContext mCGPluginPortCopy;
|
||||
NP_Port mQDPluginPortCopy;
|
||||
PRInt32 mInCGPaintLevel;
|
||||
#endif
|
||||
|
||||
@ -500,7 +501,7 @@ private:
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
class Renderer : public gfxGdkNativeRenderer {
|
||||
public:
|
||||
Renderer(nsPluginWindow* aWindow, nsIPluginInstance* aInstance,
|
||||
Renderer(NPWindow* aWindow, nsIPluginInstance* aInstance,
|
||||
const nsIntSize& aPluginSize, const nsIntRect& aDirtyRect)
|
||||
: mWindow(aWindow), mInstance(aInstance),
|
||||
mPluginSize(aPluginSize), mDirtyRect(aDirtyRect)
|
||||
@ -508,7 +509,7 @@ private:
|
||||
virtual nsresult NativeDraw(GdkDrawable * drawable, short offsetX,
|
||||
short offsetY, GdkRectangle * clipRects, PRUint32 numClipRects);
|
||||
private:
|
||||
nsPluginWindow* mWindow;
|
||||
NPWindow* mWindow;
|
||||
nsIPluginInstance* mInstance;
|
||||
const nsIntSize& mPluginSize;
|
||||
const nsIntRect& mDirtyRect;
|
||||
@ -516,7 +517,7 @@ private:
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
class Renderer : public gfxQtNativeRenderer {
|
||||
public:
|
||||
Renderer(nsPluginWindow* aWindow, nsIPluginInstance* aInstance,
|
||||
Renderer(NPWindow* aWindow, nsIPluginInstance* aInstance,
|
||||
const nsIntSize& aPluginSize, const nsIntRect& aDirtyRect)
|
||||
: mWindow(aWindow), mInstance(aInstance),
|
||||
mPluginSize(aPluginSize), mDirtyRect(aDirtyRect)
|
||||
@ -524,7 +525,7 @@ private:
|
||||
virtual nsresult NativeDraw(QWidget * drawable, short offsetX,
|
||||
short offsetY, QRect * clipRects, PRUint32 numClipRects);
|
||||
private:
|
||||
nsPluginWindow* mWindow;
|
||||
NPWindow* mWindow;
|
||||
nsIPluginInstance* mInstance;
|
||||
const nsIntSize& mPluginSize;
|
||||
const nsIntRect& mDirtyRect;
|
||||
@ -927,7 +928,7 @@ nsObjectFrame::FixupWindow(const nsSize& aSize)
|
||||
if (!mInstanceOwner)
|
||||
return;
|
||||
|
||||
nsPluginWindow *window;
|
||||
NPWindow *window;
|
||||
mInstanceOwner->GetWindow(window);
|
||||
|
||||
NS_ENSURE_TRUE(window, /**/);
|
||||
@ -936,7 +937,7 @@ nsObjectFrame::FixupWindow(const nsSize& aSize)
|
||||
mInstanceOwner->FixUpPluginWindow(ePluginPaintDisable);
|
||||
#endif
|
||||
|
||||
PRBool windowless = (window->type == nsPluginWindowType_Drawable);
|
||||
PRBool windowless = (window->type == NPWindowTypeDrawable);
|
||||
|
||||
nsIntPoint origin = GetWindowOriginInPixels(windowless);
|
||||
|
||||
@ -963,7 +964,7 @@ nsObjectFrame::FixupWindow(const nsSize& aSize)
|
||||
void
|
||||
nsObjectFrame::CallSetWindow()
|
||||
{
|
||||
nsPluginWindow *win = nsnull;
|
||||
NPWindow *win = nsnull;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPluginInstance> pi;
|
||||
@ -983,7 +984,7 @@ nsObjectFrame::CallSetWindow()
|
||||
if (IsHidden())
|
||||
return;
|
||||
|
||||
PRBool windowless = (window->type == nsPluginWindowType_Drawable);
|
||||
PRBool windowless = (window->type == NPWindowTypeDrawable);
|
||||
|
||||
nsIntPoint origin = GetWindowOriginInPixels(windowless);
|
||||
|
||||
@ -997,7 +998,7 @@ nsObjectFrame::CallSetWindow()
|
||||
// if needed, see bug 132759.
|
||||
window->CallSetWindow(pi);
|
||||
|
||||
mInstanceOwner->ReleasePluginPort((nsPluginPort *)window->window);
|
||||
mInstanceOwner->ReleasePluginPort(window->window);
|
||||
}
|
||||
|
||||
PRBool
|
||||
@ -1191,10 +1192,10 @@ nsObjectFrame::IsOpaque() const
|
||||
return PR_FALSE;
|
||||
#else
|
||||
if (mInstanceOwner) {
|
||||
nsPluginWindow * window;
|
||||
NPWindow *window;
|
||||
mInstanceOwner->GetWindow(window);
|
||||
if (window->type == nsPluginWindowType_Drawable) {
|
||||
// XXX we possibly should call nsPluginInstanceVariable_TransparentBool
|
||||
if (window->type == NPWindowTypeDrawable) {
|
||||
// XXX we possibly should check NPPVpluginTransparentBool
|
||||
// here to optimize for windowless but opaque plugins
|
||||
return PR_FALSE;
|
||||
}
|
||||
@ -1277,17 +1278,17 @@ nsObjectFrame::PrintPlugin(nsIRenderingContext& aRenderingContext,
|
||||
return;
|
||||
|
||||
// now we need to setup the correct location for printing
|
||||
nsPluginWindow window;
|
||||
window.window = nsnull;
|
||||
NPWindow window;
|
||||
window.window = nsnull;
|
||||
|
||||
// prepare embedded mode printing struct
|
||||
nsPluginPrint npprint;
|
||||
npprint.mode = nsPluginMode_Embedded;
|
||||
NPPrint npprint;
|
||||
npprint.mode = NP_EMBED;
|
||||
|
||||
// we need to find out if we are windowless or not
|
||||
PRBool windowless = PR_FALSE;
|
||||
pi->GetValue(nsPluginInstanceVariable_WindowlessBool, (void *)&windowless);
|
||||
window.type = windowless ? nsPluginWindowType_Drawable : nsPluginWindowType_Window;
|
||||
pi->IsWindowless(&windowless);
|
||||
window.type = windowless ? NPWindowTypeDrawable : NPWindowTypeWindow;
|
||||
|
||||
window.clipRect.bottom = 0; window.clipRect.top = 0;
|
||||
window.clipRect.left = 0; window.clipRect.right = 0;
|
||||
@ -1320,7 +1321,7 @@ nsObjectFrame::PrintPlugin(nsIRenderingContext& aRenderingContext,
|
||||
|
||||
window.clipRect.right = window.width;
|
||||
window.clipRect.bottom = window.height;
|
||||
window.type = nsPluginWindowType_Drawable;
|
||||
window.type = NPWindowTypeDrawable;
|
||||
|
||||
Rect gwBounds;
|
||||
::SetRect(&gwBounds, 0, 0, window.width, window.height);
|
||||
@ -1350,7 +1351,7 @@ nsObjectFrame::PrintPlugin(nsIRenderingContext& aRenderingContext,
|
||||
|
||||
window.clipRect.right = window.width;
|
||||
window.clipRect.bottom = window.height;
|
||||
window.type = nsPluginWindowType_Drawable;
|
||||
window.type = NPWindowTypeDrawable;
|
||||
// Setting nsPluginPrint/NPPrint.print.embedPrint.window.window to
|
||||
// &GWorldPtr and nsPluginPrint/NPPrint.print.embedPrint.platformPrint to
|
||||
// GWorldPtr isn't any kind of standard (it's not documented anywhere).
|
||||
@ -1359,7 +1360,7 @@ nsObjectFrame::PrintPlugin(nsIRenderingContext& aRenderingContext,
|
||||
// we do the same. The Flash plugin uses the CoreGraphics drawing mode.
|
||||
// But a GWorldPtr should be usable in either CoreGraphics or QuickDraw
|
||||
// drawing mode. See bug 191046.
|
||||
window.window = reinterpret_cast<nsPluginPort *>(&gWorld);
|
||||
window.window = &gWorld;
|
||||
npprint.print.embedPrint.platformPrint = gWorld;
|
||||
npprint.print.embedPrint.window = window;
|
||||
nsresult rv = pi->Print(&npprint);
|
||||
@ -1570,15 +1571,16 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
|
||||
nativeDrawing.EndNativeDrawing();
|
||||
return;
|
||||
}
|
||||
nsPluginWindow* window;
|
||||
NPWindow* window;
|
||||
mInstanceOwner->GetWindow(window);
|
||||
if (!window) {
|
||||
NS_WARNING("null plugin window during PaintPlugin");
|
||||
nativeDrawing.EndNativeDrawing();
|
||||
return;
|
||||
}
|
||||
nsPluginPort* pluginPortCopy = mInstanceOwner->GetPluginPortCopy();
|
||||
if (!pluginPortCopy) {
|
||||
NP_CGContext* cgPluginPortCopy =
|
||||
static_cast<NP_CGContext*>(mInstanceOwner->GetPluginPortCopy());
|
||||
if (!cgPluginPortCopy) {
|
||||
NS_WARNING("null plugin port copy during PaintPlugin");
|
||||
nativeDrawing.EndNativeDrawing();
|
||||
return;
|
||||
@ -1595,9 +1597,10 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
|
||||
// (If SetPluginPortAndDetectChange() made any changes itself, this has
|
||||
// already been detected in that method, and will likewise result in a
|
||||
// call to SetWindow() from FixUpPluginWindow().)
|
||||
if (window->window->cgPort.context != cgContext) {
|
||||
window->window->cgPort.context = cgContext;
|
||||
pluginPortCopy->cgPort.context = cgContext;
|
||||
NP_CGContext* windowContext = static_cast<NP_CGContext*>(window->window);
|
||||
if (windowContext->context != cgContext) {
|
||||
windowContext->context = cgContext;
|
||||
cgPluginPortCopy->context = cgContext;
|
||||
mInstanceOwner->SetPluginPortChanged(PR_TRUE);
|
||||
}
|
||||
|
||||
@ -1618,12 +1621,12 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
|
||||
}
|
||||
#elif defined(MOZ_X11) || defined(MOZ_DFB)
|
||||
if (mInstanceOwner) {
|
||||
nsPluginWindow * window;
|
||||
NPWindow *window;
|
||||
mInstanceOwner->GetWindow(window);
|
||||
#ifdef MOZ_COMPOSITED_PLUGINS
|
||||
{
|
||||
#else
|
||||
if (window->type == nsPluginWindowType_Drawable) {
|
||||
if (window->type == NPWindowTypeDrawable) {
|
||||
#endif
|
||||
gfxRect frameGfxRect =
|
||||
PresContext()->AppUnitsToGfxUnits(nsRect(aFramePt, GetSize()));
|
||||
@ -1652,10 +1655,10 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
|
||||
dirtyGfxRect.RoundOut();
|
||||
|
||||
// Look if it's windowless
|
||||
nsPluginWindow * window;
|
||||
NPWindow *window;
|
||||
mInstanceOwner->GetWindow(window);
|
||||
|
||||
if (window->type == nsPluginWindowType_Drawable) {
|
||||
if (window->type == NPWindowTypeDrawable) {
|
||||
// check if we need to call SetWindow with updated parameters
|
||||
PRBool doupdatewindow = PR_FALSE;
|
||||
// the offset of the DC
|
||||
@ -1676,7 +1679,7 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
|
||||
// a dead DC and hdc has been reallocated at the same address?
|
||||
if (reinterpret_cast<HDC>(window->window) != hdc ||
|
||||
window->x != dest.left || window->y != dest.top) {
|
||||
window->window = reinterpret_cast<nsPluginPort*>(hdc);
|
||||
window->window = hdc;
|
||||
window->x = dest.left;
|
||||
window->y = dest.top;
|
||||
|
||||
@ -1710,7 +1713,7 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
|
||||
winpos.cy = mWindowlessRect.height;
|
||||
|
||||
// finally, update the plugin by sending it a WM_WINDOWPOSCHANGED event
|
||||
nsPluginEvent pluginEvent;
|
||||
NPEvent pluginEvent;
|
||||
pluginEvent.event = WM_WINDOWPOSCHANGED;
|
||||
pluginEvent.wParam = 0;
|
||||
pluginEvent.lParam = (uint32)&winpos;
|
||||
@ -1766,10 +1769,10 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
|
||||
GetPluginInstance(*getter_AddRefs(inst));
|
||||
if (inst) {
|
||||
// Look if it's windowless
|
||||
nsPluginWindow * window;
|
||||
NPWindow *window;
|
||||
mInstanceOwner->GetWindow(window);
|
||||
|
||||
if (window->type == nsPluginWindowType_Drawable) {
|
||||
if (window->type == NPWindowTypeDrawable) {
|
||||
// FIXME - Bug 385435: Doesn't aDirtyRect need translating too?
|
||||
nsIRenderingContext::AutoPushTranslation
|
||||
translate(&aRenderingContext, aFramePt.x, aFramePt.y);
|
||||
@ -2121,52 +2124,20 @@ DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop)
|
||||
nsCOMPtr<nsIPluginInstance> inst;
|
||||
aInstanceOwner->GetInstance(*getter_AddRefs(inst));
|
||||
if (inst) {
|
||||
nsPluginWindow *win;
|
||||
NPWindow *win;
|
||||
aInstanceOwner->GetWindow(win);
|
||||
nsPluginNativeWindow *window = (nsPluginNativeWindow *)win;
|
||||
nsCOMPtr<nsIPluginInstance> nullinst;
|
||||
|
||||
PRBool doCache = PR_TRUE;
|
||||
PRBool doCallSetWindowAfterDestroy = PR_FALSE;
|
||||
|
||||
// first, determine if the plugin wants to be cached
|
||||
inst->GetValue(nsPluginInstanceVariable_DoCacheBool, (void *)&doCache);
|
||||
if (!doCache) {
|
||||
// then determine if the plugin wants Destroy to be called after
|
||||
// Set Window. This is for bug 50547.
|
||||
inst->GetValue(nsPluginInstanceVariable_CallSetWindowAfterDestroyBool,
|
||||
(void *)&doCallSetWindowAfterDestroy);
|
||||
if (doCallSetWindowAfterDestroy) {
|
||||
inst->Stop();
|
||||
|
||||
if (window)
|
||||
window->CallSetWindow(nullinst);
|
||||
else
|
||||
inst->SetWindow(nsnull);
|
||||
}
|
||||
else {
|
||||
if (window)
|
||||
window->CallSetWindow(nullinst);
|
||||
else
|
||||
inst->SetWindow(nsnull);
|
||||
|
||||
if (DoDelayedStop(aInstanceOwner, aDelayedStop))
|
||||
return;
|
||||
|
||||
inst->Stop();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (window)
|
||||
window->CallSetWindow(nullinst);
|
||||
else
|
||||
inst->SetWindow(nsnull);
|
||||
|
||||
if (DoDelayedStop(aInstanceOwner, aDelayedStop))
|
||||
return;
|
||||
|
||||
inst->Stop();
|
||||
}
|
||||
if (window)
|
||||
window->CallSetWindow(nullinst);
|
||||
else
|
||||
inst->SetWindow(nsnull);
|
||||
|
||||
if (DoDelayedStop(aInstanceOwner, aDelayedStop))
|
||||
return;
|
||||
|
||||
inst->Stop();
|
||||
|
||||
nsCOMPtr<nsIPluginHost> pluginHost = do_GetService(MOZ_PLUGIN_HOST_CONTRACTID);
|
||||
if (pluginHost)
|
||||
@ -2408,7 +2379,7 @@ nsresult nsPluginDOMContextMenuListener::Destroy(nsIContent* aContent)
|
||||
|
||||
nsPluginInstanceOwner::nsPluginInstanceOwner()
|
||||
{
|
||||
// create nsPluginNativeWindow object, it is derived from nsPluginWindow
|
||||
// create nsPluginNativeWindow object, it is derived from NPWindow
|
||||
// struct and allows to manipulate native window procedure
|
||||
nsCOMPtr<nsIPluginHost> ph = do_GetService(MOZ_PLUGIN_HOST_CONTRACTID);
|
||||
if (ph)
|
||||
@ -2419,7 +2390,8 @@ nsPluginInstanceOwner::nsPluginInstanceOwner()
|
||||
mOwner = nsnull;
|
||||
mTagText = nsnull;
|
||||
#ifdef XP_MACOSX
|
||||
memset(&mPluginPortCopy, 0, sizeof(nsPluginPort));
|
||||
memset(&mCGPluginPortCopy, 0, sizeof(NP_CGContext));
|
||||
memset(&mQDPluginPortCopy, 0, sizeof(NP_Port));
|
||||
mInCGPaintLevel = 0;
|
||||
#endif
|
||||
mContentFocused = PR_FALSE;
|
||||
@ -2521,23 +2493,23 @@ nsPluginInstanceOwner::SetInstance(nsIPluginInstance *aInstance)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::GetWindow(nsPluginWindow *&aWindow)
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::GetWindow(NPWindow *&aWindow)
|
||||
{
|
||||
NS_ASSERTION(mPluginWindow, "the plugin window object being returned is null");
|
||||
aWindow = mPluginWindow;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::GetMode(nsPluginMode *aMode)
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::GetMode(PRInt32 *aMode)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsresult rv = GetDocument(getter_AddRefs(doc));
|
||||
nsCOMPtr<nsIPluginDocument> pDoc (do_QueryInterface(doc));
|
||||
|
||||
if (pDoc) {
|
||||
*aMode = nsPluginMode_Full;
|
||||
*aMode = NP_FULL;
|
||||
} else {
|
||||
*aMode = nsPluginMode_Embedded;
|
||||
*aMode = NP_EMBED;
|
||||
}
|
||||
|
||||
return rv;
|
||||
@ -2703,7 +2675,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetDocument(nsIDocument* *aDocument)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(nsPluginRect *invalidRect)
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(NPRect *invalidRect)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
@ -2719,7 +2691,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(nsPluginRect *invalidRect)
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRegion(nsPluginRegion invalidRegion)
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRegion(NPRegion invalidRegion)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
@ -2766,7 +2738,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
|
||||
// we only attempt to get the nearest window if this really is a "windowless" plugin so as not
|
||||
// to change any behaviour for the much more common windowed plugins,
|
||||
// though why this method would even be being called for a windowed plugin escapes me.
|
||||
if (mPluginWindow && mPluginWindow->type == nsPluginWindowType_Drawable) {
|
||||
if (mPluginWindow && mPluginWindow->type == NPWindowTypeDrawable) {
|
||||
// it turns out that flash also uses this window for determining focus, and is currently
|
||||
// unable to show a caret correctly if we return the enclosing window. Therefore for
|
||||
// now we only return the enclosing window when there is an actual offset which
|
||||
@ -2820,7 +2792,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
|
||||
#endif
|
||||
}
|
||||
|
||||
NPError nsPluginInstanceOwner::ShowNativeContextMenu(NPMenu* menu, nsPluginEvent* event)
|
||||
NPError nsPluginInstanceOwner::ShowNativeContextMenu(NPMenu* menu, void* event)
|
||||
{
|
||||
if (!menu || !event)
|
||||
return NPERR_GENERIC_ERROR;
|
||||
@ -2830,7 +2802,7 @@ NPError nsPluginInstanceOwner::ShowNativeContextMenu(NPMenu* menu, nsPluginEvent
|
||||
return NPERR_INCOMPATIBLE_VERSION_ERROR;
|
||||
|
||||
return NS_NPAPI_ShowCocoaContextMenu(static_cast<void*>(menu), mWidget,
|
||||
static_cast<NPCocoaEvent*>(event->event));
|
||||
static_cast<NPCocoaEvent*>(event));
|
||||
#else
|
||||
return NPERR_INCOMPATIBLE_VERSION_ERROR;
|
||||
#endif
|
||||
@ -3400,9 +3372,7 @@ NPDrawingModel nsPluginInstanceOwner::GetDrawingModel()
|
||||
if (!mInstance)
|
||||
return drawingModel;
|
||||
|
||||
mInstance->GetValue(nsPluginInstanceVariable_DrawingModel,
|
||||
(void *)&drawingModel);
|
||||
|
||||
mInstance->GetDrawingModel((PRInt32*)&drawingModel);
|
||||
return drawingModel;
|
||||
}
|
||||
|
||||
@ -3417,14 +3387,23 @@ NPEventModel nsPluginInstanceOwner::GetEventModel()
|
||||
if (!mInstance)
|
||||
return eventModel;
|
||||
|
||||
mInstance->GetValue(nsPluginInstanceVariable_EventModel,
|
||||
(void *)&eventModel);
|
||||
|
||||
mInstance->GetEventModel((PRInt32*)&eventModel);
|
||||
return eventModel;
|
||||
}
|
||||
|
||||
void* nsPluginInstanceOwner::GetPluginPortCopy()
|
||||
{
|
||||
#ifndef NP_NO_QUICKDRAW
|
||||
if (GetDrawingModel() == NPDrawingModelQuickDraw)
|
||||
return &mQDPluginPortCopy;
|
||||
#endif
|
||||
if (GetDrawingModel() == NPDrawingModelCoreGraphics)
|
||||
return &mCGPluginPortCopy;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// Currently (on OS X in Cocoa widgets) any changes made as a result of
|
||||
// calling GetPluginPort() are immediately reflected in the nsPluginWindow
|
||||
// calling GetPluginPort() are immediately reflected in the NPWindow
|
||||
// structure that has been passed to the plugin via SetWindow(). This is
|
||||
// because calls to nsChildView::GetNativeData(NS_NATIVE_PLUGIN_PORT_CG)
|
||||
// always return a pointer to the same internal (private) object, but may
|
||||
@ -3435,30 +3414,31 @@ NPEventModel nsPluginInstanceOwner::GetEventModel()
|
||||
// of when calls to GetPluginPort() result in changes, and sets a flag to make
|
||||
// sure SetWindow() gets called the next time through FixUpPluginWindow(), so
|
||||
// that the plugin is notified of these changes.
|
||||
nsPluginPort* nsPluginInstanceOwner::SetPluginPortAndDetectChange()
|
||||
void* nsPluginInstanceOwner::SetPluginPortAndDetectChange()
|
||||
{
|
||||
if (!mPluginWindow)
|
||||
return nsnull;
|
||||
nsPluginPort* pluginPort = GetPluginPort();
|
||||
void* pluginPort = GetPluginPort();
|
||||
if (!pluginPort)
|
||||
return nsnull;
|
||||
mPluginWindow->window = pluginPort;
|
||||
|
||||
NPDrawingModel drawingModel = GetDrawingModel();
|
||||
|
||||
#ifndef NP_NO_QUICKDRAW
|
||||
if (drawingModel == NPDrawingModelQuickDraw) {
|
||||
if (mPluginWindow->window->qdPort.port != mPluginPortCopy.qdPort.port) {
|
||||
mPluginPortCopy.qdPort.port = mPluginWindow->window->qdPort.port;
|
||||
NP_Port* windowQDPort = static_cast<NP_Port*>(mPluginWindow->window);
|
||||
if (windowQDPort->port != mQDPluginPortCopy.port) {
|
||||
mQDPluginPortCopy.port = windowQDPort->port;
|
||||
mPluginPortChanged = PR_TRUE;
|
||||
}
|
||||
} else if (drawingModel == NPDrawingModelCoreGraphics)
|
||||
#endif
|
||||
{
|
||||
if ((mPluginWindow->window->cgPort.context != mPluginPortCopy.cgPort.context) ||
|
||||
(mPluginWindow->window->cgPort.window != mPluginPortCopy.cgPort.window)) {
|
||||
mPluginPortCopy.cgPort.context = mPluginWindow->window->cgPort.context;
|
||||
mPluginPortCopy.cgPort.window = mPluginWindow->window->cgPort.window;
|
||||
NP_CGContext* windowCGPort = static_cast<NP_CGContext*>(mPluginWindow->window);
|
||||
if ((windowCGPort->context != mCGPluginPortCopy.context) ||
|
||||
(windowCGPort->window != mCGPluginPortCopy.window)) {
|
||||
mCGPluginPortCopy.context = windowCGPort->context;
|
||||
mCGPluginPortCopy.window = windowCGPort->window;
|
||||
mPluginPortChanged = PR_TRUE;
|
||||
}
|
||||
}
|
||||
@ -3522,9 +3502,8 @@ nsresult nsPluginInstanceOwner::ScrollPositionWillChange(nsIScrollableView* aScr
|
||||
|
||||
void* window = FixUpPluginWindow(ePluginPaintDisable);
|
||||
if (window) {
|
||||
nsPluginEvent pluginEvent = { &scrollEvent, nsPluginPlatformWindowRef(window) };
|
||||
PRBool eventHandled = PR_FALSE;
|
||||
mInstance->HandleEvent(&pluginEvent, &eventHandled);
|
||||
mInstance->HandleEvent(&scrollEvent, &eventHandled);
|
||||
}
|
||||
pluginWidget->EndDrawPlugin();
|
||||
}
|
||||
@ -3548,9 +3527,8 @@ nsresult nsPluginInstanceOwner::ScrollPositionDidChange(nsIScrollableView* aScro
|
||||
|
||||
void* window = FixUpPluginWindow(ePluginPaintEnable);
|
||||
if (window) {
|
||||
nsPluginEvent pluginEvent = { &scrollEvent, nsPluginPlatformWindowRef(window) };
|
||||
PRBool eventHandled = PR_FALSE;
|
||||
mInstance->HandleEvent(&pluginEvent, &eventHandled);
|
||||
mInstance->HandleEvent(&scrollEvent, &eventHandled);
|
||||
}
|
||||
pluginWidget->EndDrawPlugin();
|
||||
}
|
||||
@ -3577,7 +3555,7 @@ nsresult nsPluginInstanceOwner::Blur(nsIDOMEvent * aFocusEvent)
|
||||
nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent)
|
||||
{
|
||||
#ifndef XP_MACOSX
|
||||
if (!mPluginWindow || nsPluginWindowType_Window == mPluginWindow->type) {
|
||||
if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow)) {
|
||||
// continue only for cases without child window
|
||||
return aFocusEvent->PreventDefault(); // consume event
|
||||
}
|
||||
@ -3668,7 +3646,7 @@ nsresult nsPluginInstanceOwner::KeyPress(nsIDOMEvent* aKeyEvent)
|
||||
nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
#if !defined(XP_MACOSX) && !defined(MOZ_COMPOSITED_PLUGINS)
|
||||
if (!mPluginWindow || nsPluginWindowType_Window == mPluginWindow->type)
|
||||
if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow))
|
||||
return aKeyEvent->PreventDefault(); // consume event
|
||||
// continue only for cases without child window
|
||||
#endif
|
||||
@ -3698,7 +3676,7 @@ nsresult
|
||||
nsPluginInstanceOwner::MouseMove(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
#if !defined(XP_MACOSX)
|
||||
if (!mPluginWindow || nsPluginWindowType_Window == mPluginWindow->type)
|
||||
if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow))
|
||||
return aMouseEvent->PreventDefault(); // consume event
|
||||
// continue only for cases without child window
|
||||
#endif
|
||||
@ -3729,7 +3707,7 @@ nsresult
|
||||
nsPluginInstanceOwner::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
#if !defined(XP_MACOSX) && !defined(MOZ_COMPOSITED_PLUGINS)
|
||||
if (!mPluginWindow || nsPluginWindowType_Window == mPluginWindow->type)
|
||||
if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow))
|
||||
return aMouseEvent->PreventDefault(); // consume event
|
||||
// continue only for cases without child window
|
||||
#endif
|
||||
@ -3737,7 +3715,7 @@ nsPluginInstanceOwner::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
// if the plugin is windowless, we need to set focus ourselves
|
||||
// otherwise, we might not get key events
|
||||
if (mOwner && mPluginWindow &&
|
||||
mPluginWindow->type == nsPluginWindowType_Drawable) {
|
||||
mPluginWindow->type == NPWindowTypeDrawable) {
|
||||
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm) {
|
||||
@ -3795,7 +3773,7 @@ nsPluginInstanceOwner::MouseOut(nsIDOMEvent* aMouseEvent)
|
||||
nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
#if !defined(XP_MACOSX) && !defined(MOZ_COMPOSITED_PLUGINS)
|
||||
if (!mPluginWindow || nsPluginWindowType_Window == mPluginWindow->type)
|
||||
if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow))
|
||||
return aMouseEvent->PreventDefault(); // consume event
|
||||
// continue only for cases without child window
|
||||
#endif
|
||||
@ -3909,8 +3887,8 @@ nsEventStatus nsPluginInstanceOwner::ProcessEventX11Composited(const nsGUIEvent&
|
||||
|
||||
// this code supports windowless plugins
|
||||
nsIWidget* widget = anEvent.widget;
|
||||
nsPluginEvent pluginEvent;
|
||||
pluginEvent.event.type = 0;
|
||||
XEvent pluginEvent;
|
||||
pluginEvent.type = 0;
|
||||
|
||||
switch(anEvent.eventStructType)
|
||||
{
|
||||
@ -3948,7 +3926,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEventX11Composited(const nsGUIEvent&
|
||||
case NS_MOUSE_ENTER_SYNTH:
|
||||
case NS_MOUSE_EXIT_SYNTH:
|
||||
{
|
||||
XCrossingEvent& event = pluginEvent.event.xcrossing;
|
||||
XCrossingEvent& event = pluginEvent.xcrossing;
|
||||
event.type = anEvent.message == NS_MOUSE_ENTER_SYNTH ?
|
||||
EnterNotify : LeaveNotify;
|
||||
event.root = root;
|
||||
@ -3968,7 +3946,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEventX11Composited(const nsGUIEvent&
|
||||
break;
|
||||
case NS_MOUSE_MOVE:
|
||||
{
|
||||
XMotionEvent& event = pluginEvent.event.xmotion;
|
||||
XMotionEvent& event = pluginEvent.xmotion;
|
||||
event.type = MotionNotify;
|
||||
event.root = root;
|
||||
event.time = anEvent.time;
|
||||
@ -3982,7 +3960,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEventX11Composited(const nsGUIEvent&
|
||||
event.is_hint = NotifyNormal;
|
||||
event.same_screen = True;
|
||||
XEvent be;
|
||||
be.xmotion = pluginEvent.event.xmotion;
|
||||
be.xmotion = pluginEvent.xmotion;
|
||||
//printf("xmotion: %d %d\n", be.xmotion.x, be.xmotion.y);
|
||||
XID w = (XID)mPluginWindow->window;
|
||||
be.xmotion.window = w;
|
||||
@ -3994,7 +3972,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEventX11Composited(const nsGUIEvent&
|
||||
case NS_MOUSE_BUTTON_DOWN:
|
||||
case NS_MOUSE_BUTTON_UP:
|
||||
{
|
||||
XButtonEvent& event = pluginEvent.event.xbutton;
|
||||
XButtonEvent& event = pluginEvent.xbutton;
|
||||
event.type = anEvent.message == NS_MOUSE_BUTTON_DOWN ?
|
||||
ButtonPress : ButtonRelease;
|
||||
event.root = root;
|
||||
@ -4045,7 +4023,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEventX11Composited(const nsGUIEvent&
|
||||
case NS_KEY_EVENT:
|
||||
if (anEvent.nativeMsg)
|
||||
{
|
||||
XKeyEvent &event = pluginEvent.event.xkey;
|
||||
XKeyEvent &event = pluginEvent.xkey;
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
event.root = GDK_ROOT_WINDOW();
|
||||
event.time = anEvent.time;
|
||||
@ -4104,7 +4082,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEventX11Composited(const nsGUIEvent&
|
||||
case NS_FOCUS_CONTENT:
|
||||
case NS_BLUR_CONTENT:
|
||||
{
|
||||
XFocusChangeEvent &event = pluginEvent.event.xfocus;
|
||||
XFocusChangeEvent &event = pluginEvent.xfocus;
|
||||
event.type =
|
||||
anEvent.message == NS_FOCUS_CONTENT ? FocusIn : FocusOut;
|
||||
// information lost:
|
||||
@ -4115,7 +4093,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEventX11Composited(const nsGUIEvent&
|
||||
}
|
||||
}
|
||||
|
||||
if (!pluginEvent.event.type) {
|
||||
if (!pluginEvent.type) {
|
||||
PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG,
|
||||
("Unhandled event message %d with struct type %d\n",
|
||||
anEvent.message, anEvent.eventStructType));
|
||||
@ -4123,7 +4101,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEventX11Composited(const nsGUIEvent&
|
||||
}
|
||||
|
||||
// Fill in (useless) generic event information.
|
||||
XAnyEvent& event = pluginEvent.event.xany;
|
||||
XAnyEvent& event = pluginEvent.xany;
|
||||
event.display = widget ?
|
||||
static_cast<Display*>(widget->GetNativeData(NS_NATIVE_DISPLAY)) : nsnull;
|
||||
event.window = None; // not a real window
|
||||
@ -4148,7 +4126,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
// printf("nsGUIEvent.message: %d\n", anEvent.message);
|
||||
|
||||
#ifdef MOZ_COMPOSITED_PLUGINS
|
||||
if (mPluginWindow && mPluginWindow->type != nsPluginWindowType_Drawable)
|
||||
if (mPluginWindow && (mPluginWindow->type != NPWindowTypeDrawable))
|
||||
return ProcessEventX11Composited(anEvent);
|
||||
#endif
|
||||
|
||||
@ -4242,9 +4220,8 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
|
||||
PRBool eventHandled = PR_FALSE;
|
||||
void* window = FixUpPluginWindow(ePluginPaintEnable);
|
||||
if (window || (eventModel == NPEventModelCocoa)) {
|
||||
nsPluginEvent pluginEvent = { event, nsPluginPlatformWindowRef(window) };
|
||||
mInstance->HandleEvent(&pluginEvent, &eventHandled);
|
||||
if (window || (eventModel == NPEventModelCocoa)) {
|
||||
mInstance->HandleEvent(event, &eventHandled);
|
||||
}
|
||||
|
||||
if (eventHandled && !(anEvent.eventStructType == NS_MOUSE_EVENT &&
|
||||
@ -4261,10 +4238,10 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
|
||||
#ifdef XP_WIN
|
||||
// this code supports windowless plugins
|
||||
nsPluginEvent * pPluginEvent = (nsPluginEvent *)anEvent.nativeMsg;
|
||||
NPEvent *pPluginEvent = (NPEvent*)anEvent.nativeMsg;
|
||||
// we can get synthetic events from the nsEventStateManager... these
|
||||
// have no nativeMsg
|
||||
nsPluginEvent pluginEvent;
|
||||
NPEvent pluginEvent;
|
||||
if (anEvent.eventStructType == NS_MOUSE_EVENT) {
|
||||
if (!pPluginEvent) {
|
||||
// XXX Should extend this list to synthesize events for more event
|
||||
@ -4311,7 +4288,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
if (pPluginEvent) {
|
||||
// Make event coordinates relative to our enclosing widget,
|
||||
// not the widget they were received on.
|
||||
// See use of nsPluginEvent in widget/src/windows/nsWindow.cpp
|
||||
// See use of NPEvent in widget/src/windows/nsWindow.cpp
|
||||
// for why this assert should be safe
|
||||
NS_ASSERTION(anEvent.message == NS_MOUSE_BUTTON_DOWN ||
|
||||
anEvent.message == NS_MOUSE_BUTTON_UP ||
|
||||
@ -4356,8 +4333,8 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
#ifdef MOZ_X11
|
||||
// this code supports windowless plugins
|
||||
nsIWidget* widget = anEvent.widget;
|
||||
nsPluginEvent pluginEvent;
|
||||
pluginEvent.event.type = 0;
|
||||
XEvent pluginEvent;
|
||||
pluginEvent.type = 0;
|
||||
|
||||
switch(anEvent.eventStructType)
|
||||
{
|
||||
@ -4394,7 +4371,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
case NS_MOUSE_ENTER_SYNTH:
|
||||
case NS_MOUSE_EXIT_SYNTH:
|
||||
{
|
||||
XCrossingEvent& event = pluginEvent.event.xcrossing;
|
||||
XCrossingEvent& event = pluginEvent.xcrossing;
|
||||
event.type = anEvent.message == NS_MOUSE_ENTER_SYNTH ?
|
||||
EnterNotify : LeaveNotify;
|
||||
event.root = root;
|
||||
@ -4414,7 +4391,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
break;
|
||||
case NS_MOUSE_MOVE:
|
||||
{
|
||||
XMotionEvent& event = pluginEvent.event.xmotion;
|
||||
XMotionEvent& event = pluginEvent.xmotion;
|
||||
event.type = MotionNotify;
|
||||
event.root = root;
|
||||
event.time = anEvent.time;
|
||||
@ -4432,7 +4409,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
case NS_MOUSE_BUTTON_DOWN:
|
||||
case NS_MOUSE_BUTTON_UP:
|
||||
{
|
||||
XButtonEvent& event = pluginEvent.event.xbutton;
|
||||
XButtonEvent& event = pluginEvent.xbutton;
|
||||
event.type = anEvent.message == NS_MOUSE_BUTTON_DOWN ?
|
||||
ButtonPress : ButtonRelease;
|
||||
event.root = root;
|
||||
@ -4468,7 +4445,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
case NS_KEY_EVENT:
|
||||
if (anEvent.nativeMsg)
|
||||
{
|
||||
XKeyEvent &event = pluginEvent.event.xkey;
|
||||
XKeyEvent &event = pluginEvent.xkey;
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
event.root = GDK_ROOT_WINDOW();
|
||||
event.time = anEvent.time;
|
||||
@ -4511,7 +4488,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
case NS_FOCUS_CONTENT:
|
||||
case NS_BLUR_CONTENT:
|
||||
{
|
||||
XFocusChangeEvent &event = pluginEvent.event.xfocus;
|
||||
XFocusChangeEvent &event = pluginEvent.xfocus;
|
||||
event.type =
|
||||
anEvent.message == NS_FOCUS_CONTENT ? FocusIn : FocusOut;
|
||||
// information lost:
|
||||
@ -4522,7 +4499,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
}
|
||||
}
|
||||
|
||||
if (!pluginEvent.event.type) {
|
||||
if (!pluginEvent.type) {
|
||||
PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG,
|
||||
("Unhandled event message %d with struct type %d\n",
|
||||
anEvent.message, anEvent.eventStructType));
|
||||
@ -4530,7 +4507,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
||||
}
|
||||
|
||||
// Fill in (useless) generic event information.
|
||||
XAnyEvent& event = pluginEvent.event.xany;
|
||||
XAnyEvent& event = pluginEvent.xany;
|
||||
event.display = widget ?
|
||||
static_cast<Display*>(widget->GetNativeData(NS_NATIVE_DISPLAY)) : nsnull;
|
||||
event.window = None; // not a real window
|
||||
@ -4659,24 +4636,22 @@ void nsPluginInstanceOwner::Paint(const gfxRect& aDirtyRect)
|
||||
updateEvent.what = updateEvt;
|
||||
updateEvent.message = UInt32(window);
|
||||
|
||||
nsPluginEvent pluginEvent = { &updateEvent, nsPluginPlatformWindowRef(window) };
|
||||
PRBool eventHandled = PR_FALSE;
|
||||
mInstance->HandleEvent(&pluginEvent, &eventHandled);
|
||||
mInstance->HandleEvent(&updateEvent, &eventHandled);
|
||||
}
|
||||
else {
|
||||
// The context given here is only valid during the HandleEvent call.
|
||||
NPCocoaEvent updateEvent;
|
||||
InitializeNPCocoaEvent(&updateEvent);
|
||||
updateEvent.type = NPCocoaEventDrawRect;
|
||||
updateEvent.data.draw.context = mPluginPortCopy.cgPort.context;
|
||||
updateEvent.data.draw.context = mCGPluginPortCopy.context;
|
||||
updateEvent.data.draw.x = aDirtyRect.X();
|
||||
updateEvent.data.draw.y = aDirtyRect.Y();
|
||||
updateEvent.data.draw.width = aDirtyRect.Width();
|
||||
updateEvent.data.draw.height = aDirtyRect.Height();
|
||||
|
||||
nsPluginEvent pluginEvent = { &updateEvent, nsPluginPlatformWindowRef(window) };
|
||||
PRBool eventHandled = PR_FALSE;
|
||||
mInstance->HandleEvent(&pluginEvent, &eventHandled);
|
||||
mInstance->HandleEvent(&updateEvent, &eventHandled);
|
||||
}
|
||||
pluginWidget->EndDrawPlugin();
|
||||
}
|
||||
@ -4689,7 +4664,7 @@ void nsPluginInstanceOwner::Paint(const RECT& aDirty, HDC aDC)
|
||||
if (!mInstance || !mOwner)
|
||||
return;
|
||||
|
||||
nsPluginEvent pluginEvent;
|
||||
NPEvent pluginEvent;
|
||||
pluginEvent.event = WM_PAINT;
|
||||
pluginEvent.wParam = WPARAM(aDC);
|
||||
pluginEvent.lParam = LPARAM(&aDirty);
|
||||
@ -4704,7 +4679,7 @@ void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect, HPS aHPS)
|
||||
if (!mInstance || !mOwner)
|
||||
return;
|
||||
|
||||
nsPluginWindow * window;
|
||||
NPWindow *window;
|
||||
GetWindow(window);
|
||||
nsIntRect relDirtyRect = aDirtyRect.ToOutsidePixels(mOwner->PresContext()->AppUnitsPerDevPixel());
|
||||
|
||||
@ -4716,7 +4691,7 @@ void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect, HPS aHPS)
|
||||
rectl.xRight = rectl.xLeft + relDirtyRect.width;
|
||||
rectl.yTop = rectl.yBottom + relDirtyRect.height;
|
||||
|
||||
nsPluginEvent pluginEvent;
|
||||
NPEvent pluginEvent;
|
||||
pluginEvent.event = WM_PAINT;
|
||||
pluginEvent.wParam = (uint32)aHPS;
|
||||
pluginEvent.lParam = (uint32)&rectl;
|
||||
@ -4768,7 +4743,7 @@ void nsPluginInstanceOwner::Paint(gfxContext* aContext,
|
||||
pluginDirtyRect))
|
||||
return;
|
||||
|
||||
nsPluginWindow* window;
|
||||
NPWindow* window;
|
||||
GetWindow(window);
|
||||
|
||||
Renderer renderer(window, mInstance, pluginSize, pluginDirtyRect);
|
||||
@ -4778,9 +4753,8 @@ void nsPluginInstanceOwner::Paint(gfxContext* aContext,
|
||||
Renderer::DRAW_SUPPORTS_NONDEFAULT_VISUAL |
|
||||
Renderer::DRAW_SUPPORTS_ALTERNATE_SCREEN;
|
||||
|
||||
PRBool transparent = PR_TRUE;
|
||||
mInstance->GetValue(nsPluginInstanceVariable_TransparentBool,
|
||||
(void *)&transparent);
|
||||
PRBool transparent;
|
||||
mInstance->IsTransparent(&transparent);
|
||||
if (!transparent)
|
||||
rendererFlags |= Renderer::DRAW_IS_OPAQUE;
|
||||
|
||||
@ -4868,7 +4842,7 @@ nsPluginInstanceOwner::Renderer::NativeDraw(QWidget * drawable,
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
// nsPluginRect members are unsigned, but
|
||||
// NPRect members are unsigned, but
|
||||
// we should have been given a clip if an offset is -ve.
|
||||
NS_ASSERTION(offsetX >= 0 && offsetY >= 0,
|
||||
"Clip rectangle offsets are negative!");
|
||||
@ -4878,7 +4852,7 @@ nsPluginInstanceOwner::Renderer::NativeDraw(QWidget * drawable,
|
||||
clipRect.height = mWindow->height;
|
||||
}
|
||||
|
||||
nsPluginRect newClipRect;
|
||||
NPRect newClipRect;
|
||||
newClipRect.left = clipRect.x;
|
||||
newClipRect.top = clipRect.y;
|
||||
newClipRect.right = clipRect.XMost();
|
||||
@ -4903,7 +4877,7 @@ nsPluginInstanceOwner::Renderer::NativeDraw(QWidget * drawable,
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_COMPOSITED_PLUGINS
|
||||
if (mWindow->type == nsPluginWindowType_Drawable)
|
||||
if (mWindow->type == NPWindowTypeDrawable)
|
||||
#endif
|
||||
{
|
||||
if (doupdatewindow)
|
||||
@ -4919,11 +4893,10 @@ nsPluginInstanceOwner::Renderer::NativeDraw(QWidget * drawable,
|
||||
return NS_OK;
|
||||
|
||||
#ifdef MOZ_COMPOSITED_PLUGINS
|
||||
if (mWindow->type == nsPluginWindowType_Drawable) {
|
||||
if (mWindow->type == NPWindowTypeDrawable) {
|
||||
#endif
|
||||
nsPluginEvent pluginEvent;
|
||||
XGraphicsExposeEvent& exposeEvent =
|
||||
pluginEvent.event.xgraphicsexpose;
|
||||
XEvent pluginEvent;
|
||||
XGraphicsExposeEvent& exposeEvent = pluginEvent.xgraphicsexpose;
|
||||
// set the drawing info
|
||||
exposeEvent.type = GraphicsExpose;
|
||||
exposeEvent.display = DisplayOfScreen(screen);
|
||||
@ -5003,10 +4976,8 @@ NS_IMETHODIMP nsPluginInstanceOwner::Notify(nsITimer* timer)
|
||||
if (!mWidgetVisible)
|
||||
idleEvent.where.h = idleEvent.where.v = 20000;
|
||||
|
||||
nsPluginEvent pluginEvent = { &idleEvent, nsPluginPlatformWindowRef(window) };
|
||||
|
||||
PRBool eventHandled = PR_FALSE;
|
||||
mInstance->HandleEvent(&pluginEvent, &eventHandled);
|
||||
mInstance->HandleEvent(&idleEvent, &eventHandled);
|
||||
}
|
||||
|
||||
pluginWidget->EndDrawPlugin();
|
||||
@ -5128,32 +5099,32 @@ nsresult nsPluginInstanceOwner::Init(nsPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsPluginPort* nsPluginInstanceOwner::GetPluginPort()
|
||||
void* nsPluginInstanceOwner::GetPluginPort()
|
||||
{
|
||||
//!!! Port must be released for windowless plugins on Windows, because it is HDC !!!
|
||||
|
||||
nsPluginPort* result = NULL;
|
||||
void* result = NULL;
|
||||
if (mWidget) {
|
||||
#ifdef XP_WIN
|
||||
if (mPluginWindow && mPluginWindow->type == nsPluginWindowType_Drawable)
|
||||
result = (nsPluginPort*) mWidget->GetNativeData(NS_NATIVE_GRAPHIC);
|
||||
if (mPluginWindow && (mPluginWindow->type == NPWindowTypeDrawable))
|
||||
result = mWidget->GetNativeData(NS_NATIVE_GRAPHIC);
|
||||
else
|
||||
#endif
|
||||
#ifdef XP_MACOSX
|
||||
if (GetDrawingModel() == NPDrawingModelCoreGraphics)
|
||||
result = (nsPluginPort*) mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT_CG);
|
||||
result = mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT_CG);
|
||||
else
|
||||
#endif
|
||||
result = (nsPluginPort*) mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
|
||||
result = mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void nsPluginInstanceOwner::ReleasePluginPort(nsPluginPort * pluginPort)
|
||||
void nsPluginInstanceOwner::ReleasePluginPort(void * pluginPort)
|
||||
{
|
||||
#ifdef XP_WIN
|
||||
if (mWidget && mPluginWindow &&
|
||||
mPluginWindow->type == nsPluginWindowType_Drawable) {
|
||||
mPluginWindow->type == NPWindowTypeDrawable) {
|
||||
mWidget->FreeNativeData((HDC)pluginPort, NS_NATIVE_GRAPHIC);
|
||||
}
|
||||
#endif
|
||||
@ -5173,9 +5144,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
|
||||
|
||||
if (!view || !mWidget) {
|
||||
PRBool windowless = PR_FALSE;
|
||||
|
||||
mInstance->GetValue(nsPluginInstanceVariable_WindowlessBool,
|
||||
(void *)&windowless);
|
||||
mInstance->IsWindowless(&windowless);
|
||||
|
||||
// always create widgets in Twips, not pixels
|
||||
nsPresContext* context = mOwner->PresContext();
|
||||
@ -5186,7 +5155,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
|
||||
mWidget = mOwner->GetWidget();
|
||||
|
||||
if (PR_TRUE == windowless) {
|
||||
mPluginWindow->type = nsPluginWindowType_Drawable;
|
||||
mPluginWindow->type = NPWindowTypeDrawable;
|
||||
|
||||
// this needs to be a HDC according to the spec, but I do
|
||||
// not see the right way to release it so let's postpone
|
||||
@ -5214,7 +5183,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
|
||||
|
||||
// mPluginWindow->type is used in |GetPluginPort| so it must
|
||||
// be initialized first
|
||||
mPluginWindow->type = nsPluginWindowType_Window;
|
||||
mPluginWindow->type = NPWindowTypeWindow;
|
||||
mPluginWindow->window = GetPluginPort();
|
||||
|
||||
// start the idle timer.
|
||||
@ -5259,7 +5228,7 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
|
||||
|
||||
// If we've already set up a CGContext in nsObjectFrame::PaintPlugin(), we
|
||||
// don't want calls to SetPluginPortAndDetectChange() to step on our work.
|
||||
nsPluginPort* pluginPort = nsnull;
|
||||
void* pluginPort = nsnull;
|
||||
if (mInCGPaintLevel > 0) {
|
||||
pluginPort = mPluginWindow->window;
|
||||
} else {
|
||||
@ -5280,8 +5249,8 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
|
||||
#ifndef NP_NO_QUICKDRAW
|
||||
// set the port coordinates
|
||||
if (drawingModel == NPDrawingModelQuickDraw) {
|
||||
mPluginWindow->x = -pluginPort->qdPort.portx;
|
||||
mPluginWindow->y = -pluginPort->qdPort.porty;
|
||||
mPluginWindow->x = -static_cast<NP_Port*>(pluginPort)->portx;
|
||||
mPluginWindow->y = -static_cast<NP_Port*>(pluginPort)->porty;
|
||||
}
|
||||
else if (drawingModel == NPDrawingModelCoreGraphics)
|
||||
#endif
|
||||
@ -5295,15 +5264,15 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
|
||||
|
||||
nsRect windowRect;
|
||||
if (eventModel == NPEventModelCarbon)
|
||||
NS_NPAPI_CarbonWindowFrame(static_cast<WindowRef>(pluginPort->cgPort.window), windowRect);
|
||||
NS_NPAPI_CarbonWindowFrame(static_cast<WindowRef>(static_cast<NP_CGContext*>(pluginPort)->window), windowRect);
|
||||
else
|
||||
NS_NPAPI_CocoaWindowFrame(pluginPort->cgPort.window, windowRect);
|
||||
NS_NPAPI_CocoaWindowFrame(static_cast<NP_CGContext*>(pluginPort)->window, windowRect);
|
||||
|
||||
mPluginWindow->x = geckoScreenCoords.x - windowRect.x;
|
||||
mPluginWindow->y = geckoScreenCoords.y - windowRect.y;
|
||||
}
|
||||
|
||||
nsPluginRect oldClipRect = mPluginWindow->clipRect;
|
||||
NPRect oldClipRect = mPluginWindow->clipRect;
|
||||
|
||||
// fix up the clipping region
|
||||
mPluginWindow->clipRect.top = widgetClip.y;
|
||||
@ -5345,11 +5314,11 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
|
||||
|
||||
#ifndef NP_NO_QUICKDRAW
|
||||
if (drawingModel == NPDrawingModelQuickDraw)
|
||||
return ::GetWindowFromPort(pluginPort->qdPort.port);
|
||||
return ::GetWindowFromPort(static_cast<NP_Port*>(pluginPort)->port);
|
||||
#endif
|
||||
|
||||
if (drawingModel == NPDrawingModelCoreGraphics)
|
||||
return pluginPort->cgPort.window;
|
||||
return static_cast<NP_CGContext*>(pluginPort)->window;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -46,7 +46,6 @@ MODULE = plugin
|
||||
GRE_MODULE = 1
|
||||
|
||||
EXPORTS = \
|
||||
nsplugindefs.h \
|
||||
nsPluginLogging.h \
|
||||
nsPluginError.h \
|
||||
nsDefaultPlugin.h \
|
||||
|
@ -445,7 +445,11 @@ typedef struct _NPPrint
|
||||
} print;
|
||||
} NPPrint;
|
||||
|
||||
#if defined(XP_WIN)
|
||||
#ifdef XP_MACOSX
|
||||
#ifndef NP_NO_CARBON
|
||||
typedef EventRecord NPEvent;
|
||||
#endif
|
||||
#elif defined(XP_WIN)
|
||||
typedef struct _NPEvent
|
||||
{
|
||||
uint16_t event;
|
||||
@ -463,7 +467,7 @@ typedef struct _NPEvent
|
||||
typedef XEvent NPEvent;
|
||||
#else
|
||||
typedef void* NPEvent;
|
||||
#endif /* XP_MACOSX */
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
typedef void* NPRegion;
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include "nspluginroot.idl"
|
||||
|
||||
%{C++
|
||||
#include "nsplugindefs.h"
|
||||
#include "npapi.h"
|
||||
|
||||
#define MOZ_PLUGIN_CONTRACTID \
|
||||
"@mozilla.org/plugin/plugin;1"
|
||||
@ -47,7 +47,7 @@
|
||||
|
||||
interface nsIPluginInstance;
|
||||
|
||||
[uuid(0937FB08-16E8-4365-BABF-88E09E4E33A4)]
|
||||
[uuid(15246FD3-29FB-4354-8811-AD8B53661B71)]
|
||||
interface nsIPlugin : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -101,5 +101,5 @@ interface nsIPlugin : nsISupports
|
||||
* @param aValue - the address of where to store the resulting value
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void getValue(in nsPluginVariable aVariable, in voidPtr aValue);
|
||||
void getValue(in NPPVariable aVariable, in voidPtr aValue);
|
||||
};
|
||||
|
@ -44,7 +44,6 @@
|
||||
|
||||
%{C++
|
||||
#include "nsPluginNativeWindow.h"
|
||||
#include "nsplugindefs.h"
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
#include "nsString.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
@ -48,5 +48,5 @@ interface nsIPluginInputStream : nsIInputStream {
|
||||
*/
|
||||
void getLastModified(out unsigned long aResult);
|
||||
|
||||
void requestRead(out nsByteRange aRangeList);
|
||||
void requestRead(out NPByteRange aRangeList);
|
||||
};
|
||||
|
@ -42,7 +42,7 @@ interface nsIPluginInstanceOwner;
|
||||
interface nsIOutputStream;
|
||||
|
||||
%{C++
|
||||
#include "nsplugindefs.h"
|
||||
#include "npapi.h"
|
||||
#include "nsString.h"
|
||||
struct JSContext;
|
||||
struct JSObject;
|
||||
@ -53,7 +53,7 @@ struct JSObject;
|
||||
[ptr] native JSContextPtr(JSContext);
|
||||
[ptr] native JSObjectPtr(JSObject);
|
||||
|
||||
[uuid(67D606F4-1D6D-4FE2-A2D6-10BDA65788E1)]
|
||||
[uuid(1BDF057D-1F3F-49F6-986A-8F9593706A25)]
|
||||
interface nsIPluginInstance : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -94,7 +94,7 @@ interface nsIPluginInstance : nsISupports
|
||||
* @param aWindow - the plugin window structure
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void setWindow(in nsPluginWindowPtr aWindow);
|
||||
void setWindow(in NPWindowPtr aWindow);
|
||||
|
||||
/**
|
||||
* Called to tell the plugin that the initial src/data stream is
|
||||
@ -130,16 +130,7 @@ interface nsIPluginInstance : nsISupports
|
||||
* @param aPlatformPrint - platform-specific printing information
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void print(in nsPluginPrintPtr aPlatformPrint);
|
||||
|
||||
/**
|
||||
* Returns the value of a variable associated with the plugin instance.
|
||||
*
|
||||
* @param aVariable - the plugin instance variable to get
|
||||
* @param aValue - the address of where to store the resulting value
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void getValue(in nsPluginInstanceVariable aVariable, in voidPtr aValue);
|
||||
void print(in NPPrintPtr aPlatformPrint);
|
||||
|
||||
/**
|
||||
* Handles an event.
|
||||
@ -156,17 +147,17 @@ interface nsIPluginInstance : nsISupports
|
||||
* @param aHandled - set to PR_TRUE if event was handled
|
||||
* @result - NS_OK if this operation was successful
|
||||
*/
|
||||
void handleEvent(in nsPluginEventPtr aEvent, out boolean aHandled);
|
||||
void handleEvent(in voidPtr aEvent, out boolean aHandled);
|
||||
|
||||
/**
|
||||
* Corresponds to NPN_InvalidateRect
|
||||
*/
|
||||
void invalidateRect(in nsPluginRectPtr aRect);
|
||||
void invalidateRect(in NPRectPtr aRect);
|
||||
|
||||
/**
|
||||
* Corresponds to NPN_InvalidateRegion
|
||||
*/
|
||||
void invalidateRegion(in nsPluginRegion aRegion);
|
||||
void invalidateRegion(in NPRegion aRegion);
|
||||
|
||||
/**
|
||||
* Corresponds to NPN_ForceRedraw
|
||||
@ -219,4 +210,15 @@ interface nsIPluginInstance : nsISupports
|
||||
readonly attribute PRUint16 pluginAPIVersion;
|
||||
|
||||
void defineJavaProperties();
|
||||
|
||||
PRBool shouldCache();
|
||||
|
||||
PRBool isWindowless();
|
||||
|
||||
PRBool isTransparent();
|
||||
|
||||
void getValueFromPlugin(in NPPVariable variable, in voidPtr aValue);
|
||||
|
||||
PRInt32 getDrawingModel();
|
||||
PRInt32 getEventModel();
|
||||
};
|
||||
|
@ -49,7 +49,7 @@ class nsPluginEvent;
|
||||
|
||||
[ref] native nsIPluginInstanceRef(nsIPluginInstance*);
|
||||
|
||||
[uuid(109BAD0E-7071-4907-B657-4507C834E448)]
|
||||
[uuid(0E0E465C-C081-4E43-B2DF-D4DCA6B8E8CF)]
|
||||
interface nsIPluginInstanceOwner : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -66,12 +66,12 @@ interface nsIPluginInstanceOwner : nsISupports
|
||||
* Get a handle to the window structure of the owner.
|
||||
* This pointer cannot be made persistent by the caller.
|
||||
*/
|
||||
void getWindow(in nsPluginWindowStarRef aWindow);
|
||||
void getWindow(in NPWindowStarRef aWindow);
|
||||
|
||||
/**
|
||||
* Get the display mode for the plugin instance.
|
||||
*/
|
||||
readonly attribute nsPluginMode mode;
|
||||
readonly attribute PRInt32 mode;
|
||||
|
||||
/**
|
||||
* Create a place for the plugin to live in the owner's
|
||||
@ -110,12 +110,12 @@ interface nsIPluginInstanceOwner : nsISupports
|
||||
/**
|
||||
* Invalidate the rectangle
|
||||
*/
|
||||
void invalidateRect(in nsPluginRectPtr aRect);
|
||||
void invalidateRect(in NPRectPtr aRect);
|
||||
|
||||
/**
|
||||
* Invalidate the region
|
||||
*/
|
||||
void invalidateRegion(in nsPluginRegion aRegion);
|
||||
void invalidateRegion(in NPRegion aRegion);
|
||||
|
||||
/**
|
||||
* Force a redraw
|
||||
@ -131,7 +131,7 @@ interface nsIPluginInstanceOwner : nsISupports
|
||||
* Show native context menu
|
||||
*/
|
||||
%{C++
|
||||
virtual NPError ShowNativeContextMenu(NPMenu* menu, nsPluginEvent* event) = 0;
|
||||
virtual NPError ShowNativeContextMenu(NPMenu* menu, void* event) = 0;
|
||||
virtual NPBool ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
|
||||
double *destX, double *destY, NPCoordinateSpace destSpace) = 0;
|
||||
%}
|
||||
|
@ -49,10 +49,10 @@
|
||||
#include "nspluginroot.idl"
|
||||
|
||||
%{C++
|
||||
#include "nsplugindefs.h"
|
||||
#include "npapi.h"
|
||||
%}
|
||||
|
||||
[uuid(ed7d4ca0-b005-11d2-adaa-00805f6dec49)]
|
||||
[uuid(A700845F-0E26-44EA-84F5-3BE5381F98D5)]
|
||||
interface nsIPluginStreamInfo : nsISupports
|
||||
{
|
||||
readonly attribute string contentType;
|
||||
@ -65,7 +65,7 @@ interface nsIPluginStreamInfo : nsISupports
|
||||
|
||||
void getURL(out constCharPtr aURL);
|
||||
|
||||
void requestRead(in nsByteRangePtr aRangeList);
|
||||
void requestRead(in NPByteRangePtr aRangeList);
|
||||
|
||||
attribute long streamOffset;
|
||||
};
|
||||
|
@ -51,7 +51,7 @@
|
||||
#include "nsIInputStream.idl"
|
||||
|
||||
%{C++
|
||||
#include "nsplugindefs.h"
|
||||
#include "npapi.h"
|
||||
%}
|
||||
|
||||
/**
|
||||
@ -60,7 +60,7 @@
|
||||
* to determine if a plugin manager implements more specific APIs or other
|
||||
* browser interfaces for the plugin to use (e.g. nsINetworkManager).
|
||||
*/
|
||||
[uuid(df055770-5448-11d2-8164-006008119d7a)]
|
||||
[uuid(02C9DAD7-D9DD-4F36-BD5E-93CA404A31BC)]
|
||||
interface nsIPluginStreamListener : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -115,5 +115,5 @@ interface nsIPluginStreamListener : nsISupports
|
||||
*
|
||||
* @param aStreamType - the type of the stream
|
||||
*/
|
||||
readonly attribute nsPluginStreamType streamType;
|
||||
readonly attribute PRInt32 streamType;
|
||||
};
|
||||
|
@ -39,8 +39,6 @@
|
||||
#include "nspluginroot.idl"
|
||||
|
||||
%{C++
|
||||
#include "nsplugindefs.h"
|
||||
|
||||
enum nsPluginTagType {
|
||||
nsPluginTagType_Unknown,
|
||||
nsPluginTagType_Embed,
|
||||
|
@ -44,17 +44,17 @@
|
||||
#include "nscore.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
#include "nsplugindefs.h"
|
||||
#include "npapi.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
|
||||
/**
|
||||
* base class for native plugin window implementations
|
||||
*/
|
||||
class nsPluginNativeWindow : public nsPluginWindow
|
||||
class nsPluginNativeWindow : public NPWindow
|
||||
{
|
||||
public:
|
||||
nsPluginNativeWindow() : nsPluginWindow() {
|
||||
nsPluginNativeWindow() : NPWindow() {
|
||||
MOZ_COUNT_CTOR(nsPluginNativeWindow);
|
||||
}
|
||||
|
||||
|
@ -1,398 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsplugindefs_h___
|
||||
#define nsplugindefs_h___
|
||||
|
||||
#if defined(XP_OS2) || defined(__OS2__)
|
||||
#define INCL_BASE
|
||||
#define INCL_PM
|
||||
#include <os2.h>
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
||||
#ifndef prtypes_h___
|
||||
#include "prtypes.h"
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
# include <Carbon/Carbon.h>
|
||||
#endif
|
||||
|
||||
#if defined(XP_UNIX) && defined(MOZ_X11)
|
||||
# include <X11/Xlib.h>
|
||||
# include <X11/Xutil.h>
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN)
|
||||
# include <windef.h>
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* The OS/2 version of Netscape uses RC_DATA to define the
|
||||
mime types, file extensions, etc that are required.
|
||||
Use a vertical bar to separate types, end types with \0.
|
||||
FileVersion and ProductVersion are 32bit ints, all other
|
||||
entries are strings the MUST be terminated wwith a \0.
|
||||
|
||||
AN EXAMPLE:
|
||||
|
||||
RCDATA NS_INFO_ProductVersion { 1,0,0,1,}
|
||||
|
||||
RCDATA NS_INFO_MIMEType { "video/x-video|",
|
||||
"video/x-flick\0" }
|
||||
RCDATA NS_INFO_FileExtents { "avi|",
|
||||
"flc\0" }
|
||||
RCDATA NS_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
|
||||
"MMOS2 Flc/Fli player(*.flc)\0" }
|
||||
|
||||
RCDATA NS_INFO_FileVersion { 1,0,0,1 }
|
||||
RCDATA NS_INFO_CompanyName { "Netscape Communications\0" }
|
||||
RCDATA NS_INFO_FileDescription { "NPAVI32 Extension DLL\0"
|
||||
RCDATA NS_INFO_InternalName { "NPAVI32\0" )
|
||||
RCDATA NS_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0"
|
||||
RCDATA NS_INFO_OriginalFilename { "NVAPI32.DLL" }
|
||||
RCDATA NS_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" }
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* RC_DATA types for version info - required */
|
||||
#define NS_INFO_ProductVersion 1
|
||||
#define NS_INFO_MIMEType 2
|
||||
#define NS_INFO_FileOpenName 3
|
||||
#define NS_INFO_FileExtents 4
|
||||
|
||||
/* RC_DATA types for version info - used if found */
|
||||
#define NS_INFO_FileDescription 5
|
||||
#define NS_INFO_ProductName 6
|
||||
|
||||
/* RC_DATA types for version info - optional */
|
||||
#define NS_INFO_CompanyName 7
|
||||
#define NS_INFO_FileVersion 8
|
||||
#define NS_INFO_InternalName 9
|
||||
#define NS_INFO_LegalCopyright 10
|
||||
#define NS_INFO_OriginalFilename 11
|
||||
|
||||
#ifndef RC_INVOKED
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Structures and definitions
|
||||
|
||||
#if !defined(__LP64__)
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
||||
#pragma options align=mac68k
|
||||
#endif
|
||||
#endif /* __LP64__ */
|
||||
|
||||
struct nsByteRange {
|
||||
PRInt32 offset; /* negative offset means from the end */
|
||||
PRUint32 length;
|
||||
struct nsByteRange* next;
|
||||
};
|
||||
|
||||
struct nsPluginRect {
|
||||
PRUint16 top;
|
||||
PRUint16 left;
|
||||
PRUint16 bottom;
|
||||
PRUint16 right;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Unix specific structures and definitions
|
||||
|
||||
#ifdef XP_UNIX
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
* Callback Structures.
|
||||
*
|
||||
* These are used to pass additional platform specific information.
|
||||
*/
|
||||
enum nsPluginCallbackType {
|
||||
nsPluginCallbackType_SetWindow = 1,
|
||||
nsPluginCallbackType_Print
|
||||
};
|
||||
|
||||
struct nsPluginAnyCallbackStruct {
|
||||
PRInt32 type;
|
||||
};
|
||||
|
||||
#ifdef MOZ_X11
|
||||
struct nsPluginSetWindowCallbackStruct {
|
||||
PRInt32 type;
|
||||
Display* display;
|
||||
Visual* visual;
|
||||
Colormap colormap;
|
||||
PRUint32 depth;
|
||||
};
|
||||
#else
|
||||
struct nsPluginSetWindowCallbackStruct {
|
||||
PRInt32 type;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
struct nsPluginPrintCallbackStruct {
|
||||
PRInt32 type;
|
||||
FILE* fp;
|
||||
};
|
||||
|
||||
#endif /* XP_UNIX */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// List of variables which should be implmented by the plugin
|
||||
enum nsPluginVariable {
|
||||
nsPluginVariable_NameString = 1,
|
||||
nsPluginVariable_DescriptionString = 2
|
||||
};
|
||||
|
||||
enum nsPluginManagerVariable {
|
||||
nsPluginManagerVariable_XDisplay = 1,
|
||||
nsPluginManagerVariable_XtAppContext = 2,
|
||||
nsPluginManagerVariable_SupportsXEmbed = 14
|
||||
};
|
||||
|
||||
enum nsPluginInstanceVariable {
|
||||
nsPluginInstanceVariable_WindowlessBool = 3,
|
||||
nsPluginInstanceVariable_TransparentBool = 4,
|
||||
nsPluginInstanceVariable_DoCacheBool = 5,
|
||||
nsPluginInstanceVariable_CallSetWindowAfterDestroyBool = 6,
|
||||
nsPluginInstanceVariable_ScriptableInstance = 10,
|
||||
nsPluginInstanceVariable_ScriptableIID = 11,
|
||||
nsPluginInstanceVariable_NeedsXEmbed = 14,
|
||||
nsPluginInstanceVariable_WantsAllNetworkStreams = 18
|
||||
#ifdef XP_MACOSX
|
||||
, nsPluginInstanceVariable_DrawingModel = 20
|
||||
, nsPluginInstanceVariable_EventModel = 21
|
||||
#endif
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum nsPluginMode {
|
||||
nsPluginMode_Embedded = 1,
|
||||
nsPluginMode_Full
|
||||
};
|
||||
|
||||
// XXX this can go away now
|
||||
enum nsPluginStreamType {
|
||||
nsPluginStreamType_Normal = 1,
|
||||
nsPluginStreamType_Seek,
|
||||
nsPluginStreamType_AsFile,
|
||||
nsPluginStreamType_AsFileOnly
|
||||
};
|
||||
|
||||
/*
|
||||
* The type of a nsPluginWindow - it specifies the type of the data structure
|
||||
* returned in the window field.
|
||||
*/
|
||||
enum nsPluginWindowType {
|
||||
nsPluginWindowType_Window = 1,
|
||||
nsPluginWindowType_Drawable
|
||||
};
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
|
||||
typedef void* nsPluginPlatformWindowRef;
|
||||
|
||||
#ifndef NP_NO_QUICKDRAW
|
||||
struct nsPluginPortQD {
|
||||
CGrafPtr port; /* Grafport */
|
||||
PRInt32 portx; /* position inside the topmost window */
|
||||
PRInt32 porty;
|
||||
};
|
||||
|
||||
typedef RgnHandle nsPluginRegionQD;
|
||||
#endif
|
||||
|
||||
struct nsPluginPortCG {
|
||||
CGContextRef context;
|
||||
void* window;
|
||||
};
|
||||
|
||||
typedef CGPathRef nsPluginRegionCG;
|
||||
|
||||
typedef union nsPluginPort {
|
||||
#ifndef NP_NO_QUICKDRAW
|
||||
nsPluginPortQD qdPort;
|
||||
#endif
|
||||
nsPluginPortCG cgPort;
|
||||
} nsPluginPort;
|
||||
|
||||
typedef void* nsPluginRegion;
|
||||
|
||||
#elif defined(XP_WIN) || defined(XP_OS2)
|
||||
|
||||
struct nsPluginPort;
|
||||
typedef HRGN nsPluginRegion;
|
||||
typedef HWND nsPluginPlatformWindowRef;
|
||||
|
||||
#elif defined(XP_UNIX) && defined(MOZ_X11)
|
||||
|
||||
struct nsPluginPort;
|
||||
typedef Region nsPluginRegion;
|
||||
typedef Drawable nsPluginPlatformWindowRef;
|
||||
|
||||
#else
|
||||
|
||||
struct nsPluginPort;
|
||||
typedef void* nsPluginRegion;
|
||||
typedef void* nsPluginPlatformWindowRef;
|
||||
|
||||
#endif
|
||||
|
||||
struct nsPluginWindow {
|
||||
nsPluginPort* window; /* Platform specific window handle */
|
||||
/* OS/2: x - Position of bottom left corner */
|
||||
/* OS/2: y - relative to visible netscape window */
|
||||
PRInt32 x; /* Position of top left corner relative */
|
||||
PRInt32 y; /* to a netscape page. */
|
||||
PRUint32 width; /* Maximum window size */
|
||||
PRUint32 height;
|
||||
nsPluginRect clipRect; /* Clipping rectangle in port coordinates */
|
||||
/* Used by Mac OS X only. */
|
||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
void* ws_info; /* Platform-dependent additonal data */
|
||||
#endif /* XP_UNIX */
|
||||
nsPluginWindowType type; /* Is this a window or a drawable? */
|
||||
};
|
||||
|
||||
struct nsPluginFullPrint {
|
||||
PRBool pluginPrinted; /* Set TRUE if plugin handled fullscreen */
|
||||
/* printing */
|
||||
PRBool printOne; /* TRUE if plugin should print one copy */
|
||||
/* to default printer */
|
||||
void* platformPrint; /* Platform-specific printing info */
|
||||
};
|
||||
|
||||
struct nsPluginEmbedPrint {
|
||||
nsPluginWindow window;
|
||||
void* platformPrint; /* Platform-specific printing info */
|
||||
};
|
||||
|
||||
struct nsPluginPrint {
|
||||
PRUint16 mode; /* nsPluginMode_Full or nsPluginMode_Embedded */
|
||||
union
|
||||
{
|
||||
nsPluginFullPrint fullPrint; /* if mode is nsPluginMode_Full */
|
||||
nsPluginEmbedPrint embedPrint; /* if mode is nsPluginMode_Embedded */
|
||||
} print;
|
||||
};
|
||||
|
||||
struct nsPluginEvent {
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
void* event;
|
||||
nsPluginPlatformWindowRef window;
|
||||
|
||||
#elif defined(XP_OS2)
|
||||
uint32 event;
|
||||
uint32 wParam;
|
||||
uint32 lParam;
|
||||
|
||||
#elif defined(XP_WIN)
|
||||
uint16 event;
|
||||
#if defined(_WIN64)
|
||||
uint64 wParam;
|
||||
uint64 lParam;
|
||||
#else
|
||||
uint32 wParam;
|
||||
uint32 lParam;
|
||||
#endif /* _WIN64 */
|
||||
|
||||
#elif defined(XP_UNIX) && defined(MOZ_X11)
|
||||
XEvent event;
|
||||
#else
|
||||
void *event;
|
||||
#endif
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum nsPluginReason {
|
||||
nsPluginReason_Base = 0,
|
||||
nsPluginReason_Done = 0,
|
||||
nsPluginReason_NetworkErr,
|
||||
nsPluginReason_UserBreak,
|
||||
nsPluginReason_NoReason
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Version Numbers for Structs
|
||||
|
||||
// These version number are for structures whose fields may evolve over time.
|
||||
// When fields are added to the end of the struct, the minor version will be
|
||||
// incremented. When the struct changes in an incompatible way the major version
|
||||
// will be incremented.
|
||||
|
||||
#define nsMajorVersion(v) (((PRInt32)(v) >> 16) & 0xffff)
|
||||
#define nsMinorVersion(v) ((PRInt32)(v) & 0xffff)
|
||||
|
||||
#define nsVersionOK(suppliedV, requiredV) \
|
||||
(nsMajorVersion(suppliedV) == nsMajorVersion(requiredV) \
|
||||
&& nsMinorVersion(suppliedV) >= nsMinorVersion(requiredV))
|
||||
|
||||
#define NP_POPUP_API_VERSION 16
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Classes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Classes that must be implemented by the plugin DLL:
|
||||
class nsIPlugin; // plugin class (MIME-type handler)
|
||||
class nsIPluginInstance; // plugin instance
|
||||
|
||||
// Classes that are implemented by the browser:
|
||||
class nsIPluginTagInfo; // describes html tag
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(__LP64__)
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
||||
#pragma options align=reset
|
||||
#endif
|
||||
#endif /* __LP64__ */
|
||||
|
||||
#endif /* RC_INVOKED */
|
||||
#ifdef __OS2__
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#endif // nsplugindefs_h___
|
@ -45,20 +45,19 @@ native nativeChar(const char * *);
|
||||
[ptr] native constCharPtr(const char);
|
||||
[ref] native constCharStarRef(const char *);
|
||||
|
||||
native nsPluginMode(nsPluginMode);
|
||||
native nsPluginStreamType(nsPluginStreamType);
|
||||
native nsPluginWindow(nsPluginWindow);
|
||||
[ptr] native nsPluginWindowPtr(nsPluginWindow);
|
||||
[ref] native nsPluginWindowStarRef(nsPluginWindow *);
|
||||
[ptr] native nsPluginPrintPtr(nsPluginPrint);
|
||||
native nsByteRange(nsByteRange);
|
||||
[ptr] native nsByteRangePtr(nsByteRange);
|
||||
[ptr] native nsPluginEventPtr(nsPluginEvent);
|
||||
native nsPluginVariable(nsPluginVariable);
|
||||
native nsPluginInstanceVariable(nsPluginInstanceVariable);
|
||||
native nsPluginInstancePeerVariable(nsPluginInstancePeerVariable);
|
||||
[ptr] native nsPluginRectPtr(nsPluginRect);
|
||||
native nsPluginRegion(nsPluginRegion);
|
||||
native NPWindowType(NPWindowType);
|
||||
native NPWindow(NPWindow);
|
||||
[ptr] native NPWindowPtr(NPWindow);
|
||||
[ref] native NPWindowStarRef(NPWindow *);
|
||||
[ptr] native NPPrintPtr(NPPrint);
|
||||
native NPByteRange(NPByteRange);
|
||||
[ptr] native NPByteRangePtr(NPByteRange);
|
||||
native NPPVariable(NPPVariable);
|
||||
native NPNVariable(NPNVariable);
|
||||
[ptr] native NPRectPtr(NPRect);
|
||||
native NPRegion(NPRegion);
|
||||
native NPDrawingModel(NPDrawingModel);
|
||||
native NPEventModel(NPEventModel);
|
||||
|
||||
[ptr] native JRIEnvPtr(JRIEnv);
|
||||
native jref(jref);
|
||||
|
@ -650,13 +650,13 @@ nsNPAPIPlugin::GetMIMEDescription(const char* *resultingDesc)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNPAPIPlugin::GetValue(nsPluginVariable variable, void *value)
|
||||
nsNPAPIPlugin::GetValue(NPPVariable variable, void *value)
|
||||
{
|
||||
PLUGIN_LOG(PLUGIN_LOG_NORMAL,
|
||||
("nsNPAPIPlugin::GetValue called: this=%p, variable=%d\n", this, variable));
|
||||
|
||||
NPError (*npGetValue)(void*, nsPluginVariable, void*) =
|
||||
(NPError (*)(void*, nsPluginVariable, void*)) PR_FindFunctionSymbol(fLibrary,
|
||||
NPError (*npGetValue)(void*, NPPVariable, void*) =
|
||||
(NPError (*)(void*, NPPVariable, void*)) PR_FindFunctionSymbol(fLibrary,
|
||||
"NP_GetValue");
|
||||
|
||||
if (npGetValue && NPERR_NO_ERROR == npGetValue(nsnull, variable, value)) {
|
||||
@ -1057,7 +1057,7 @@ _invalidaterect(NPP npp, NPRect *invalidRect)
|
||||
|
||||
PluginDestructionGuard guard(inst);
|
||||
|
||||
inst->InvalidateRect((nsPluginRect *)invalidRect);
|
||||
inst->InvalidateRect((NPRect *)invalidRect);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
@ -1080,7 +1080,7 @@ _invalidateregion(NPP npp, NPRegion invalidRegion)
|
||||
|
||||
PluginDestructionGuard guard(inst);
|
||||
|
||||
inst->InvalidateRegion((nsPluginRegion)invalidRegion);
|
||||
inst->InvalidateRegion((NPRegion)invalidRegion);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
@ -1846,10 +1846,10 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
if (npp) {
|
||||
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *) npp->ndata;
|
||||
PRBool windowless = PR_FALSE;
|
||||
inst->GetValue(nsPluginInstanceVariable_WindowlessBool, &windowless);
|
||||
inst->IsWindowless(&windowless);
|
||||
NPBool needXEmbed = PR_FALSE;
|
||||
if (!windowless) {
|
||||
inst->GetValue((nsPluginInstanceVariable)NPPVpluginNeedsXEmbed, &needXEmbed);
|
||||
inst->GetValueFromPlugin(NPPVpluginNeedsXEmbed, &needXEmbed);
|
||||
}
|
||||
if (windowless || needXEmbed) {
|
||||
(*(Display **)result) = GDK_DISPLAY();
|
||||
@ -1979,7 +1979,9 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
if (npp) {
|
||||
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance*)npp->ndata;
|
||||
if (inst) {
|
||||
*(NPDrawingModel*)result = inst->GetDrawingModel();
|
||||
NPDrawingModel drawingModel;
|
||||
inst->GetDrawingModel((PRInt32*)&drawingModel);
|
||||
*(NPDrawingModel*)result = drawingModel;
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
}
|
||||
@ -2181,15 +2183,15 @@ _requestread(NPStream *pstream, NPByteRange *rangeList)
|
||||
|
||||
nsNPAPIPluginStreamListener* streamlistener = (nsNPAPIPluginStreamListener*)pstream->ndata;
|
||||
|
||||
nsPluginStreamType streamtype = nsPluginStreamType_Normal;
|
||||
PRInt32 streamtype = NP_NORMAL;
|
||||
|
||||
streamlistener->GetStreamType(&streamtype);
|
||||
|
||||
if (streamtype != nsPluginStreamType_Seek)
|
||||
if (streamtype != NP_SEEK)
|
||||
return NPERR_STREAM_NOT_SEEKABLE;
|
||||
|
||||
if (streamlistener->mStreamInfo)
|
||||
streamlistener->mStreamInfo->RequestRead((nsByteRange *)rangeList);
|
||||
streamlistener->mStreamInfo->RequestRead((NPByteRange *)rangeList);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ nsNPAPIPluginStreamListener::nsNPAPIPluginStreamListener(nsNPAPIPluginInstance*
|
||||
mInst(inst),
|
||||
mStreamBufferSize(0),
|
||||
mStreamBufferByteCount(0),
|
||||
mStreamType(nsPluginStreamType_Normal),
|
||||
mStreamType(NP_NORMAL),
|
||||
mStreamStarted(PR_FALSE),
|
||||
mStreamCleanedUp(PR_FALSE),
|
||||
mCallNotify(PR_FALSE),
|
||||
@ -370,16 +370,16 @@ nsNPAPIPluginStreamListener::OnStartBinding(nsIPluginStreamInfo* pluginInfo)
|
||||
switch(streamType)
|
||||
{
|
||||
case NP_NORMAL:
|
||||
mStreamType = nsPluginStreamType_Normal;
|
||||
mStreamType = NP_NORMAL;
|
||||
break;
|
||||
case NP_ASFILEONLY:
|
||||
mStreamType = nsPluginStreamType_AsFileOnly;
|
||||
mStreamType = NP_ASFILEONLY;
|
||||
break;
|
||||
case NP_ASFILE:
|
||||
mStreamType = nsPluginStreamType_AsFile;
|
||||
mStreamType = NP_ASFILE;
|
||||
break;
|
||||
case NP_SEEK:
|
||||
mStreamType = nsPluginStreamType_Seek;
|
||||
mStreamType = NP_SEEK;
|
||||
break;
|
||||
default:
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -784,7 +784,7 @@ nsNPAPIPluginStreamListener::OnStopBinding(nsIPluginStreamInfo* pluginInfo,
|
||||
// check if the stream is of seekable type and later its destruction
|
||||
// see bug 91140
|
||||
nsresult rv = NS_OK;
|
||||
if (mStreamType != nsPluginStreamType_Seek) {
|
||||
if (mStreamType != NP_SEEK) {
|
||||
NPReason reason = NPRES_DONE;
|
||||
|
||||
if (NS_FAILED(status))
|
||||
@ -800,7 +800,7 @@ nsNPAPIPluginStreamListener::OnStopBinding(nsIPluginStreamInfo* pluginInfo,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNPAPIPluginStreamListener::GetStreamType(nsPluginStreamType *result)
|
||||
nsNPAPIPluginStreamListener::GetStreamType(PRInt32 *result)
|
||||
{
|
||||
*result = mStreamType;
|
||||
return NS_OK;
|
||||
@ -1082,7 +1082,7 @@ nsNPAPIPluginInstance::GetParameters(PRUint16& n, const char*const*& names,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNPAPIPluginInstance::GetMode(nsPluginMode *result)
|
||||
nsNPAPIPluginInstance::GetMode(PRInt32 *result)
|
||||
{
|
||||
if (mOwner)
|
||||
return mOwner->GetMode(result);
|
||||
@ -1128,7 +1128,7 @@ nsNPAPIPluginInstance::InitializePlugin()
|
||||
// XXX Note that the NPPluginType_* enums were crafted to be
|
||||
// backward compatible...
|
||||
|
||||
nsPluginMode mode;
|
||||
PRInt32 mode;
|
||||
const char* mimetype;
|
||||
NPError error;
|
||||
|
||||
@ -1209,7 +1209,7 @@ nsNPAPIPluginInstance::InitializePlugin()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::SetWindow(nsPluginWindow* window)
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::SetWindow(NPWindow* window)
|
||||
{
|
||||
// NPAPI plugins don't want a SetWindow(NULL).
|
||||
if (!window || !mStarted)
|
||||
@ -1218,7 +1218,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::SetWindow(nsPluginWindow* window)
|
||||
#if defined(MOZ_WIDGET_GTK2)
|
||||
// bug 108347, flash plugin on linux doesn't like window->width <=
|
||||
// 0, but Java needs wants this call.
|
||||
if (!nsPluginHost::IsJavaMIMEType(mMIMEType) && window->type == nsPluginWindowType_Window &&
|
||||
if (!nsPluginHost::IsJavaMIMEType(mMIMEType) && window->type == NPWindowTypeWindow &&
|
||||
(window->width <= 0 || window->height <= 0)) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1227,9 +1227,12 @@ NS_IMETHODIMP nsNPAPIPluginInstance::SetWindow(nsPluginWindow* window)
|
||||
// should always be NULL. For now NULL them out here but in the future we can
|
||||
// optimize to not set them in the first place and only make SetWindow calls
|
||||
// when size or position changes.
|
||||
if (GetEventModel() == NPEventModelCocoa) {
|
||||
window->window->cgPort.context = NULL;
|
||||
window->window->cgPort.window = NULL;
|
||||
NPEventModel eventModel;
|
||||
GetEventModel((PRInt32*)&eventModel);
|
||||
if (eventModel == NPEventModelCocoa) {
|
||||
NP_CGContext* pluginPort = static_cast<NP_CGContext*>(window->window);
|
||||
pluginPort->context = NULL;
|
||||
pluginPort->window = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1304,7 +1307,7 @@ nsresult nsNPAPIPluginInstance::NewNotifyStream(nsIPluginStreamListener** listen
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::Print(nsPluginPrint* platformPrint)
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::Print(NPPrint* platformPrint)
|
||||
{
|
||||
NS_ENSURE_TRUE(platformPrint, NS_ERROR_NULL_POINTER);
|
||||
|
||||
@ -1349,7 +1352,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Print(nsPluginPrint* platformPrint)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* handled)
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::HandleEvent(void* event, PRBool* handled)
|
||||
{
|
||||
if (!mStarted)
|
||||
return NS_OK;
|
||||
@ -1363,22 +1366,14 @@ NS_IMETHODIMP nsNPAPIPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* h
|
||||
|
||||
if (mCallbacks->event) {
|
||||
mCurrentPluginEvent = event;
|
||||
#ifdef XP_MACOSX
|
||||
result = (*mCallbacks->event)(&mNPP, (void*)event->event);
|
||||
#elif defined(XP_WIN) || defined(XP_OS2)
|
||||
NPEvent npEvent;
|
||||
npEvent.event = event->event;
|
||||
npEvent.wParam = event->wParam;
|
||||
npEvent.lParam = event->lParam;
|
||||
|
||||
NS_TRY_SAFE_CALL_RETURN(result, (*mCallbacks->event)(&mNPP, (void*)&npEvent), mLibrary, this);
|
||||
#else // MOZ_X11 or other
|
||||
result = (*mCallbacks->event)(&mNPP, (void*)&event->event);
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
NS_TRY_SAFE_CALL_RETURN(result, (*mCallbacks->event)(&mNPP, event), mLibrary, this);
|
||||
#else
|
||||
result = (*mCallbacks->event)(&mNPP, event);
|
||||
#endif
|
||||
|
||||
NPP_PLUGIN_LOG(PLUGIN_LOG_NOISY,
|
||||
("NPP HandleEvent called: this=%p, npp=%p, event=%d, return=%d\n",
|
||||
this, &mNPP, event->event, result));
|
||||
("NPP HandleEvent called: this=%p, npp=%p, event=%p, return=%d\n",
|
||||
this, &mNPP, event, result));
|
||||
|
||||
*handled = result;
|
||||
mCurrentPluginEvent = nsnull;
|
||||
@ -1387,7 +1382,7 @@ NS_IMETHODIMP nsNPAPIPluginInstance::HandleEvent(nsPluginEvent* event, PRBool* h
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsNPAPIPluginInstance::GetValueInternal(NPPVariable variable, void* value)
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::GetValueFromPlugin(NPPVariable variable, void* value)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
if (mCallbacks->getvalue && mStarted) {
|
||||
@ -1402,44 +1397,6 @@ nsresult nsNPAPIPluginInstance::GetValueInternal(NPPVariable variable, void* val
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::GetValue(nsPluginInstanceVariable variable, void *value)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
switch (variable) {
|
||||
case nsPluginInstanceVariable_WindowlessBool:
|
||||
*(PRBool *)value = mWindowless;
|
||||
break;
|
||||
|
||||
case nsPluginInstanceVariable_TransparentBool:
|
||||
*(PRBool *)value = mTransparent;
|
||||
break;
|
||||
|
||||
case nsPluginInstanceVariable_DoCacheBool:
|
||||
*(PRBool *)value = mCached;
|
||||
break;
|
||||
|
||||
case nsPluginInstanceVariable_CallSetWindowAfterDestroyBool:
|
||||
*(PRBool *)value = 0; // not supported for NPAPI plugins
|
||||
break;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
case nsPluginInstanceVariable_DrawingModel:
|
||||
*(NPDrawingModel*)value = mDrawingModel;
|
||||
break;
|
||||
|
||||
case nsPluginInstanceVariable_EventModel:
|
||||
*(NPEventModel*)value = mEventModel;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
res = GetValueInternal((NPPVariable)variable, value);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsNPAPIPluginInstance::GetNPP(NPP* aNPP)
|
||||
{
|
||||
if (aNPP)
|
||||
@ -1484,27 +1441,38 @@ void nsNPAPIPluginInstance::SetDrawingModel(NPDrawingModel aModel)
|
||||
mDrawingModel = aModel;
|
||||
}
|
||||
|
||||
NPDrawingModel nsNPAPIPluginInstance::GetDrawingModel()
|
||||
{
|
||||
return mDrawingModel;
|
||||
}
|
||||
|
||||
void nsNPAPIPluginInstance::SetEventModel(NPEventModel aModel)
|
||||
{
|
||||
mEventModel = aModel;
|
||||
}
|
||||
|
||||
NPEventModel nsNPAPIPluginInstance::GetEventModel()
|
||||
{
|
||||
return mEventModel;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::GetDrawingModel(PRInt32* aModel)
|
||||
{
|
||||
#ifdef XP_MACOSX
|
||||
*aModel = (PRInt32)mDrawingModel;
|
||||
return NS_OK;
|
||||
#else
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNPAPIPluginInstance::GetEventModel(PRInt32* aModel)
|
||||
{
|
||||
#ifdef XP_MACOSX
|
||||
*aModel = (PRInt32)mEventModel;
|
||||
return NS_OK;
|
||||
#else
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNPAPIPluginInstance::GetJSObject(JSContext *cx, JSObject** outObject)
|
||||
{
|
||||
NPObject *npobj = nsnull;
|
||||
nsresult rv = GetValueInternal(NPPVpluginScriptableNPObject, &npobj);
|
||||
nsresult rv = GetValueFromPlugin(NPPVpluginScriptableNPObject, &npobj);
|
||||
if (NS_FAILED(rv) || !npobj)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -1525,7 +1493,7 @@ nsNPAPIPluginInstance::DefineJavaProperties()
|
||||
// exposed as window.java.
|
||||
|
||||
// Get the scriptable plugin object.
|
||||
nsresult rv = GetValueInternal(NPPVpluginScriptableNPObject, &plugin_obj);
|
||||
nsresult rv = GetValueFromPlugin(NPPVpluginScriptableNPObject, &plugin_obj);
|
||||
|
||||
if (NS_FAILED(rv) || !plugin_obj) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -1572,13 +1540,34 @@ nsNPAPIPluginInstance::DefineJavaProperties()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNPAPIPluginInstance::ShouldCache(PRBool* shouldCache)
|
||||
{
|
||||
*shouldCache = mCached;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNPAPIPluginInstance::IsWindowless(PRBool* isWindowless)
|
||||
{
|
||||
*isWindowless = mWindowless;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNPAPIPluginInstance::IsTransparent(PRBool* isTransparent)
|
||||
{
|
||||
*isTransparent = mTransparent;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNPAPIPluginInstance::GetFormValue(nsAString& aValue)
|
||||
{
|
||||
aValue.Truncate();
|
||||
|
||||
char *value = nsnull;
|
||||
nsresult rv = GetValueInternal(NPPVformValue, &value);
|
||||
nsresult rv = GetValueFromPlugin(NPPVformValue, &value);
|
||||
if (NS_FAILED(rv) || !value)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -1791,7 +1780,7 @@ nsNPAPIPluginInstance::GetDOMElement(nsIDOMElement* *result)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNPAPIPluginInstance::InvalidateRect(nsPluginRect *invalidRect)
|
||||
nsNPAPIPluginInstance::InvalidateRect(NPRect *invalidRect)
|
||||
{
|
||||
nsCOMPtr<nsIPluginInstanceOwner> owner;
|
||||
GetOwner(getter_AddRefs(owner));
|
||||
@ -1802,7 +1791,7 @@ nsNPAPIPluginInstance::InvalidateRect(nsPluginRect *invalidRect)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNPAPIPluginInstance::InvalidateRegion(nsPluginRegion invalidRegion)
|
||||
nsNPAPIPluginInstance::InvalidateRegion(NPRegion invalidRegion)
|
||||
{
|
||||
nsCOMPtr<nsIPluginInstanceOwner> owner;
|
||||
GetOwner(getter_AddRefs(owner));
|
||||
|
@ -92,9 +92,7 @@ public:
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
void SetDrawingModel(NPDrawingModel aModel);
|
||||
NPDrawingModel GetDrawingModel();
|
||||
void SetEventModel(NPEventModel aModel);
|
||||
NPEventModel GetEventModel();
|
||||
#endif
|
||||
|
||||
nsresult NewNotifyStream(nsIPluginStreamListener** listener,
|
||||
@ -127,15 +125,12 @@ public:
|
||||
protected:
|
||||
nsresult InitializePlugin();
|
||||
|
||||
// Calls NPP_GetValue
|
||||
nsresult GetValueInternal(NPPVariable variable, void* value);
|
||||
|
||||
nsresult GetTagType(nsPluginTagType *result);
|
||||
nsresult GetAttributes(PRUint16& n, const char*const*& names,
|
||||
const char*const*& values);
|
||||
nsresult GetParameters(PRUint16& n, const char*const*& names,
|
||||
const char*const*& values);
|
||||
nsresult GetMode(nsPluginMode *result);
|
||||
nsresult GetMode(PRInt32 *result);
|
||||
|
||||
// A pointer to the plugin's callback functions. This information
|
||||
// is actually stored in the plugin class (<b>nsPluginClass</b>),
|
||||
@ -177,7 +172,7 @@ private:
|
||||
nsTArray<nsNPAPITimer*> mTimers;
|
||||
|
||||
// non-null during a HandleEvent call
|
||||
nsPluginEvent* mCurrentPluginEvent;
|
||||
void* mCurrentPluginEvent;
|
||||
};
|
||||
|
||||
#endif // nsNPAPIPluginInstance_h_
|
||||
|
@ -86,7 +86,7 @@ protected:
|
||||
NPStream mNPStream;
|
||||
PRUint32 mStreamBufferSize;
|
||||
PRInt32 mStreamBufferByteCount;
|
||||
nsPluginStreamType mStreamType;
|
||||
PRInt32 mStreamType;
|
||||
PRPackedBool mStreamStarted;
|
||||
PRPackedBool mStreamCleanedUp;
|
||||
PRPackedBool mCallNotify;
|
||||
|
@ -466,24 +466,11 @@ void nsPluginInstanceTagList::stopRunning(nsISupportsArray* aReloadDocs,
|
||||
if (!mFirst)
|
||||
return;
|
||||
|
||||
PRBool doCallSetWindowAfterDestroy = PR_FALSE;
|
||||
|
||||
for (nsPluginInstanceTag * p = mFirst; p != nsnull; p = p->mNext) {
|
||||
if (!p->mStopped && p->mInstance &&
|
||||
(!aPluginTag || aPluginTag == p->mPluginTag)) {
|
||||
// then determine if the plugin wants Destroy to be called after
|
||||
// Set Window. This is for bug 50547.
|
||||
p->mInstance->GetValue(nsPluginInstanceVariable_CallSetWindowAfterDestroyBool,
|
||||
(void *) &doCallSetWindowAfterDestroy);
|
||||
if (doCallSetWindowAfterDestroy) {
|
||||
p->mInstance->Stop();
|
||||
p->mInstance->SetWindow(nsnull);
|
||||
}
|
||||
else {
|
||||
p->mInstance->SetWindow(nsnull);
|
||||
p->mInstance->Stop();
|
||||
}
|
||||
doCallSetWindowAfterDestroy = PR_FALSE;
|
||||
p->mInstance->SetWindow(nsnull);
|
||||
p->mInstance->Stop();
|
||||
p->setStopped(PR_TRUE);
|
||||
|
||||
// If we've been passed an array to return, lets collect all our documents,
|
||||
@ -524,14 +511,8 @@ void nsPluginInstanceTagList::removeAllStopped()
|
||||
nsPluginInstanceTag * nsPluginInstanceTagList::find(nsIPluginInstance* instance)
|
||||
{
|
||||
for (nsPluginInstanceTag * p = mFirst; p != nsnull; p = p->mNext) {
|
||||
if (p->mInstance == instance) {
|
||||
#ifdef NS_DEBUG
|
||||
PRBool doCache = PR_TRUE;
|
||||
p->mInstance->GetValue(nsPluginInstanceVariable_DoCacheBool, (void *) &doCache);
|
||||
NS_ASSERTION(!p->mStopped || doCache, "This plugin is not supposed to be cached!");
|
||||
#endif
|
||||
if (p->mInstance == instance)
|
||||
return p;
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
@ -554,14 +535,8 @@ nsPluginInstanceTag * nsPluginInstanceTagList::find(const char * mimetype)
|
||||
if (NS_FAILED(rv))
|
||||
continue;
|
||||
|
||||
if (PL_strcasecmp(mt, mimetype) == 0) {
|
||||
#ifdef NS_DEBUG
|
||||
PRBool doCache = PR_TRUE;
|
||||
p->mInstance->GetValue(nsPluginInstanceVariable_DoCacheBool, (void *) &doCache);
|
||||
NS_ASSERTION(!p->mStopped || doCache, "This plugin is not supposed to be cached!");
|
||||
#endif
|
||||
if (PL_strcasecmp(mt, mimetype) == 0)
|
||||
return p;
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
@ -569,14 +544,8 @@ nsPluginInstanceTag * nsPluginInstanceTagList::find(const char * mimetype)
|
||||
nsPluginInstanceTag * nsPluginInstanceTagList::findStopped(const char * url)
|
||||
{
|
||||
for (nsPluginInstanceTag * p = mFirst; p != nsnull; p = p->mNext) {
|
||||
if (!PL_strcmp(url, p->mURL) && p->mStopped) {
|
||||
#ifdef NS_DEBUG
|
||||
PRBool doCache = PR_TRUE;
|
||||
p->mInstance->GetValue(nsPluginInstanceVariable_DoCacheBool, (void *) &doCache);
|
||||
NS_ASSERTION(doCache, "This plugin is not supposed to be cached!");
|
||||
#endif
|
||||
if (!PL_strcmp(url, p->mURL) && p->mStopped)
|
||||
return p;
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
@ -605,14 +574,6 @@ nsPluginInstanceTag * nsPluginInstanceTagList::findOldestStopped()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
if (res) {
|
||||
PRBool doCache = PR_TRUE;
|
||||
res->mInstance->GetValue(nsPluginInstanceVariable_DoCacheBool, (void *) &doCache);
|
||||
NS_ASSERTION(doCache, "This plugin is not supposed to be cached!");
|
||||
}
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -1123,7 +1084,7 @@ public:
|
||||
GetURL(const char** result);
|
||||
|
||||
NS_IMETHOD
|
||||
RequestRead(nsByteRange* rangeList);
|
||||
RequestRead(NPByteRange* rangeList);
|
||||
|
||||
NS_IMETHOD
|
||||
GetStreamOffset(PRInt32 *result);
|
||||
@ -1155,7 +1116,7 @@ public:
|
||||
SetPluginStreamListenerPeer(nsPluginStreamListenerPeer * aPluginStreamListenerPeer);
|
||||
|
||||
void
|
||||
MakeByteRangeString(nsByteRange* aRangeList, nsACString &string, PRInt32 *numRequests);
|
||||
MakeByteRangeString(NPByteRange* aRangeList, nsACString &string, PRInt32 *numRequests);
|
||||
|
||||
PRBool
|
||||
UseExistingPluginCacheFile(nsPluginStreamInfo* psi);
|
||||
@ -1241,7 +1202,7 @@ private:
|
||||
// these get passed to the plugin stream listener
|
||||
char *mMIMEType;
|
||||
PRUint32 mLength;
|
||||
nsPluginStreamType mStreamType;
|
||||
PRInt32 mStreamType;
|
||||
nsIPluginHost *mHost;
|
||||
|
||||
// local cached file, we save the content into local cache if browser cache is not available,
|
||||
@ -1335,7 +1296,7 @@ nsPluginStreamInfo::GetURL(const char** result)
|
||||
}
|
||||
|
||||
void
|
||||
nsPluginStreamInfo::MakeByteRangeString(nsByteRange* aRangeList, nsACString &rangeRequest, PRInt32 *numRequests)
|
||||
nsPluginStreamInfo::MakeByteRangeString(NPByteRange* aRangeList, nsACString &rangeRequest, PRInt32 *numRequests)
|
||||
{
|
||||
rangeRequest.Truncate();
|
||||
*numRequests = 0;
|
||||
@ -1346,7 +1307,7 @@ nsPluginStreamInfo::MakeByteRangeString(nsByteRange* aRangeList, nsACString &ran
|
||||
PRInt32 requestCnt = 0;
|
||||
nsCAutoString string("bytes=");
|
||||
|
||||
for (nsByteRange * range = aRangeList; range != nsnull; range = range->next) {
|
||||
for (NPByteRange * range = aRangeList; range != nsnull; range = range->next) {
|
||||
// XXX zero length?
|
||||
if (!range->length)
|
||||
continue;
|
||||
@ -1370,7 +1331,7 @@ nsPluginStreamInfo::MakeByteRangeString(nsByteRange* aRangeList, nsACString &ran
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginStreamInfo::RequestRead(nsByteRange* rangeList)
|
||||
nsPluginStreamInfo::RequestRead(NPByteRange* rangeList)
|
||||
{
|
||||
nsCAutoString rangeString;
|
||||
PRInt32 numRequests;
|
||||
@ -1576,7 +1537,7 @@ nsPluginStreamListenerPeer::nsPluginStreamListenerPeer()
|
||||
mInstance = nsnull;
|
||||
mPStreamListener = nsnull;
|
||||
mHost = nsnull;
|
||||
mStreamType = nsPluginStreamType_Normal;
|
||||
mStreamType = NP_NORMAL;
|
||||
mStartBinding = PR_FALSE;
|
||||
mAbort = PR_FALSE;
|
||||
mRequestFailed = PR_FALSE;
|
||||
@ -1887,8 +1848,8 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request,
|
||||
|
||||
if (responseCode > 206) { // not normal
|
||||
PRBool bWantsAllNetworkStreams = PR_FALSE;
|
||||
mInstance->GetValue(nsPluginInstanceVariable_WantsAllNetworkStreams,
|
||||
(void *)&bWantsAllNetworkStreams);
|
||||
mInstance->GetValueFromPlugin(NPPVpluginWantsAllNetworkStreams,
|
||||
(void*)&bWantsAllNetworkStreams);
|
||||
if (!bWantsAllNetworkStreams) {
|
||||
mRequestFailed = PR_TRUE;
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -1966,7 +1927,7 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request,
|
||||
PR_LogFlush();
|
||||
#endif
|
||||
|
||||
nsPluginWindow *window = nsnull;
|
||||
NPWindow* window = nsnull;
|
||||
|
||||
// if we don't have an nsIPluginInstance (mInstance), it means
|
||||
// we weren't able to load a plugin previously because we
|
||||
@ -1980,9 +1941,9 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request,
|
||||
mOwner->GetWindow(window);
|
||||
if (!mInstance && mHost && window) {
|
||||
// determine if we need to try embedded again. FullPage takes a different code path
|
||||
nsPluginMode mode;
|
||||
PRInt32 mode;
|
||||
mOwner->GetMode(&mode);
|
||||
if (mode == nsPluginMode_Embedded)
|
||||
if (mode == NP_EMBED)
|
||||
rv = mHost->InstantiateEmbeddedPlugin(aContentType.get(), aURL, mOwner);
|
||||
else
|
||||
rv = mHost->SetUpPluginInstance(aContentType.get(), aURL, mOwner);
|
||||
@ -2084,7 +2045,7 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnDataAvailable(nsIRequest *request,
|
||||
|
||||
// if the plugin has requested an AsFileOnly stream, then don't
|
||||
// call OnDataAvailable
|
||||
if (mStreamType != nsPluginStreamType_AsFileOnly) {
|
||||
if (mStreamType != NP_ASFILEONLY) {
|
||||
// get the absolute offset of the request, if one exists.
|
||||
nsCOMPtr<nsIByteRangeRequest> brr = do_QueryInterface(request);
|
||||
if (brr) {
|
||||
@ -2227,7 +2188,7 @@ NS_IMETHODIMP nsPluginStreamListenerPeer::OnStopRequest(nsIRequest *request,
|
||||
}
|
||||
|
||||
// call OnFileAvailable if plugin requests stream type StreamType_AsFile or StreamType_AsFileOnly
|
||||
if (mStreamType >= nsPluginStreamType_AsFile) {
|
||||
if (mStreamType >= NP_ASFILE) {
|
||||
nsCOMPtr<nsIFile> localFile = do_QueryInterface(mLocalCachedFile);
|
||||
if (!localFile) {
|
||||
nsCOMPtr<nsICachingChannel> cacheChannel = do_QueryInterface(request);
|
||||
@ -2392,7 +2353,7 @@ nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIRequest *request,
|
||||
|
||||
mPStreamListener->GetStreamType(&mStreamType);
|
||||
|
||||
if (!useLocalCache && mStreamType >= nsPluginStreamType_AsFile) {
|
||||
if (!useLocalCache && mStreamType >= NP_ASFILE) {
|
||||
// check it out if this is not a file channel.
|
||||
nsCOMPtr<nsIFileChannel> fileChannel = do_QueryInterface(request);
|
||||
if (!fileChannel) {
|
||||
@ -3194,7 +3155,7 @@ NS_IMETHODIMP nsPluginHost::InstantiateEmbeddedPlugin(const char *aMimeType,
|
||||
// if we are here then we have loaded a plugin for this mimetype
|
||||
// and it could be the Default plugin
|
||||
|
||||
nsPluginWindow *window = nsnull;
|
||||
NPWindow *window = nsnull;
|
||||
|
||||
//we got a plugin built, now stream
|
||||
aOwner->GetWindow(window);
|
||||
@ -3279,7 +3240,7 @@ NS_IMETHODIMP nsPluginHost::InstantiateFullPagePlugin(const char *aMimeType,
|
||||
|
||||
if (NS_OK == rv) {
|
||||
nsCOMPtr<nsIPluginInstance> instance;
|
||||
nsPluginWindow * win = nsnull;
|
||||
NPWindow* win = nsnull;
|
||||
|
||||
aOwner->GetInstance(*getter_AddRefs(instance));
|
||||
aOwner->GetWindow(win);
|
||||
@ -3321,7 +3282,7 @@ nsresult nsPluginHost::FindStoppedPluginForURL(nsIURI* aURL,
|
||||
|
||||
if (plugin && plugin->mStopped) {
|
||||
nsIPluginInstance* instance = plugin->mInstance;
|
||||
nsPluginWindow *window = nsnull;
|
||||
NPWindow* window = nsnull;
|
||||
aOwner->GetWindow(window);
|
||||
|
||||
aOwner->SetInstance(instance);
|
||||
@ -5326,8 +5287,7 @@ nsPluginHost::StopPluginInstance(nsIPluginInstance* aInstance)
|
||||
|
||||
// if the plugin does not want to be 'cached' just remove it
|
||||
PRBool doCache = PR_TRUE;
|
||||
aInstance->GetValue(nsPluginInstanceVariable_DoCacheBool, (void *) &doCache);
|
||||
|
||||
aInstance->ShouldCache(&doCache);
|
||||
if (!doCache) {
|
||||
PRLibrary * library = nsnull;
|
||||
if (plugin->mPluginTag)
|
||||
@ -5891,7 +5851,7 @@ nsresult nsPluginStreamListenerPeer::ServeStreamAsFile(nsIRequest *request,
|
||||
nsCOMPtr<nsIPluginInstanceOwner> owner;
|
||||
mInstance->GetOwner(getter_AddRefs(owner));
|
||||
if (owner) {
|
||||
nsPluginWindow *window = nsnull;
|
||||
NPWindow* window = nsnull;
|
||||
owner->GetWindow(window);
|
||||
#if defined (MOZ_WIDGET_GTK2)
|
||||
// Should call GetPluginPort() here.
|
||||
@ -5899,7 +5859,7 @@ nsresult nsPluginStreamListenerPeer::ServeStreamAsFile(nsIRequest *request,
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
((nsPluginNativeWindow*)window)->GetPluginWidget(getter_AddRefs(widget));
|
||||
if (widget) {
|
||||
window->window = (nsPluginPort*) widget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
|
||||
window->window = widget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
|
||||
}
|
||||
#endif
|
||||
if (window->window) {
|
||||
@ -5913,7 +5873,7 @@ nsresult nsPluginStreamListenerPeer::ServeStreamAsFile(nsIRequest *request,
|
||||
mPluginStreamInfo->SetStreamOffset(0);
|
||||
|
||||
// force the plugin use stream as file
|
||||
mStreamType = nsPluginStreamType_AsFile;
|
||||
mStreamType = NP_ASFILE;
|
||||
|
||||
// then check it out if browser cache is not available
|
||||
nsCOMPtr<nsICachingChannel> cacheChannel = do_QueryInterface(request);
|
||||
@ -5985,8 +5945,8 @@ nsPluginByteRangeStreamListener::OnStartRequest(nsIRequest *request, nsISupports
|
||||
if (responseCode != 200) {
|
||||
PRBool bWantsAllNetworkStreams = PR_FALSE;
|
||||
pslp->GetPluginInstance()->
|
||||
GetValue(nsPluginInstanceVariable_WantsAllNetworkStreams,
|
||||
(void *)&bWantsAllNetworkStreams);
|
||||
GetValueFromPlugin(NPPVpluginWantsAllNetworkStreams,
|
||||
(void*)&bWantsAllNetworkStreams);
|
||||
if (!bWantsAllNetworkStreams){
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ nsPluginNativeWindowPLATFORM::nsPluginNativeWindowPLATFORM() : nsPluginNativeWin
|
||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
ws_info = nsnull;
|
||||
#endif
|
||||
type = nsPluginWindowType_Window;
|
||||
type = NPWindowTypeWindow;
|
||||
}
|
||||
|
||||
nsPluginNativeWindowPLATFORM::~nsPluginNativeWindowPLATFORM()
|
||||
|
@ -102,7 +102,7 @@ nsPluginNativeWindowGtk2::nsPluginNativeWindowGtk2() : nsPluginNativeWindow()
|
||||
height = 0;
|
||||
memset(&clipRect, 0, sizeof(clipRect));
|
||||
ws_info = &mWsInfo;
|
||||
type = nsPluginWindowType_Window;
|
||||
type = NPWindowTypeWindow;
|
||||
mSocketWidget = 0;
|
||||
mWsInfo.type = 0;
|
||||
mWsInfo.display = nsnull;
|
||||
@ -166,7 +166,7 @@ nsPluginNativeWindowGtk2::plugin_composite_filter_func (GdkXEvent *xevent,
|
||||
XDamageSubtract (GDK_DISPLAY(), native_window->mDamage, None, None);
|
||||
|
||||
/* We try to do our area invalidation here */
|
||||
nsPluginRect rect;
|
||||
NPRect rect;
|
||||
rect.top = ev->area.x;
|
||||
rect.left = ev->area.y;
|
||||
rect.right = ev->area.x + ev->area.width;
|
||||
@ -182,13 +182,12 @@ nsPluginNativeWindowGtk2::plugin_composite_filter_func (GdkXEvent *xevent,
|
||||
nsresult nsPluginNativeWindowGtk2::CallSetWindow(nsCOMPtr<nsIPluginInstance> &aPluginInstance)
|
||||
{
|
||||
if(aPluginInstance) {
|
||||
if (type == nsPluginWindowType_Window) {
|
||||
if (type == NPWindowTypeWindow) {
|
||||
nsresult rv;
|
||||
if(!mSocketWidget) {
|
||||
PRBool needXEmbed = PR_FALSE;
|
||||
if (CanGetValueFromPlugin(aPluginInstance)) {
|
||||
rv = aPluginInstance->GetValue
|
||||
((nsPluginInstanceVariable)NPPVpluginNeedsXEmbed, &needXEmbed);
|
||||
rv = aPluginInstance->GetValueFromPlugin(NPPVpluginNeedsXEmbed, &needXEmbed);
|
||||
#ifdef DEBUG
|
||||
printf("nsPluginNativeWindowGtk2: NPPVpluginNeedsXEmbed=%d\n", needXEmbed);
|
||||
#endif
|
||||
@ -217,16 +216,16 @@ nsresult nsPluginNativeWindowGtk2::CallSetWindow(nsCOMPtr<nsIPluginInstance> &aP
|
||||
if(GTK_IS_XTBIN(mSocketWidget)) {
|
||||
gtk_xtbin_resize(mSocketWidget, width, height);
|
||||
// Point the NPWindow structures window to the actual X window
|
||||
window = (nsPluginPort *)GTK_XTBIN(mSocketWidget)->xtwindow;
|
||||
window = (void*)GTK_XTBIN(mSocketWidget)->xtwindow;
|
||||
}
|
||||
else { // XEmbed
|
||||
SetAllocation();
|
||||
window = (nsPluginPort *)gtk_socket_get_id(GTK_SOCKET(mSocketWidget));
|
||||
window = (void*)gtk_socket_get_id(GTK_SOCKET(mSocketWidget));
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf("nsPluginNativeWindowGtk2: call SetWindow with xid=%p\n", (void *)window);
|
||||
#endif
|
||||
} // nsPluginWindowType_Window
|
||||
} // NPWindowTypeWindow
|
||||
aPluginInstance->SetWindow(this);
|
||||
}
|
||||
else if (mPluginInstance)
|
||||
@ -268,7 +267,7 @@ nsresult nsPluginNativeWindowGtk2::CreateXEmbedWindow() {
|
||||
gtk_widget_show(mSocketWidget);
|
||||
|
||||
gdk_flush();
|
||||
window = (nsPluginPort *)gtk_socket_get_id(GTK_SOCKET(mSocketWidget));
|
||||
window = (void*)gtk_socket_get_id(GTK_SOCKET(mSocketWidget));
|
||||
|
||||
// Fill out the ws_info structure.
|
||||
// (The windowless case is done in nsObjectFrame.cpp.)
|
||||
@ -328,7 +327,7 @@ nsresult nsPluginNativeWindowGtk2::CreateXCompositedWindow() {
|
||||
mPlugWindow = (mSocketWidget);
|
||||
|
||||
gdk_flush();
|
||||
window = (nsPluginPort *)gtk_socket_get_id(GTK_SOCKET(mSocketWidget));
|
||||
window = (void*)gtk_socket_get_id(GTK_SOCKET(mSocketWidget));
|
||||
|
||||
/* This is useful if we still have the plugin window inline
|
||||
* i.e. firefox vs. fennec */
|
||||
|
@ -58,6 +58,15 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsTWeakRef.h"
|
||||
|
||||
#define NP_POPUP_API_VERSION 16
|
||||
|
||||
#define nsMajorVersion(v) (((PRInt32)(v) >> 16) & 0xffff)
|
||||
#define nsMinorVersion(v) ((PRInt32)(v) & 0xffff)
|
||||
#define versionOK(suppliedV, requiredV) \
|
||||
(nsMajorVersion(suppliedV) == nsMajorVersion(requiredV) \
|
||||
&& nsMinorVersion(suppliedV) >= nsMinorVersion(requiredV))
|
||||
|
||||
|
||||
#define NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION TEXT("MozillaPluginWindowPropertyAssociation")
|
||||
#define NS_PLUGIN_CUSTOM_MSG_ID TEXT("MozFlashUserRelay")
|
||||
#define WM_USER_FLASH WM_USER+1
|
||||
@ -345,7 +354,7 @@ static LRESULT CALLBACK PluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
|
||||
if (enablePopups && inst) {
|
||||
PRUint16 apiVersion;
|
||||
if (NS_SUCCEEDED(inst->GetPluginAPIVersion(&apiVersion)) &&
|
||||
!nsVersionOK(apiVersion, NP_POPUP_API_VERSION)) {
|
||||
!versionOK(apiVersion, NP_POPUP_API_VERSION)) {
|
||||
inst->PushPopupsEnabledState(PR_TRUE);
|
||||
}
|
||||
}
|
||||
@ -521,7 +530,7 @@ nsresult nsPluginNativeWindowWin::CallSetWindow(nsCOMPtr<nsIPluginInstance> &aPl
|
||||
|
||||
nsresult nsPluginNativeWindowWin::SubclassAndAssociateWindow()
|
||||
{
|
||||
if (type != nsPluginWindowType_Window)
|
||||
if (type != NPWindowTypeWindow)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
HWND hWnd = (HWND)window;
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include "plstr.h"
|
||||
#include "prmem.h"
|
||||
#include "prprf.h"
|
||||
#include "nsPluginDefs.h"
|
||||
#include "npapi.h"
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
|
@ -364,14 +364,14 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
|
||||
info.fFileName = PL_strdup(fileName.get());
|
||||
|
||||
const char *name = NULL;
|
||||
plugin->GetValue(nsPluginVariable_NameString, &name);
|
||||
plugin->GetValue(NPPVpluginNameString, &name);
|
||||
if (name)
|
||||
info.fName = PL_strdup(name);
|
||||
else
|
||||
info.fName = PL_strdup(fileName.get());
|
||||
|
||||
const char *description = NULL;
|
||||
plugin->GetValue(nsPluginVariable_DescriptionString, &description);
|
||||
plugin->GetValue(NPPVpluginDescriptionString, &description);
|
||||
if (!description)
|
||||
description = "";
|
||||
info.fDescription = PL_strdup(description);
|
||||
|
@ -451,7 +451,8 @@ protected:
|
||||
PRPackedBool mPluginDrawing;
|
||||
PRPackedBool mPluginIsCG; // true if this is a CoreGraphics plugin
|
||||
|
||||
nsPluginPort mPluginPort;
|
||||
NP_CGContext mPluginCGContext;
|
||||
NP_Port mPluginQDPort;
|
||||
nsIPluginInstanceOwner* mPluginInstanceOwner; // [WEAK]
|
||||
|
||||
static PRUint32 sLastInputEventCount;
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsToolkit.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsplugindefs.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
|
||||
@ -1004,7 +1003,10 @@ void* nsChildView::GetNativeData(PRUint32 aDataType)
|
||||
[(ChildView*)mView setIsPluginView:YES];
|
||||
|
||||
UpdatePluginPort();
|
||||
retVal = (void*)&mPluginPort;
|
||||
if (mPluginIsCG)
|
||||
retVal = (void*)&mPluginCGContext;
|
||||
else
|
||||
retVal = (void*)&mPluginQDPort;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1072,7 +1074,7 @@ void nsChildView::HidePlugin()
|
||||
NS_ASSERTION(mIsPluginView, "HidePlugin called on non-plugin view");
|
||||
|
||||
if (mPluginInstanceOwner && !mPluginIsCG) {
|
||||
nsPluginWindow* window;
|
||||
NPWindow* window;
|
||||
mPluginInstanceOwner->GetWindow(window);
|
||||
nsCOMPtr<nsIPluginInstance> instance;
|
||||
mPluginInstanceOwner->GetInstance(*getter_AddRefs(instance));
|
||||
@ -1103,27 +1105,27 @@ void nsChildView::UpdatePluginPort()
|
||||
// (which "provides the graphics context associated with the window
|
||||
// for the current thread") seems always to return the "right"
|
||||
// graphics context. See bug 500130.
|
||||
mPluginPort.cgPort.context = NULL;
|
||||
mPluginPort.cgPort.window = NULL;
|
||||
mPluginCGContext.context = NULL;
|
||||
mPluginCGContext.window = NULL;
|
||||
#ifndef NP_NO_CARBON
|
||||
if ([(ChildView*)mView pluginEventModel] == NPEventModelCarbon) {
|
||||
if (carbonWindow) {
|
||||
mPluginPort.cgPort.context = (CGContextRef)[[cocoaWindow graphicsContext] graphicsPort];
|
||||
mPluginPort.cgPort.window = carbonWindow;
|
||||
mPluginCGContext.context = (CGContextRef)[[cocoaWindow graphicsContext] graphicsPort];
|
||||
mPluginCGContext.window = carbonWindow;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if ([(ChildView*)mView pluginEventModel] == NPEventModelCocoa) {
|
||||
if (cocoaWindow) {
|
||||
mPluginPort.cgPort.context = (CGContextRef)[[cocoaWindow graphicsContext] graphicsPort];
|
||||
mPluginPort.cgPort.window = cocoaWindow;
|
||||
mPluginCGContext.context = (CGContextRef)[[cocoaWindow graphicsContext] graphicsPort];
|
||||
mPluginCGContext.window = cocoaWindow;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifndef NP_NO_QUICKDRAW
|
||||
else {
|
||||
if (carbonWindow) {
|
||||
mPluginPort.qdPort.port = ::GetWindowPort(carbonWindow);
|
||||
mPluginQDPort.port = ::GetWindowPort(carbonWindow);
|
||||
|
||||
NSPoint viewOrigin = [mView convertPoint:NSZeroPoint toView:nil];
|
||||
NSRect frame = [[cocoaWindow contentView] frame];
|
||||
@ -1131,10 +1133,10 @@ void nsChildView::UpdatePluginPort()
|
||||
|
||||
// need to convert view's origin to window coordinates.
|
||||
// then, encode as "SetOrigin" ready values.
|
||||
mPluginPort.qdPort.portx = (PRInt32)-viewOrigin.x;
|
||||
mPluginPort.qdPort.porty = (PRInt32)-viewOrigin.y;
|
||||
mPluginQDPort.portx = (PRInt32)-viewOrigin.x;
|
||||
mPluginQDPort.porty = (PRInt32)-viewOrigin.y;
|
||||
} else {
|
||||
mPluginPort.qdPort.port = NULL;
|
||||
mPluginQDPort.port = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1511,7 +1513,7 @@ NS_IMETHODIMP nsChildView::StartDrawPlugin()
|
||||
// internally (see bug #420527 for details).
|
||||
CGrafPtr port = ::GetWindowPort(WindowRef([window windowRef]));
|
||||
if (!mPluginIsCG)
|
||||
port = mPluginPort.qdPort.port;
|
||||
port = mPluginQDPort.port;
|
||||
|
||||
RgnHandle pluginRegion = ::NewRgn();
|
||||
if (pluginRegion) {
|
||||
|
@ -65,7 +65,7 @@
|
||||
#include "nsIPrefService.h"
|
||||
|
||||
// windowless plugin support
|
||||
#include "nsplugindefs.h"
|
||||
#include "npapi.h"
|
||||
|
||||
#include "nsITimer.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
@ -193,7 +193,7 @@
|
||||
#endif // defined(MOZ_SPLASHSCREEN)
|
||||
|
||||
// Windowless plugin support
|
||||
#include "nsplugindefs.h"
|
||||
#include "npapi.h"
|
||||
|
||||
#include "nsWindowDefs.h"
|
||||
|
||||
@ -2833,7 +2833,7 @@ PRBool nsWindow::DispatchKeyEvent(PRUint32 aEventType, WORD aCharCode,
|
||||
event.isMeta = PR_FALSE;
|
||||
event.isAlt = aModKeyState.mIsAltDown;
|
||||
|
||||
nsPluginEvent pluginEvent;
|
||||
NPEvent pluginEvent;
|
||||
if (aMsg && PluginHasFocus()) {
|
||||
pluginEvent.event = aMsg->message;
|
||||
pluginEvent.wParam = aMsg->wParam;
|
||||
@ -2943,7 +2943,7 @@ PRBool nsWindow::DispatchPluginEvent(const MSG &aMsg)
|
||||
nsGUIEvent event(PR_TRUE, NS_PLUGIN_EVENT, this);
|
||||
nsIntPoint point(0, 0);
|
||||
InitEvent(event, &point);
|
||||
nsPluginEvent pluginEvent;
|
||||
NPEvent pluginEvent;
|
||||
pluginEvent.event = aMsg.message;
|
||||
pluginEvent.wParam = aMsg.wParam;
|
||||
pluginEvent.lParam = aMsg.lParam;
|
||||
@ -3064,7 +3064,7 @@ PRBool nsWindow::DispatchMouseEvent(PRUint32 aEventType, WPARAM wParam,
|
||||
printf("Msg Time: %d Click Count: %d\n", curMsgTime, event.clickCount);
|
||||
#endif
|
||||
|
||||
nsPluginEvent pluginEvent;
|
||||
NPEvent pluginEvent;
|
||||
|
||||
switch (aEventType)
|
||||
{
|
||||
@ -3234,7 +3234,7 @@ PRBool nsWindow::DispatchFocus(PRUint32 aEventType)
|
||||
event.refPoint.x = 0;
|
||||
event.refPoint.y = 0;
|
||||
|
||||
nsPluginEvent pluginEvent;
|
||||
NPEvent pluginEvent;
|
||||
|
||||
switch (aEventType)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user