зеркало из https://github.com/mozilla/gecko-dev.git
Bug 866796 - Convert SVGAnimatedRect to WebIDL. r=Ms2ger
This commit is contained in:
Родитель
eca9fedd98
Коммит
da5e259b0e
|
@ -59,6 +59,7 @@ CPPSRCS = \
|
|||
SVGAnimatedPathSegList.cpp \
|
||||
SVGAnimatedPointList.cpp \
|
||||
SVGAnimatedPreserveAspectRatio.cpp \
|
||||
SVGAnimatedRect.cpp \
|
||||
SVGAnimatedTransformList.cpp \
|
||||
SVGAnimateElement.cpp \
|
||||
SVGAnimateTransformElement.cpp \
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "SVGAnimatedRect.h"
|
||||
#include "mozilla/dom/SVGAnimatedRectBinding.h"
|
||||
#include "nsSVGElement.h"
|
||||
#include "nsSVGViewBox.h"
|
||||
#include "SVGIRect.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SVGAnimatedRect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(SVGAnimatedRect, mSVGElement)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(SVGAnimatedRect)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(SVGAnimatedRect)
|
||||
|
||||
SVGAnimatedRect::SVGAnimatedRect(nsSVGViewBox* aVal, nsSVGElement* aSVGElement)
|
||||
: mVal(aVal)
|
||||
, mSVGElement(aSVGElement)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
SVGAnimatedRect::~SVGAnimatedRect()
|
||||
{
|
||||
nsSVGViewBox::sSVGAnimatedRectTearoffTable.RemoveTearoff(mVal);
|
||||
}
|
||||
|
||||
already_AddRefed<SVGIRect>
|
||||
SVGAnimatedRect::GetBaseVal(ErrorResult& aRv)
|
||||
{
|
||||
nsRefPtr<SVGIRect> rect;
|
||||
aRv = mVal->ToDOMBaseVal(getter_AddRefs(rect), mSVGElement);
|
||||
return rect.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<SVGIRect>
|
||||
SVGAnimatedRect::GetAnimVal(ErrorResult& aRv)
|
||||
{
|
||||
nsRefPtr<SVGIRect> rect;
|
||||
aRv = mVal->ToDOMAnimVal(getter_AddRefs(rect), mSVGElement);
|
||||
return rect.forget();
|
||||
}
|
||||
|
||||
JSObject*
|
||||
SVGAnimatedRect::WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope)
|
||||
{
|
||||
return SVGAnimatedRectBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,53 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_SVGAnimatedRect_h
|
||||
#define mozilla_dom_SVGAnimatedRect_h
|
||||
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "mozilla/dom/SVGRectBinding.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsSVGElement;
|
||||
class nsSVGViewBox;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class SVGAnimatedRect MOZ_FINAL : public nsISupports,
|
||||
public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(SVGAnimatedRect)
|
||||
|
||||
SVGAnimatedRect(nsSVGViewBox* aVal, nsSVGElement* aSVGElement);
|
||||
|
||||
virtual ~SVGAnimatedRect();
|
||||
|
||||
nsSVGElement* GetParentObject() const
|
||||
{
|
||||
return mSVGElement;
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
|
||||
already_AddRefed<SVGIRect> GetBaseVal(ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<SVGIRect> GetAnimVal(ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
nsSVGViewBox* mVal; // kept alive because it belongs to content
|
||||
nsRefPtr<nsSVGElement> mSVGElement;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_SVGAnimatedRect_h
|
||||
|
|
@ -12,18 +12,38 @@
|
|||
#include "mozilla/dom/SVGRectBinding.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
class nsSVGElement;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class SVGIRect : public nsIDOMSVGRect
|
||||
class SVGIRect : public nsIDOMSVGRect,
|
||||
public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
SVGIRect(nsIContent* aParent)
|
||||
: mParent(aParent)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
virtual ~SVGIRect()
|
||||
{
|
||||
}
|
||||
|
||||
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
{
|
||||
return SVGRectBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
nsIContent* GetParentObject() const
|
||||
{
|
||||
return mParent;
|
||||
}
|
||||
|
||||
virtual float X() const = 0;
|
||||
|
||||
NS_IMETHOD GetX(float *aX) MOZ_OVERRIDE MOZ_FINAL
|
||||
|
@ -99,6 +119,9 @@ public:
|
|||
SetHeight(aHeight, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIContent> mParent;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -106,10 +106,10 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGMarkerElement)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedRect>
|
||||
already_AddRefed<SVGAnimatedRect>
|
||||
SVGMarkerElement::ViewBox()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGAnimatedRect> rect;
|
||||
nsRefPtr<SVGAnimatedRect> rect;
|
||||
mViewBox.ToDOMAnimatedRect(getter_AddRefs(rect), this);
|
||||
return rect.forget();
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ public:
|
|||
nsSVGOrientType* GetOrientType() { return &mOrientType; }
|
||||
|
||||
// WebIDL
|
||||
already_AddRefed<nsIDOMSVGAnimatedRect> ViewBox();
|
||||
already_AddRefed<SVGAnimatedRect> ViewBox();
|
||||
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
|
||||
already_AddRefed<SVGAnimatedLength> RefX();
|
||||
already_AddRefed<SVGAnimatedLength> RefY();
|
||||
|
|
|
@ -64,10 +64,10 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPatternElement)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedRect>
|
||||
already_AddRefed<SVGAnimatedRect>
|
||||
SVGPatternElement::ViewBox()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGAnimatedRect> rect;
|
||||
nsRefPtr<SVGAnimatedRect> rect;
|
||||
mViewBox.ToDOMAnimatedRect(getter_AddRefs(rect), this);
|
||||
return rect.forget();
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
}
|
||||
|
||||
// WebIDL
|
||||
already_AddRefed<nsIDOMSVGAnimatedRect> ViewBox();
|
||||
already_AddRefed<SVGAnimatedRect> ViewBox();
|
||||
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
|
||||
already_AddRefed<nsIDOMSVGAnimatedEnumeration> PatternUnits();
|
||||
already_AddRefed<nsIDOMSVGAnimatedEnumeration> PatternContentUnits();
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "mozilla/dom/SVGRect.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsSVGElement.h"
|
||||
|
||||
DOMCI_DATA(SVGRect, mozilla::dom::SVGRect)
|
||||
|
||||
|
@ -15,8 +16,8 @@ namespace dom {
|
|||
//----------------------------------------------------------------------
|
||||
// implementation:
|
||||
|
||||
SVGRect::SVGRect(float x, float y, float w, float h)
|
||||
: mX(x), mY(y), mWidth(w), mHeight(h)
|
||||
SVGRect::SVGRect(nsIContent* aParent, float x, float y, float w, float h)
|
||||
: SVGIRect(aParent), mX(x), mY(y), mWidth(w), mHeight(h)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -39,18 +40,19 @@ NS_INTERFACE_MAP_END
|
|||
// Exported creation functions:
|
||||
|
||||
already_AddRefed<mozilla::dom::SVGRect>
|
||||
NS_NewSVGRect(float x, float y, float width, float height)
|
||||
NS_NewSVGRect(nsIContent* aParent, float aX, float aY, float aWidth,
|
||||
float aHeight)
|
||||
{
|
||||
nsRefPtr<mozilla::dom::SVGRect> rect =
|
||||
new mozilla::dom::SVGRect(x, y, width, height);
|
||||
new mozilla::dom::SVGRect(aParent, aX, aY, aWidth, aHeight);
|
||||
|
||||
return rect.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<mozilla::dom::SVGRect>
|
||||
NS_NewSVGRect(const gfxRect& rect)
|
||||
NS_NewSVGRect(nsIContent* aParent, const gfxRect& aRect)
|
||||
{
|
||||
return NS_NewSVGRect(rect.X(), rect.Y(),
|
||||
rect.Width(), rect.Height());
|
||||
return NS_NewSVGRect(aParent, aRect.X(), aRect.Y(),
|
||||
aRect.Width(), aRect.Height());
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "gfxRect.h"
|
||||
#include "mozilla/dom/SVGIRect.h"
|
||||
#include "nsSVGElement.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// SVGRect class
|
||||
|
@ -18,7 +19,8 @@ namespace dom {
|
|||
class SVGRect MOZ_FINAL : public SVGIRect
|
||||
{
|
||||
public:
|
||||
SVGRect(float x=0.0f, float y=0.0f, float w=0.0f, float h=0.0f);
|
||||
SVGRect(nsIContent* aParent, float x=0.0f, float y=0.0f, float w=0.0f,
|
||||
float h=0.0f);
|
||||
|
||||
// nsISupports interface:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -77,9 +79,10 @@ protected:
|
|||
} // namespace mozilla
|
||||
|
||||
already_AddRefed<mozilla::dom::SVGRect>
|
||||
NS_NewSVGRect(float x=0.0f, float y=0.0f, float width=0.0f, float height=0.0f);
|
||||
NS_NewSVGRect(nsIContent* aParent, float x=0.0f, float y=0.0f,
|
||||
float width=0.0f, float height=0.0f);
|
||||
|
||||
already_AddRefed<mozilla::dom::SVGRect>
|
||||
NS_NewSVGRect(const gfxRect& rect);
|
||||
NS_NewSVGRect(nsIContent* aParent, const gfxRect& rect);
|
||||
|
||||
#endif //mozilla_dom_SVGRect_h
|
||||
|
|
|
@ -411,7 +411,7 @@ SVGSVGElement::CreateSVGMatrix()
|
|||
already_AddRefed<SVGIRect>
|
||||
SVGSVGElement::CreateSVGRect()
|
||||
{
|
||||
return NS_NewSVGRect();
|
||||
return NS_NewSVGRect(this);
|
||||
}
|
||||
|
||||
already_AddRefed<SVGTransform>
|
||||
|
@ -442,10 +442,10 @@ SVGSVGElement::GetElementById(const nsAString& elementId, ErrorResult& rv)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedRect>
|
||||
already_AddRefed<SVGAnimatedRect>
|
||||
SVGSVGElement::ViewBox()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGAnimatedRect> rect;
|
||||
nsRefPtr<SVGAnimatedRect> rect;
|
||||
mViewBox.ToDOMAnimatedRect(getter_AddRefs(rect), this);
|
||||
return rect.forget();
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ class AutoSVGRenderingState;
|
|||
|
||||
namespace dom {
|
||||
class SVGAngle;
|
||||
class SVGAnimatedRect;
|
||||
class SVGMatrix;
|
||||
class SVGTransform;
|
||||
class SVGViewElement;
|
||||
|
@ -245,7 +246,7 @@ public:
|
|||
already_AddRefed<SVGTransform> CreateSVGTransform();
|
||||
already_AddRefed<SVGTransform> CreateSVGTransformFromMatrix(SVGMatrix& matrix);
|
||||
Element* GetElementById(const nsAString& elementId, ErrorResult& rv);
|
||||
already_AddRefed<nsIDOMSVGAnimatedRect> ViewBox();
|
||||
already_AddRefed<SVGAnimatedRect> ViewBox();
|
||||
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
|
||||
uint16_t ZoomAndPan();
|
||||
void SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv);
|
||||
|
|
|
@ -40,10 +40,10 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGSymbolElement)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedRect>
|
||||
already_AddRefed<SVGAnimatedRect>
|
||||
SVGSymbolElement::ViewBox()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGAnimatedRect> rect;
|
||||
nsRefPtr<SVGAnimatedRect> rect;
|
||||
mViewBox.ToDOMAnimatedRect(getter_AddRefs(rect), this);
|
||||
return rect.forget();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
// WebIDL
|
||||
already_AddRefed<nsIDOMSVGAnimatedRect> ViewBox();
|
||||
already_AddRefed<SVGAnimatedRect> ViewBox();
|
||||
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -173,7 +173,7 @@ SVGTransformableElement::GetBBox(ErrorResult& rv)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return NS_NewSVGRect(nsSVGUtils::GetBBox(frame));
|
||||
return NS_NewSVGRect(this, nsSVGUtils::GetBBox(frame));
|
||||
}
|
||||
|
||||
already_AddRefed<SVGMatrix>
|
||||
|
|
|
@ -64,10 +64,10 @@ SVGViewElement::SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedRect>
|
||||
already_AddRefed<SVGAnimatedRect>
|
||||
SVGViewElement::ViewBox()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGAnimatedRect> box;
|
||||
nsRefPtr<SVGAnimatedRect> box;
|
||||
mViewBox.ToDOMAnimatedRect(getter_AddRefs(box), this);
|
||||
return box.forget();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
// WebIDL
|
||||
uint16_t ZoomAndPan() { return mEnumAttributes[ZOOMANDPAN].GetAnimValue(); }
|
||||
void SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv);
|
||||
already_AddRefed<nsIDOMSVGAnimatedRect> ViewBox();
|
||||
already_AddRefed<SVGAnimatedRect> ViewBox();
|
||||
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
|
||||
already_AddRefed<DOMSVGStringList> ViewTarget();
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ EXPORTS.mozilla.dom += [
|
|||
'SVGAnimatedAngle.h',
|
||||
'SVGAnimatedBoolean.h',
|
||||
'SVGAnimatedLength.h',
|
||||
'SVGAnimatedRect.h',
|
||||
'SVGAnimatedTransformList.h',
|
||||
'SVGAnimationElement.h',
|
||||
'SVGCircleElement.h',
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsMathUtils.h"
|
||||
#include "nsSMILValue.h"
|
||||
#include "nsSVGAttrTearoffTable.h"
|
||||
#include "SVGContentUtils.h"
|
||||
#include "SVGViewBoxSMILType.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
|
@ -37,7 +36,6 @@ nsSVGViewBoxRect::operator==(const nsSVGViewBoxRect& aOther) const
|
|||
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGViewBox::DOMBaseVal, mSVGElement)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGViewBox::DOMAnimVal, mSVGElement)
|
||||
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGViewBox::DOMAnimatedRect, mSVGElement)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGViewBox::DOMBaseVal)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGViewBox::DOMBaseVal)
|
||||
|
@ -45,9 +43,6 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGViewBox::DOMBaseVal)
|
|||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGViewBox::DOMAnimVal)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGViewBox::DOMAnimVal)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGViewBox::DOMAnimatedRect)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGViewBox::DOMAnimatedRect)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGViewBox::DOMBaseVal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGRect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
|
@ -60,20 +55,12 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGViewBox::DOMAnimVal)
|
|||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGRect)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
DOMCI_DATA(SVGAnimatedRect, nsSVGViewBox::DOMAnimatedRect)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGViewBox::DOMAnimatedRect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedRect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGAnimatedRect)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
static nsSVGAttrTearoffTable<nsSVGViewBox, nsSVGViewBox::DOMAnimatedRect>
|
||||
sSVGAnimatedRectTearoffTable;
|
||||
static nsSVGAttrTearoffTable<nsSVGViewBox, nsSVGViewBox::DOMBaseVal>
|
||||
sBaseSVGViewBoxTearoffTable;
|
||||
static nsSVGAttrTearoffTable<nsSVGViewBox, nsSVGViewBox::DOMAnimVal>
|
||||
sAnimSVGViewBoxTearoffTable;
|
||||
nsSVGAttrTearoffTable<nsSVGViewBox, mozilla::dom::SVGAnimatedRect>
|
||||
nsSVGViewBox::sSVGAnimatedRectTearoffTable;
|
||||
|
||||
|
||||
/* Implementation of nsSVGViewBox methods */
|
||||
|
@ -214,13 +201,13 @@ nsSVGViewBox::GetBaseValueString(nsAString& aValue) const
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsSVGViewBox::ToDOMAnimatedRect(nsIDOMSVGAnimatedRect **aResult,
|
||||
nsSVGViewBox::ToDOMAnimatedRect(dom::SVGAnimatedRect **aResult,
|
||||
nsSVGElement* aSVGElement)
|
||||
{
|
||||
nsRefPtr<DOMAnimatedRect> domAnimatedRect =
|
||||
nsRefPtr<dom::SVGAnimatedRect> domAnimatedRect =
|
||||
sSVGAnimatedRectTearoffTable.GetTearoff(this);
|
||||
if (!domAnimatedRect) {
|
||||
domAnimatedRect = new DOMAnimatedRect(this, aSVGElement);
|
||||
domAnimatedRect = new dom::SVGAnimatedRect(this, aSVGElement);
|
||||
sSVGAnimatedRectTearoffTable.AddTearoff(this, domAnimatedRect);
|
||||
}
|
||||
|
||||
|
@ -228,13 +215,9 @@ nsSVGViewBox::ToDOMAnimatedRect(nsIDOMSVGAnimatedRect **aResult,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsSVGViewBox::DOMAnimatedRect::~DOMAnimatedRect()
|
||||
{
|
||||
sSVGAnimatedRectTearoffTable.RemoveTearoff(mVal);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGViewBox::ToDOMBaseVal(nsIDOMSVGRect **aResult, nsSVGElement *aSVGElement)
|
||||
nsSVGViewBox::ToDOMBaseVal(dom::SVGIRect **aResult,
|
||||
nsSVGElement *aSVGElement)
|
||||
{
|
||||
if (!mHasBaseVal || mBaseVal.none) {
|
||||
*aResult = nullptr;
|
||||
|
@ -257,7 +240,8 @@ nsSVGViewBox::DOMBaseVal::~DOMBaseVal()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsSVGViewBox::ToDOMAnimVal(nsIDOMSVGRect **aResult, nsSVGElement *aSVGElement)
|
||||
nsSVGViewBox::ToDOMAnimVal(dom::SVGIRect **aResult,
|
||||
nsSVGElement *aSVGElement)
|
||||
{
|
||||
if ((mAnimVal && mAnimVal->none) ||
|
||||
(!mAnimVal && (!mHasBaseVal || mBaseVal.none))) {
|
||||
|
|
|
@ -9,11 +9,12 @@
|
|||
#include "nsAutoPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIDOMSVGAnimatedRect.h"
|
||||
#include "mozilla/dom/SVGAnimatedRect.h"
|
||||
#include "mozilla/dom/SVGIRect.h"
|
||||
#include "nsISMILAttr.h"
|
||||
#include "nsSVGElement.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsSVGAttrTearoffTable.h"
|
||||
|
||||
class nsSMILValue;
|
||||
|
||||
|
@ -79,10 +80,12 @@ public:
|
|||
bool aDoSetAttr);
|
||||
void GetBaseValueString(nsAString& aValue) const;
|
||||
|
||||
nsresult ToDOMAnimatedRect(nsIDOMSVGAnimatedRect **aResult,
|
||||
nsresult ToDOMAnimatedRect(mozilla::dom::SVGAnimatedRect **aResult,
|
||||
nsSVGElement *aSVGElement);
|
||||
nsresult ToDOMBaseVal(nsIDOMSVGRect **aResult, nsSVGElement* aSVGElement);
|
||||
nsresult ToDOMAnimVal(nsIDOMSVGRect **aResult, nsSVGElement* aSVGElement);
|
||||
nsresult ToDOMBaseVal(mozilla::dom::SVGIRect **aResult,
|
||||
nsSVGElement* aSVGElement);
|
||||
nsresult ToDOMAnimVal(mozilla::dom::SVGIRect **aResult,
|
||||
nsSVGElement* aSVGElement);
|
||||
// Returns a new nsISMILAttr object that the caller must delete
|
||||
nsISMILAttr* ToSMILAttr(nsSVGElement* aSVGElement);
|
||||
|
||||
|
@ -104,7 +107,10 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMBaseVal)
|
||||
|
||||
DOMBaseVal(nsSVGViewBox *aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
: mozilla::dom::SVGIRect(aSVGElement)
|
||||
, mVal(aVal)
|
||||
, mSVGElement(aSVGElement)
|
||||
{}
|
||||
virtual ~DOMBaseVal();
|
||||
|
||||
nsSVGViewBox* mVal; // kept alive because it belongs to content
|
||||
|
@ -147,7 +153,10 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimVal)
|
||||
|
||||
DOMAnimVal(nsSVGViewBox *aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
: mozilla::dom::SVGIRect(aSVGElement)
|
||||
, mVal(aVal)
|
||||
, mSVGElement(aSVGElement)
|
||||
{}
|
||||
virtual ~DOMAnimVal();
|
||||
|
||||
nsSVGViewBox* mVal; // kept alive because it belongs to content
|
||||
|
@ -200,25 +209,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
struct DOMAnimatedRect MOZ_FINAL : public nsIDOMSVGAnimatedRect
|
||||
{
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedRect)
|
||||
|
||||
DOMAnimatedRect(nsSVGViewBox *aVal, nsSVGElement *aSVGElement)
|
||||
: mVal(aVal), mSVGElement(aSVGElement) {}
|
||||
virtual ~DOMAnimatedRect();
|
||||
|
||||
nsSVGViewBox* mVal; // kept alive because it belongs to content
|
||||
nsRefPtr<nsSVGElement> mSVGElement;
|
||||
|
||||
NS_IMETHOD GetBaseVal(nsIDOMSVGRect **aBaseVal)
|
||||
{ return mVal->ToDOMBaseVal(aBaseVal, mSVGElement); }
|
||||
|
||||
NS_IMETHOD GetAnimVal(nsIDOMSVGRect **aAnimVal)
|
||||
{ return mVal->ToDOMAnimVal(aAnimVal, mSVGElement); }
|
||||
};
|
||||
|
||||
struct SMILViewBox : public nsISMILAttr
|
||||
{
|
||||
public:
|
||||
|
@ -240,6 +230,9 @@ public:
|
|||
virtual void ClearAnimValue();
|
||||
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
|
||||
};
|
||||
|
||||
static nsSVGAttrTearoffTable<nsSVGViewBox, mozilla::dom::SVGAnimatedRect>
|
||||
sSVGAnimatedRectTearoffTable;
|
||||
};
|
||||
|
||||
#endif // __NS_SVGVIEWBOX_H__
|
||||
|
|
|
@ -214,7 +214,6 @@
|
|||
#include "nsIDOMSVGAnimatedEnum.h"
|
||||
#include "nsIDOMSVGAnimatedInteger.h"
|
||||
#include "nsIDOMSVGAnimatedNumber.h"
|
||||
#include "nsIDOMSVGAnimatedRect.h"
|
||||
#include "nsIDOMSVGAnimatedString.h"
|
||||
#include "nsIDOMTimeEvent.h"
|
||||
#include "nsIDOMSVGLength.h"
|
||||
|
@ -695,8 +694,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGAnimatedNumber, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGAnimatedRect, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGAnimatedString, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGLength, nsDOMGenericSH,
|
||||
|
@ -1933,10 +1930,6 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimatedNumber)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGAnimatedRect, nsIDOMSVGAnimatedRect)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimatedRect)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGAnimatedString, nsIDOMSVGAnimatedString)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimatedString)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
|
|
@ -105,7 +105,6 @@ DOMCI_CLASS(TimeEvent)
|
|||
DOMCI_CLASS(SVGAnimatedEnumeration)
|
||||
DOMCI_CLASS(SVGAnimatedInteger)
|
||||
DOMCI_CLASS(SVGAnimatedNumber)
|
||||
DOMCI_CLASS(SVGAnimatedRect)
|
||||
DOMCI_CLASS(SVGAnimatedString)
|
||||
DOMCI_CLASS(SVGLength)
|
||||
DOMCI_CLASS(SVGNumber)
|
||||
|
|
|
@ -957,7 +957,6 @@ DOMInterfaces = {
|
|||
},
|
||||
|
||||
'SVGRect': {
|
||||
'wrapperCache': False,
|
||||
'nativeType': 'mozilla::dom::SVGIRect'
|
||||
},
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ XPIDL_SOURCES += [
|
|||
'nsIDOMSVGAnimatedInteger.idl',
|
||||
'nsIDOMSVGAnimatedLength.idl',
|
||||
'nsIDOMSVGAnimatedNumber.idl',
|
||||
'nsIDOMSVGAnimatedRect.idl',
|
||||
'nsIDOMSVGAnimatedString.idl',
|
||||
'nsIDOMSVGDocument.idl',
|
||||
'nsIDOMSVGElement.idl',
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "domstubs.idl"
|
||||
|
||||
interface nsIDOMSVGRect;
|
||||
|
||||
[scriptable, uuid(ca45959e-f1da-46f6-af19-1ecdc322285a)]
|
||||
interface nsIDOMSVGAnimatedRect : nsISupports
|
||||
{
|
||||
readonly attribute nsIDOMSVGRect baseVal;
|
||||
readonly attribute nsIDOMSVGRect animVal;
|
||||
};
|
|
@ -0,0 +1,18 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://www.w3.org/TR/SVG2/
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface SVGAnimatedRect {
|
||||
[GetterThrows]
|
||||
readonly attribute SVGRect? baseVal;
|
||||
[GetterThrows]
|
||||
readonly attribute SVGRect? animVal;
|
||||
};
|
|
@ -10,8 +10,6 @@
|
|||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface SVGAnimatedRect;
|
||||
|
||||
[NoInterfaceObject]
|
||||
interface SVGFitToViewBox {
|
||||
[Constant]
|
||||
|
|
|
@ -206,6 +206,7 @@ webidl_files = \
|
|||
SVGAnimatedPathData.webidl \
|
||||
SVGAnimatedPoints.webidl \
|
||||
SVGAnimatedPreserveAspectRatio.webidl \
|
||||
SVGAnimatedRect.webidl \
|
||||
SVGAnimatedTransformList.webidl \
|
||||
SVGAnimateElement.webidl \
|
||||
SVGAnimateMotionElement.webidl \
|
||||
|
|
|
@ -1286,7 +1286,8 @@ nsSVGGlyphFrame::GetExtentOfChar(uint32_t charnum, dom::SVGIRect **_retval)
|
|||
metrics.mAscent + metrics.mDescent));
|
||||
tmpCtx->IdentityMatrix();
|
||||
|
||||
nsRefPtr<dom::SVGRect> rect = NS_NewSVGRect(tmpCtx->GetUserPathExtent());
|
||||
nsRefPtr<dom::SVGRect> rect =
|
||||
NS_NewSVGRect(mContent, tmpCtx->GetUserPathExtent());
|
||||
|
||||
rect.forget(_retval);
|
||||
return NS_OK;
|
||||
|
|
|
@ -3947,7 +3947,7 @@ nsSVGTextFrame2::GetExtentOfChar(nsIContent* aContent,
|
|||
// Transform the glyph's rect into user space.
|
||||
gfxRect r = m.TransformBounds(glyphRect);
|
||||
|
||||
NS_ADDREF(*aResult = new dom::SVGRect(r.x, r.y, r.width, r.height));
|
||||
NS_ADDREF(*aResult = new dom::SVGRect(aContent, r.x, r.y, r.width, r.height));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче