Merge mozilla-central to autoland on a CLOSED TREE
[gecko.git] / dom / svg / SVGMPathElement.h
blob273ff45e93d2bda4944414e7011c268fd2034e2a
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 {
22 protected:
23 friend nsresult(::NS_NewSVGMPathElement(
24 nsIContent** aResult,
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;
33 public:
34 // interfaces:
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();
52 // WebIDL
53 already_AddRefed<DOMSVGAnimatedString> Href();
55 void HrefAsString(nsAString& aHref);
57 void NotifyParentOfMpathChange();
59 RefPtr<nsISupports> mMPathObserver;
61 protected:
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_