1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef DOM_SVG_SVGMPATHELEMENT_H_
8 #define DOM_SVG_SVGMPATHELEMENT_H_
10 #include "mozilla/dom/SVGElement.h"
11 #include "SVGAnimatedString.h"
13 nsresult
NS_NewSVGMPathElement(
14 nsIContent
** aResult
, already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
16 namespace mozilla::dom
{
17 class SVGGeometryElement
;
19 using SVGMPathElementBase
= SVGElement
;
21 class SVGMPathElement final
: public SVGMPathElementBase
{
23 friend nsresult(::NS_NewSVGMPathElement(
25 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
));
26 explicit SVGMPathElement(
27 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
28 ~SVGMPathElement() = default;
30 JSObject
* WrapNode(JSContext
* aCx
,
31 JS::Handle
<JSObject
*> aGivenProto
) override
;
35 NS_DECL_ISUPPORTS_INHERITED
37 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGMPathElement
, SVGMPathElementBase
)
39 // nsIContent interface
40 nsresult
Clone(dom::NodeInfo
*, nsINode
** aResult
) const override
;
41 void UnbindFromTree(bool aNullParent
) override
;
42 void AfterSetAttr(int32_t aNamespaceID
, nsAtom
* aName
,
43 const nsAttrValue
* aValue
, const nsAttrValue
* aOldValue
,
44 nsIPrincipal
* aMaybeScriptedPrincipal
,
45 bool aNotify
) override
;
47 // Public helper method: If our xlink:href attribute links to a Shape
48 // element, this method returns a pointer to that element. Otherwise,
49 // this returns nullptr.
50 SVGGeometryElement
* GetReferencedPath();
53 already_AddRefed
<DOMSVGAnimatedString
> Href();
55 void HrefAsString(nsAString
& aHref
);
57 void NotifyParentOfMpathChange();
59 RefPtr
<nsISupports
> mMPathObserver
;
62 StringAttributesInfo
GetStringInfo() override
;
64 enum { HREF
, XLINK_HREF
};
65 SVGAnimatedString mStringAttributes
[2];
66 static StringInfo sStringInfo
[2];
69 } // namespace mozilla::dom
71 #endif // DOM_SVG_SVGMPATHELEMENT_H_