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