tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SVGMPathElement.h (2256B)


      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/. */
      6 
      7 #ifndef DOM_SVG_SVGMPATHELEMENT_H_
      8 #define DOM_SVG_SVGMPATHELEMENT_H_
      9 
     10 #include "SVGAnimatedString.h"
     11 #include "mozilla/dom/SVGElement.h"
     12 
     13 nsresult NS_NewSVGMPathElement(
     14    nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
     15 
     16 namespace mozilla::dom {
     17 class SVGGeometryElement;
     18 
     19 using SVGMPathElementBase = SVGElement;
     20 
     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;
     29 
     30  JSObject* WrapNode(JSContext* aCx,
     31                     JS::Handle<JSObject*> aGivenProto) override;
     32 
     33 public:
     34  // interfaces:
     35  NS_DECL_ISUPPORTS_INHERITED
     36 
     37  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGMPathElement, SVGMPathElementBase)
     38 
     39  // nsIContent interface
     40  nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
     41  void UnbindFromTree(UnbindContext&) override;
     42  void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
     43                    const nsAttrValue* aValue, const nsAttrValue* aOldValue,
     44                    nsIPrincipal* aMaybeScriptedPrincipal,
     45                    bool aNotify) override;
     46 
     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();
     51 
     52  // WebIDL
     53  already_AddRefed<DOMSVGAnimatedString> Href();
     54 
     55  void HrefAsString(nsAString& aHref);
     56 
     57  void NotifyParentOfMpathChange();
     58 
     59  RefPtr<nsISupports> mMPathObserver;
     60 
     61 protected:
     62  StringAttributesInfo GetStringInfo() override;
     63 
     64  enum { HREF, XLINK_HREF };
     65  SVGAnimatedString mStringAttributes[2];
     66  static StringInfo sStringInfo[2];
     67 };
     68 
     69 }  // namespace mozilla::dom
     70 
     71 #endif  // DOM_SVG_SVGMPATHELEMENT_H_