2009-01-04 17:19:38 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2009-01-04 17:19:38 -08:00
|
|
|
|
2013-01-06 01:32:01 -08:00
|
|
|
#ifndef mozilla_dom_SVGImageElement_h
|
|
|
|
#define mozilla_dom_SVGImageElement_h
|
2009-01-04 17:19:38 -08:00
|
|
|
|
|
|
|
#include "nsImageLoadingContent.h"
|
|
|
|
#include "nsSVGLength2.h"
|
2012-01-26 01:57:21 -08:00
|
|
|
#include "nsSVGPathGeometryElement.h"
|
|
|
|
#include "nsSVGString.h"
|
2010-12-19 16:45:29 -08:00
|
|
|
#include "SVGAnimatedPreserveAspectRatio.h"
|
2009-01-04 17:19:38 -08:00
|
|
|
|
2013-01-06 01:32:01 -08:00
|
|
|
nsresult NS_NewSVGImageElement(nsIContent **aResult,
|
2014-06-19 19:01:40 -07:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
2009-01-04 17:19:38 -08:00
|
|
|
|
2013-01-06 01:32:01 -08:00
|
|
|
typedef nsSVGPathGeometryElement SVGImageElementBase;
|
|
|
|
|
|
|
|
class nsSVGImageFrame;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class DOMSVGAnimatedPreserveAspectRatio;
|
|
|
|
|
|
|
|
class SVGImageElement : public SVGImageElementBase,
|
|
|
|
public nsImageLoadingContent
|
2009-01-04 17:19:38 -08:00
|
|
|
{
|
2013-01-06 01:32:01 -08:00
|
|
|
friend class ::nsSVGImageFrame;
|
2009-01-04 17:19:38 -08:00
|
|
|
|
|
|
|
protected:
|
2014-06-19 19:01:40 -07:00
|
|
|
SVGImageElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
|
2013-01-06 01:32:01 -08:00
|
|
|
virtual ~SVGImageElement();
|
2014-04-08 15:27:17 -07:00
|
|
|
virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
|
2013-01-06 01:32:01 -08:00
|
|
|
friend nsresult (::NS_NewSVGImageElement(nsIContent **aResult,
|
2014-06-19 19:01:40 -07:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
|
2009-01-04 17:19:38 -08:00
|
|
|
|
|
|
|
public:
|
|
|
|
// interfaces:
|
2013-01-06 01:32:01 -08:00
|
|
|
|
2009-01-04 17:19:38 -08:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
// nsIContent interface
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
|
2013-05-07 22:11:24 -07:00
|
|
|
const nsAttrValue* aValue, bool aNotify) MOZ_OVERRIDE;
|
2009-01-04 17:19:38 -08:00
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2013-05-07 22:11:24 -07:00
|
|
|
bool aCompileEventHandlers) MOZ_OVERRIDE;
|
|
|
|
virtual void UnbindFromTree(bool aDeep, bool aNullParent) MOZ_OVERRIDE;
|
2009-01-04 17:19:38 -08:00
|
|
|
|
2014-04-02 21:18:36 -07:00
|
|
|
virtual EventStates IntrinsicState() const MOZ_OVERRIDE;
|
2009-01-04 17:19:38 -08:00
|
|
|
|
2013-05-07 22:11:24 -07:00
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const MOZ_OVERRIDE;
|
2009-01-04 17:19:38 -08:00
|
|
|
|
|
|
|
// nsSVGPathGeometryElement methods:
|
2013-05-07 22:11:24 -07:00
|
|
|
virtual void ConstructPath(gfxContext *aCtx) MOZ_OVERRIDE;
|
2014-07-05 13:53:04 -07:00
|
|
|
virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder = nullptr) MOZ_OVERRIDE;
|
2009-01-04 17:19:38 -08:00
|
|
|
|
2012-03-03 01:21:09 -08:00
|
|
|
// nsSVGSVGElement methods:
|
2013-05-07 22:11:24 -07:00
|
|
|
virtual bool HasValidDimensions() const MOZ_OVERRIDE;
|
2012-03-03 01:21:09 -08:00
|
|
|
|
2014-06-19 19:01:40 -07:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
2009-01-04 17:19:38 -08:00
|
|
|
|
2012-11-14 14:10:08 -08:00
|
|
|
nsresult CopyInnerTo(mozilla::dom::Element* aDest);
|
2009-12-10 20:02:13 -08:00
|
|
|
|
2009-05-20 01:00:04 -07:00
|
|
|
void MaybeLoadSVGImage();
|
2010-07-23 02:49:57 -07:00
|
|
|
|
2011-10-29 01:18:25 -07:00
|
|
|
bool IsImageSrcSetDisabled() const;
|
|
|
|
|
2013-01-06 01:32:01 -08:00
|
|
|
// WebIDL
|
2013-01-19 12:56:00 -08:00
|
|
|
already_AddRefed<SVGAnimatedLength> X();
|
|
|
|
already_AddRefed<SVGAnimatedLength> Y();
|
|
|
|
already_AddRefed<SVGAnimatedLength> Width();
|
|
|
|
already_AddRefed<SVGAnimatedLength> Height();
|
2013-01-06 01:32:01 -08:00
|
|
|
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
|
2013-06-14 15:37:27 -07:00
|
|
|
already_AddRefed<SVGAnimatedString> Href();
|
2013-01-06 01:32:01 -08:00
|
|
|
|
2009-01-04 17:19:38 -08:00
|
|
|
protected:
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult LoadSVGImage(bool aForce, bool aNotify);
|
2009-01-04 17:19:38 -08:00
|
|
|
|
2013-05-07 22:11:24 -07:00
|
|
|
virtual LengthAttributesInfo GetLengthInfo() MOZ_OVERRIDE;
|
|
|
|
virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio() MOZ_OVERRIDE;
|
|
|
|
virtual StringAttributesInfo GetStringInfo() MOZ_OVERRIDE;
|
2009-01-04 17:19:38 -08:00
|
|
|
|
2013-01-06 01:32:01 -08:00
|
|
|
enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
|
2009-01-04 17:19:38 -08:00
|
|
|
nsSVGLength2 mLengthAttributes[4];
|
|
|
|
static LengthInfo sLengthInfo[4];
|
|
|
|
|
2010-12-19 16:45:29 -08:00
|
|
|
SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
|
2009-01-04 17:19:38 -08:00
|
|
|
|
|
|
|
enum { HREF };
|
|
|
|
nsSVGString mStringAttributes[1];
|
|
|
|
static StringInfo sStringInfo[1];
|
|
|
|
};
|
|
|
|
|
2013-01-06 01:32:01 -08:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_SVGImageElement_h
|