зеркало из https://github.com/mozilla/pjs.git
Bug 370454, make nsISVGValueObserver inherit nsISupportsWeakReference, r=tor, sr=roc
This commit is contained in:
Родитель
43dd7a3c61
Коммит
ca0febb764
|
@ -40,26 +40,18 @@
|
|||
#ifndef __NS_ISVGVALUEOBSERVER_H__
|
||||
#define __NS_ISVGVALUEOBSERVER_H__
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsISVGValue;
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsISVGValue.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsISVGValueObserver
|
||||
|
||||
/*
|
||||
Implementors of this interface also need to implement
|
||||
nsISupportsWeakReference so that svg-values can store safe owning
|
||||
refs.
|
||||
*/
|
||||
|
||||
// {62fa63b3-d94b-47f3-8dc1-56353a0ee7ff}
|
||||
// {485029a4-2449-45c1-9814-08f38132ca4c}
|
||||
#define NS_ISVGVALUEOBSERVER_IID \
|
||||
{ 0x62fa63b3, 0xd94b, 0x47f3, { 0x8d, 0xc1, 0x56, 0x35, 0x3a, 0xe, 0xe7, 0xff } }
|
||||
{ 0x485029a4, 0x2449, 0x45c1, \
|
||||
{ 0x98, 0x14, 0x08, 0xf3, 0x81, 0x32, 0xca, 0x4c } }
|
||||
|
||||
|
||||
class nsISVGValueObserver : public nsISupports
|
||||
class nsISVGValueObserver : public nsSupportsWeakReference
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISVGVALUEOBSERVER_IID)
|
||||
|
|
|
@ -53,8 +53,7 @@
|
|||
|
||||
class nsSVGAngle : public nsIDOMSVGAngle,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGAngle(nsIDOMSVGAngle** result,
|
||||
|
|
|
@ -1,202 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** 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 the Mozilla SVG project.
|
||||
*
|
||||
* The Initial Developer of the Original Code is IBM Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 "nsSVGValue.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsSVGAnimatedAngle.h"
|
||||
#include "nsSVGLength.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsSVGAnimatedAngle
|
||||
|
||||
class nsSVGAnimatedAngle : public nsIDOMSVGAnimatedAngle,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGAnimatedAngle(nsIDOMSVGAnimatedAngle** result,
|
||||
nsIDOMSVGAngle* baseVal);
|
||||
nsSVGAnimatedAngle();
|
||||
~nsSVGAnimatedAngle();
|
||||
void Init(nsIDOMSVGAngle* baseVal);
|
||||
|
||||
public:
|
||||
// nsISupports interface:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMSVGAnimatedAngle interface:
|
||||
NS_DECL_NSIDOMSVGANIMATEDANGLE
|
||||
|
||||
// remainder of nsISVGValue interface:
|
||||
NS_IMETHOD SetValueString(const nsAString& aValue);
|
||||
NS_IMETHOD GetValueString(nsAString& aValue);
|
||||
|
||||
// nsISVGValueObserver
|
||||
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable,
|
||||
modificationType aModType);
|
||||
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable,
|
||||
modificationType aModType);
|
||||
|
||||
// nsISupportsWeakReference
|
||||
// implementation inherited from nsSupportsWeakReference
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIDOMSVGAngle> mBaseVal;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
nsSVGAnimatedAngle::nsSVGAnimatedAngle()
|
||||
{
|
||||
}
|
||||
|
||||
nsSVGAnimatedAngle::~nsSVGAnimatedAngle()
|
||||
{
|
||||
if (!mBaseVal) return;
|
||||
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
|
||||
if (!val) return;
|
||||
val->RemoveObserver(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGAnimatedAngle::Init(nsIDOMSVGAngle* baseVal)
|
||||
{
|
||||
mBaseVal = baseVal;
|
||||
if (!mBaseVal) return;
|
||||
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
|
||||
NS_ASSERTION(val, "baseval needs to implement nsISVGValue interface");
|
||||
if (!val) return;
|
||||
val->AddObserver(this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods:
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGAnimatedAngle)
|
||||
NS_IMPL_RELEASE(nsSVGAnimatedAngle)
|
||||
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGAnimatedAngle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedAngle)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedAngle)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValue methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedAngle::SetValueString(const nsAString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mBaseVal);
|
||||
return value->SetValueString(aValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedAngle::GetValueString(nsAString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mBaseVal);
|
||||
return value->GetValueString(aValue);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGAnimatedAngle methods:
|
||||
|
||||
/* readonly attribute nsIDOMSVGAngle baseVal; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedAngle::GetBaseVal(nsIDOMSVGAngle * *aBaseVal)
|
||||
{
|
||||
*aBaseVal = mBaseVal;
|
||||
NS_ADDREF(*aBaseVal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAngle animVal; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedAngle::GetAnimVal(nsIDOMSVGAngle * *aAnimVal)
|
||||
{
|
||||
*aAnimVal = mBaseVal;
|
||||
NS_ADDREF(*aAnimVal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValueObserver methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedAngle::WillModifySVGObservable(nsISVGValue* observable,
|
||||
modificationType aModType)
|
||||
{
|
||||
WillModify(aModType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedAngle::DidModifySVGObservable (nsISVGValue* observable,
|
||||
modificationType aModType)
|
||||
{
|
||||
DidModify(aModType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Exported creation functions
|
||||
|
||||
nsresult
|
||||
NS_NewSVGAnimatedAngle(nsIDOMSVGAnimatedAngle** aResult,
|
||||
nsIDOMSVGAngle* baseVal)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
|
||||
nsSVGAnimatedAngle* animatedLength = new nsSVGAnimatedAngle();
|
||||
if(!animatedLength) return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(animatedLength);
|
||||
|
||||
animatedLength->Init(baseVal);
|
||||
|
||||
*aResult = (nsIDOMSVGAnimatedAngle*) animatedLength;
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,210 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** 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 the Mozilla SVG project.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* IBM Corporation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Tim Rowley <tor@acm.org> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 "nsSVGValue.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsSVGAnimatedEnumeration.h"
|
||||
#include "nsISVGEnum.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsSVGAnimatedEnumeration
|
||||
|
||||
class nsSVGAnimatedEnumeration : public nsIDOMSVGAnimatedEnumeration,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGAnimatedEnumeration(nsIDOMSVGAnimatedEnumeration** result,
|
||||
nsISVGEnum* aBaseVal);
|
||||
nsSVGAnimatedEnumeration();
|
||||
~nsSVGAnimatedEnumeration();
|
||||
nsresult Init(nsISVGEnum* aBaseVal);
|
||||
|
||||
public:
|
||||
// nsISupports interface:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMSVGAnimatedEnumeration interface:
|
||||
NS_DECL_NSIDOMSVGANIMATEDENUMERATION
|
||||
|
||||
// remainder of nsISVGValue interface:
|
||||
NS_IMETHOD SetValueString(const nsAString& aValue);
|
||||
NS_IMETHOD GetValueString(nsAString& aValue);
|
||||
|
||||
// nsISVGValueObserver
|
||||
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable,
|
||||
modificationType aModType);
|
||||
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable,
|
||||
modificationType aModType);
|
||||
|
||||
// nsISupportsWeakReference
|
||||
// implementation inherited from nsSupportsWeakReference
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsISVGEnum> mBaseVal;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
nsSVGAnimatedEnumeration::nsSVGAnimatedEnumeration()
|
||||
{
|
||||
}
|
||||
|
||||
nsSVGAnimatedEnumeration::~nsSVGAnimatedEnumeration()
|
||||
{
|
||||
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
|
||||
if (val) val->RemoveObserver(this);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGAnimatedEnumeration::Init(nsISVGEnum* aBaseVal)
|
||||
{
|
||||
mBaseVal = aBaseVal;
|
||||
if (!mBaseVal) return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsISVGValue> val = do_QueryInterface(mBaseVal);
|
||||
NS_ASSERTION(val, "baseval needs to implement nsISVGValue interface");
|
||||
if (!val) return NS_ERROR_FAILURE;
|
||||
val->AddObserver(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods:
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGAnimatedEnumeration)
|
||||
NS_IMPL_RELEASE(nsSVGAnimatedEnumeration)
|
||||
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGAnimatedEnumeration)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGValue)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedEnumeration)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISVGValueObserver)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGAnimatedEnumeration)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISVGValue)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValue methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedEnumeration::SetValueString(const nsAString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mBaseVal);
|
||||
NS_ASSERTION(value, "svg animated enumeration base value has wrong interface!");
|
||||
return value->SetValueString(aValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedEnumeration::GetValueString(nsAString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsISVGValue> value = do_QueryInterface(mBaseVal);
|
||||
NS_ASSERTION(value, "svg animated enumeration base value has wrong interface!");
|
||||
return value->GetValueString(aValue);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGAnimatedEnumeration methods:
|
||||
|
||||
/* attribute unsigned short baseVal; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedEnumeration::GetBaseVal(PRUint16 *aBaseVal)
|
||||
{
|
||||
mBaseVal->GetIntegerValue(*aBaseVal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedEnumeration::SetBaseVal(PRUint16 aBaseVal)
|
||||
{
|
||||
return mBaseVal->SetIntegerValue(aBaseVal);
|
||||
}
|
||||
|
||||
/* readonly attribute unsigned short animVal; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedEnumeration::GetAnimVal(PRUint16 *aAnimVal)
|
||||
{
|
||||
mBaseVal->GetIntegerValue(*aAnimVal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISVGValueObserver methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedEnumeration::WillModifySVGObservable(nsISVGValue* observable,
|
||||
modificationType aModType)
|
||||
{
|
||||
WillModify(aModType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGAnimatedEnumeration::DidModifySVGObservable (nsISVGValue* observable,
|
||||
modificationType aModType)
|
||||
{
|
||||
DidModify(aModType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Exported creation functions
|
||||
|
||||
nsresult
|
||||
NS_NewSVGAnimatedEnumeration(nsIDOMSVGAnimatedEnumeration** aResult,
|
||||
nsISVGEnum* aBaseVal)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
|
||||
nsSVGAnimatedEnumeration* animatedEnum = new nsSVGAnimatedEnumeration();
|
||||
if (!animatedEnum) return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(animatedEnum);
|
||||
|
||||
nsresult rv = animatedEnum->Init(aBaseVal);
|
||||
|
||||
*aResult = (nsIDOMSVGAnimatedEnumeration*) animatedEnum;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
@ -47,8 +47,7 @@
|
|||
|
||||
class nsSVGAnimatedLengthList : public nsIDOMSVGAnimatedLengthList,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
protected:
|
||||
friend nsresult
|
||||
|
|
|
@ -47,8 +47,7 @@
|
|||
|
||||
class nsSVGAnimatedNumberList : public nsIDOMSVGAnimatedNumberList,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
protected:
|
||||
friend nsresult
|
||||
|
|
|
@ -47,8 +47,7 @@
|
|||
|
||||
class nsSVGAnimatedPreserveAspectRatio : public nsIDOMSVGAnimatedPreserveAspectRatio,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGAnimatedPreserveAspectRatio(
|
||||
|
|
|
@ -47,8 +47,7 @@
|
|||
|
||||
class nsSVGAnimatedRect : public nsIDOMSVGAnimatedRect,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGAnimatedRect(nsIDOMSVGAnimatedRect** result,
|
||||
|
|
|
@ -47,8 +47,7 @@
|
|||
|
||||
class nsSVGAnimatedTransformList : public nsIDOMSVGAnimatedTransformList,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
protected:
|
||||
friend nsresult
|
||||
|
|
|
@ -1,123 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** 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 the Mozilla SVG project.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Crocodile Clips Ltd..
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alex Fritze <alex@croczilla.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 __NS_SVGCOORDCTXPROVIDER_H__
|
||||
#define __NS_SVGCOORDCTXPROVIDER_H__
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsSVGCoordCtx.h"
|
||||
#include "nsIDOMSVGRect.h"
|
||||
#include "nsISVGValueObserver.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsSVGCoordCtxHolder: This is a private inner helper class for
|
||||
// nsSVGCoordCtxProvider. It holds the actual coordinate contexts; the
|
||||
// accessors (GetContextX,etc.) on nsSVGCoordCtxProvider are delegated
|
||||
// to it. The sole purpose for having this separate inner class is to
|
||||
// hide the nsISVGValueObserver interface which we require to listen
|
||||
// in on viewbox (mCtxRect) size changes.
|
||||
|
||||
class nsSVGCoordCtxHolder : nsISVGValueObserver,
|
||||
nsSupportsWeakReference
|
||||
{
|
||||
private:
|
||||
friend class nsSVGCoordCtxProvider;
|
||||
nsSVGCoordCtxHolder(); // addrefs
|
||||
~nsSVGCoordCtxHolder();
|
||||
|
||||
// nsISupports interface:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISVGValueObserver interface:
|
||||
NS_IMETHOD WillModifySVGObservable(nsISVGValue* observable,
|
||||
nsISVGValue::modificationType aModType);
|
||||
NS_IMETHOD DidModifySVGObservable (nsISVGValue* observable,
|
||||
nsISVGValue::modificationType aModType);
|
||||
|
||||
void SetContextRect(nsIDOMSVGRect* ctxRect);
|
||||
void SetMMPerPx(float mmPerPxX, float mmPerPxY);
|
||||
|
||||
void Update();
|
||||
|
||||
already_AddRefed<nsSVGCoordCtx> GetContextX();
|
||||
already_AddRefed<nsSVGCoordCtx> GetContextY();
|
||||
already_AddRefed<nsSVGCoordCtx> GetContextUnspecified();
|
||||
|
||||
nsCOMPtr<nsIDOMSVGRect> mCtxRect;
|
||||
nsRefPtr<nsSVGCoordCtx> mCtxX;
|
||||
nsRefPtr<nsSVGCoordCtx> mCtxY;
|
||||
nsRefPtr<nsSVGCoordCtx> mCtxUnspec;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// pseudo interface nsSVGCoordCtxProvider
|
||||
|
||||
// {0C083184-4462-4B5D-B925-0BEC5A7E6779}
|
||||
#define NS_SVGCOORDCTXPROVIDER_IID \
|
||||
{ 0x0c083184, 0x4462, 0x4b5d, { 0xb9, 0x25, 0x0b, 0xec, 0x5a, 0x7e, 0x67, 0x79 } }
|
||||
|
||||
class nsSVGCoordCtxProvider : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_SVGCOORDCTXPROVIDER_IID)
|
||||
|
||||
nsSVGCoordCtxProvider() : mInner(new nsSVGCoordCtxHolder) {}
|
||||
|
||||
already_AddRefed<nsSVGCoordCtx> GetContextX() { return mInner ? mInner->GetContextX() : nsnull; }
|
||||
already_AddRefed<nsSVGCoordCtx> GetContextY() { return mInner ? mInner->GetContextY() : nsnull; }
|
||||
already_AddRefed<nsSVGCoordCtx> GetContextUnspecified() { return mInner ? mInner->GetContextUnspecified() : nsnull; }
|
||||
|
||||
already_AddRefed<nsSVGCoordCtx> GetCtxByType(PRUint16 aCtxType);
|
||||
|
||||
protected:
|
||||
void SetCoordCtxRect(nsIDOMSVGRect* ctxRect) { if(mInner) mInner->SetContextRect(ctxRect); }
|
||||
void SetCoordCtxMMPerPx(float mmPerPxX, float mmPerPxY) {
|
||||
if(mInner)
|
||||
mInner->SetMMPerPx(mmPerPxX, mmPerPxY);
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<nsSVGCoordCtxHolder> mInner;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsSVGCoordCtxProvider,
|
||||
NS_SVGCOORDCTXPROVIDER_IID)
|
||||
|
||||
#endif // __NS_SVGCOORDCTXPROVIDER_H__
|
|
@ -58,8 +58,7 @@ class nsSVGLength2;
|
|||
class nsSVGNumber2;
|
||||
|
||||
class nsSVGElement : public nsGenericElement, // nsIContent
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference // :nsISupportsWeakReference
|
||||
public nsISVGValueObserver // :nsISupportsWeakReference
|
||||
{
|
||||
protected:
|
||||
nsSVGElement(nsINodeInfo *aNodeInfo);
|
||||
|
|
|
@ -55,8 +55,7 @@
|
|||
|
||||
class nsSVGLength : public nsISVGLength,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGLength(nsISVGLength** result,
|
||||
|
|
|
@ -53,8 +53,7 @@
|
|||
|
||||
class nsSVGLengthList : public nsISVGLengthList,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGLengthList(nsISVGLengthList** result);
|
||||
|
|
|
@ -53,8 +53,7 @@
|
|||
|
||||
class nsSVGNumberList : public nsIDOMSVGNumberList,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGNumberList(nsIDOMSVGNumberList** result);
|
||||
|
|
|
@ -52,8 +52,7 @@
|
|||
|
||||
class nsSVGPathSegList : public nsIDOMSVGPathSegList,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGPathSegList(nsIDOMSVGPathSegList** result);
|
||||
|
|
|
@ -48,8 +48,7 @@
|
|||
|
||||
class nsSVGPointList : public nsSVGValue,
|
||||
public nsIDOMSVGPointList,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
public:
|
||||
static nsresult Create(const nsAString& aValue, nsISVGValue** aResult);
|
||||
|
|
|
@ -57,8 +57,7 @@
|
|||
|
||||
|
||||
class nsSVGStringProxyValue : public nsSVGValue,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
protected:
|
||||
friend nsresult
|
||||
|
|
|
@ -54,8 +54,7 @@
|
|||
|
||||
class nsSVGTransform : public nsIDOMSVGTransform,
|
||||
public nsSVGValue,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
public:
|
||||
static nsresult Create(nsIDOMSVGTransform** aResult);
|
||||
|
|
|
@ -47,8 +47,7 @@
|
|||
|
||||
class nsSVGTransformList : public nsSVGValue,
|
||||
public nsIDOMSVGTransformList,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
public:
|
||||
static nsresult Create(nsIDOMSVGTransformList** aResult);
|
||||
|
|
|
@ -53,8 +53,7 @@ typedef nsFrame nsSVGGeometryFrameBase;
|
|||
* servers. */
|
||||
|
||||
class nsSVGGeometryFrame : public nsSVGGeometryFrameBase,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
public:
|
||||
nsSVGGeometryFrame(nsStyleContext *aContext);
|
||||
|
|
|
@ -51,8 +51,7 @@ class nsIDOMSVGStopElement;
|
|||
typedef nsSVGPaintServerFrame nsSVGGradientFrameBase;
|
||||
|
||||
class nsSVGGradientFrame : public nsSVGGradientFrameBase,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
public:
|
||||
// nsSVGPaintServerFrame methods:
|
||||
|
|
|
@ -50,7 +50,6 @@ typedef nsSVGDisplayContainerFrame nsSVGInnerSVGFrameBase;
|
|||
|
||||
class nsSVGInnerSVGFrame : public nsSVGInnerSVGFrameBase,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference,
|
||||
public nsISVGSVGFrame
|
||||
{
|
||||
friend nsIFrame*
|
||||
|
|
|
@ -54,8 +54,7 @@ class gfxContext;
|
|||
typedef nsSVGPaintServerFrame nsSVGPatternFrameBase;
|
||||
|
||||
class nsSVGPatternFrame : public nsSVGPatternFrameBase,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
public:
|
||||
friend nsIFrame* NS_NewSVGPatternFrame(nsIPresShell* aPresShell,
|
||||
|
|
|
@ -50,8 +50,7 @@ class nsSVGFlattenedPath;
|
|||
typedef nsSVGTSpanFrame nsSVGTextPathFrameBase;
|
||||
|
||||
class nsSVGTextPathFrame : public nsSVGTextPathFrameBase,
|
||||
public nsISVGValueObserver,
|
||||
public nsSupportsWeakReference
|
||||
public nsISVGValueObserver
|
||||
{
|
||||
public:
|
||||
nsSVGTextPathFrame(nsStyleContext* aContext) : nsSVGTextPathFrameBase(aContext) {}
|
||||
|
|
Загрузка…
Ссылка в новой задаче