1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_dom_SVGFEImageElement_h
7 #define mozilla_dom_SVGFEImageElement_h
9 #include "nsSVGFilters.h"
10 #include "SVGAnimatedPreserveAspectRatio.h"
12 class SVGFEImageFrame
;
14 nsresult
NS_NewSVGFEImageElement(nsIContent
**aResult
,
15 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
20 typedef nsSVGFE SVGFEImageElementBase
;
22 class SVGFEImageElement
: public SVGFEImageElementBase
,
23 public nsImageLoadingContent
25 friend class ::SVGFEImageFrame
;
28 friend nsresult (::NS_NewSVGFEImageElement(nsIContent
**aResult
,
29 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
));
30 explicit SVGFEImageElement(already_AddRefed
<mozilla::dom::NodeInfo
>& aNodeInfo
);
31 virtual ~SVGFEImageElement();
32 virtual JSObject
* WrapNode(JSContext
*aCx
) MOZ_OVERRIDE
;
35 virtual bool SubregionIsUnionOfRegions() MOZ_OVERRIDE
{ return false; }
38 NS_DECL_ISUPPORTS_INHERITED
40 virtual FilterPrimitiveDescription
41 GetPrimitiveDescription(nsSVGFilterInstance
* aInstance
,
42 const IntRect
& aFilterSubregion
,
43 const nsTArray
<bool>& aInputsAreTainted
,
44 nsTArray
<mozilla::RefPtr
<SourceSurface
>>& aInputImages
) MOZ_OVERRIDE
;
45 virtual bool AttributeAffectsRendering(
46 int32_t aNameSpaceID
, nsIAtom
* aAttribute
) const MOZ_OVERRIDE
;
47 virtual nsSVGString
& GetResultImageName() MOZ_OVERRIDE
{ return mStringAttributes
[RESULT
]; }
48 virtual bool OutputIsTainted(const nsTArray
<bool>& aInputsAreTainted
,
49 nsIPrincipal
* aReferencePrincipal
) MOZ_OVERRIDE
;
52 NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom
* aAttribute
) const MOZ_OVERRIDE
;
54 virtual nsresult
Clone(mozilla::dom::NodeInfo
*aNodeInfo
, nsINode
**aResult
) const MOZ_OVERRIDE
;
56 virtual nsresult
AfterSetAttr(int32_t aNamespaceID
, nsIAtom
* aName
,
57 const nsAttrValue
* aValue
, bool aNotify
) MOZ_OVERRIDE
;
58 virtual nsresult
BindToTree(nsIDocument
* aDocument
, nsIContent
* aParent
,
59 nsIContent
* aBindingParent
,
60 bool aCompileEventHandlers
) MOZ_OVERRIDE
;
61 virtual void UnbindFromTree(bool aDeep
, bool aNullParent
) MOZ_OVERRIDE
;
62 virtual EventStates
IntrinsicState() const MOZ_OVERRIDE
;
64 NS_IMETHODIMP
Notify(imgIRequest
*aRequest
, int32_t aType
, const nsIntRect
* aData
) MOZ_OVERRIDE
;
66 void MaybeLoadSVGImage();
69 already_AddRefed
<SVGAnimatedString
> Href();
70 already_AddRefed
<DOMSVGAnimatedPreserveAspectRatio
> PreserveAspectRatio();
73 // Invalidate users of the filter containing this element.
76 nsresult
LoadSVGImage(bool aForce
, bool aNotify
);
79 virtual bool ProducesSRGB() MOZ_OVERRIDE
{ return true; }
81 virtual SVGAnimatedPreserveAspectRatio
*GetPreserveAspectRatio() MOZ_OVERRIDE
;
82 virtual StringAttributesInfo
GetStringInfo() MOZ_OVERRIDE
;
84 enum { RESULT
, HREF
};
85 nsSVGString mStringAttributes
[2];
86 static StringInfo sStringInfo
[2];
88 SVGAnimatedPreserveAspectRatio mPreserveAspectRatio
;
92 } // namespace mozilla