Get rid of nsIWindowlessPluginInstancePeer. b=500672 r/sr=jst

This commit is contained in:
Josh Aas 2009-06-26 13:30:36 -04:00
parent c773b6331b
commit 63a294b7fb
11 changed files with 66 additions and 139 deletions

View File

@ -71,7 +71,6 @@ XPIDLSRCS = \
nsIPluginInstanceOwner.idl \
nsIPlugin.idl \
nsIHTTPHeaderListener.idl \
nsIWindowlessPlugInstPeer.idl \
nsIPluginTag.idl \
nsIPluginTagInfo.idl \
nsIPluginTagInfo2.idl \

View File

@ -145,4 +145,19 @@ interface nsIPluginInstance : nsISupports
* @result - NS_OK if this operation was successful
*/
void handleEvent(in nsPluginEventPtr aEvent, out boolean aHandled);
/**
* Corresponds to NPN_InvalidateRect
*/
void invalidateRect(in nsPluginRectPtr aRect);
/**
* Corresponds to NPN_InvalidateRegion
*/
void invalidateRegion(in nsPluginRegion aRegion);
/**
* Corresponds to NPN_ForceRedraw
*/
void forceRedraw();
};

View File

@ -1,62 +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 ***** */
#include "nsISupports.idl"
#include "nspluginroot.idl"
%{C++
#include "nsplugindefs.h"
%}
[uuid(57b4e2f0-019b-11d2-815b-006008119d7a)]
interface nsIWindowlessPluginInstancePeer : nsISupports
{
/**
* Corresponds to NPN_InvalidateRect
*/
void invalidateRect(in nsPluginRectPtr aRect);
/**
* Corresponds to NPN_InvalidateRegion
*/
void invalidateRegion(in nsPluginRegion aRegion);
/**
* Corresponds to NPN_ForceRedraw
*/
void forceRedraw();
};

View File

@ -128,14 +128,6 @@
*/
#include "nsIPluginTagInfo.h"
/**
* The nsIWindowlessPluginInstancePeer provides additional operations for
* windowless plugins.
*
* To obtain: QueryInterface on nsIPluginInstancePeer
*/
#include "nsIWindowlessPlugInstPeer.h"
////////////////////////////////////////////////////////////////////////////////
/**
* <B>Interfaces implemented by the browser (new for 5.0):

View File

@ -399,7 +399,6 @@ class nsIPluginInstance; // plugin instance
// Classes that are implemented by the browser:
class nsIPluginInstancePeer; // parts of nsIPluginInstance implemented by the browser
class nsIWindowlessPluginInstancePeer; // subclass of nsIPluginInstancePeer for windowless plugins
class nsIPluginTagInfo; // describes html tag (accessible from nsIPluginInstancePeer)
////////////////////////////////////////////////////////////////////////////////

View File

@ -1070,14 +1070,7 @@ _invalidaterect(NPP npp, NPRect *invalidRect)
PluginDestructionGuard guard(inst);
nsCOMPtr<nsIPluginInstancePeer> peer;
if (NS_SUCCEEDED(inst->GetPeer(getter_AddRefs(peer))) && peer) {
nsCOMPtr<nsIWindowlessPluginInstancePeer> wpeer(do_QueryInterface(peer));
if (wpeer) {
// XXX nsRect & NPRect are structurally equivalent
wpeer->InvalidateRect((nsPluginRect *)invalidRect);
}
}
inst->InvalidateRect((nsPluginRect *)invalidRect);
}
void NP_CALLBACK
@ -1100,14 +1093,7 @@ _invalidateregion(NPP npp, NPRegion invalidRegion)
PluginDestructionGuard guard(inst);
nsCOMPtr<nsIPluginInstancePeer> peer;
if (NS_SUCCEEDED(inst->GetPeer(getter_AddRefs(peer))) && peer) {
nsCOMPtr<nsIWindowlessPluginInstancePeer> wpeer(do_QueryInterface(peer));
if (wpeer) {
// nsPluginRegion & NPRegion are typedef'd to the same thing
wpeer->InvalidateRegion((nsPluginRegion)invalidRegion);
}
}
inst->InvalidateRegion((nsPluginRegion)invalidRegion);
}
void NP_CALLBACK
@ -1128,13 +1114,7 @@ _forceredraw(NPP npp)
PluginDestructionGuard guard(inst);
nsCOMPtr<nsIPluginInstancePeer> peer;
if (NS_SUCCEEDED(inst->GetPeer(getter_AddRefs(peer))) && peer) {
nsCOMPtr<nsIWindowlessPluginInstancePeer> wpeer(do_QueryInterface(peer));
if (wpeer) {
wpeer->ForceRedraw();
}
}
inst->ForceRedraw();
}
static nsIDocument *

View File

@ -41,7 +41,6 @@
#include "nsIFactory.h"
#include "nsIPlugin.h"
#include "nsIPluginInstancePeer.h"
#include "nsIWindowlessPlugInstPeer.h"
#include "prlink.h"
#include "npfunctions.h"
#include "nsPluginHostImpl.h"

View File

@ -1459,3 +1459,48 @@ nsresult nsNPAPIPluginInstance::PrivateModeStateChanged()
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsNPAPIPluginInstance::InvalidateRect(nsPluginRect *invalidRect)
{
nsCOMPtr<nsPIPluginInstancePeer> pp (do_QueryInterface(mPeer));
if (!pp)
return nsnull;
nsCOMPtr<nsIPluginInstanceOwner> owner;
pp->GetOwner(getter_AddRefs(owner));
if (!owner)
return NS_ERROR_FAILURE;
return owner->InvalidateRect(invalidRect);
}
NS_IMETHODIMP
nsNPAPIPluginInstance::InvalidateRegion(nsPluginRegion invalidRegion)
{
nsCOMPtr<nsPIPluginInstancePeer> pp (do_QueryInterface(mPeer));
if (!pp)
return nsnull;
nsCOMPtr<nsIPluginInstanceOwner> owner;
pp->GetOwner(getter_AddRefs(owner));
if (!owner)
return NS_ERROR_FAILURE;
return owner->InvalidateRegion(invalidRegion);
}
NS_IMETHODIMP
nsNPAPIPluginInstance::ForceRedraw()
{
nsCOMPtr<nsPIPluginInstancePeer> pp (do_QueryInterface(mPeer));
if (!pp)
return nsnull;
nsCOMPtr<nsIPluginInstanceOwner> owner;
pp->GetOwner(getter_AddRefs(owner));
if (!owner)
return NS_ERROR_FAILURE;
return owner->ForceRedraw();
}

View File

@ -77,11 +77,10 @@ nsPluginInstancePeerImpl::~nsPluginInstancePeerImpl()
static NS_DEFINE_IID(kIPluginTagInfoIID, NS_IPLUGINTAGINFO_IID);
static NS_DEFINE_IID(kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID);
NS_IMPL_ISUPPORTS7(nsPluginInstancePeerImpl,
NS_IMPL_ISUPPORTS6(nsPluginInstancePeerImpl,
nsIPluginInstancePeer,
nsIPluginInstancePeer2,
nsIPluginInstancePeer3,
nsIWindowlessPluginInstancePeer,
nsIPluginTagInfo,
nsIPluginTagInfo2,
nsPIPluginInstancePeer)
@ -751,30 +750,3 @@ nsPluginInstancePeerImpl::GetOwner(nsIPluginInstanceOwner **aOwner)
NS_IF_ADDREF(mOwner);
return (mOwner) ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsPluginInstancePeerImpl::InvalidateRect(nsPluginRect *invalidRect)
{
if(!mOwner)
return NS_ERROR_FAILURE;
return mOwner->InvalidateRect(invalidRect);
}
NS_IMETHODIMP
nsPluginInstancePeerImpl::InvalidateRegion(nsPluginRegion invalidRegion)
{
if(!mOwner)
return NS_ERROR_FAILURE;
return mOwner->InvalidateRegion(invalidRegion);
}
NS_IMETHODIMP
nsPluginInstancePeerImpl::ForceRedraw(void)
{
if(!mOwner)
return NS_ERROR_FAILURE;
return mOwner->ForceRedraw();
}

View File

@ -39,7 +39,6 @@
#define nsPluginInstancePeer_h_
#include "nsIPluginInstancePeer2.h"
#include "nsIWindowlessPlugInstPeer.h"
#include "nsIPluginTagInfo2.h"
#include "nsIPluginInstanceOwner.h"
#include "nsPIPluginInstancePeer.h"
@ -47,7 +46,6 @@
#include "nsCOMPtr.h"
class nsPluginInstancePeerImpl : public nsIPluginInstancePeer3,
public nsIWindowlessPluginInstancePeer,
public nsIPluginTagInfo2,
public nsPIPluginInstancePeer
@ -58,7 +56,6 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPLUGININSTANCEPEER
NS_DECL_NSIWINDOWLESSPLUGININSTANCEPEER
NS_DECL_NSIPLUGININSTANCEPEER2
NS_DECL_NSIPLUGININSTANCEPEER3
NS_DECL_NSIPLUGINTAGINFO

View File

@ -174,17 +174,8 @@ nsPluginNativeWindowGtk2::plugin_composite_filter_func (GdkXEvent *xevent,
rect.right = ev->area.x + ev->area.width;
rect.bottom = ev->area.y + ev->area.height;
/* There might be a better way to do this? */
if (native_window->mPluginInstance) {
nsCOMPtr<nsIPluginInstancePeer> peer;
if (NS_SUCCEEDED(native_window->mPluginInstance->GetPeer(getter_AddRefs(peer))) && peer) {
nsCOMPtr<nsIWindowlessPluginInstancePeer> wpeer(do_QueryInterface(peer));
if (wpeer) {
// XXX nsRect & NPRect are structurally equivalent
wpeer->InvalidateRect(&rect);
}
}
}
if (native_window->mPluginInstance)
native_window->mPluginInstance->InvalidateRect(&rect);
return GDK_FILTER_REMOVE;
}