SVGPathSegment.h (1571B)
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_SVGPATHSEGMENT_H_ 8 #define DOM_SVG_SVGPATHSEGMENT_H_ 9 10 #include "SVGPathSegUtils.h" 11 #include "mozilla/dom/SVGPathElement.h" 12 #include "nsWrapperCache.h" 13 14 namespace mozilla::dom { 15 16 class SVGPathElement; 17 18 class SVGPathSegment final : public nsWrapperCache { 19 public: 20 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(SVGPathSegment) 21 NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(SVGPathSegment) 22 23 SVGPathSegment(SVGPathElement* aSVGPathElement, 24 const StylePathCommand& aValue); 25 26 protected: 27 virtual ~SVGPathSegment() = default; 28 29 public: 30 SVGPathElement* GetParentObject() const { return mSVGPathElement; } 31 32 JSObject* WrapObject(JSContext* aCx, 33 JS::Handle<JSObject*> aGivenProto) override; 34 35 void GetType(DOMString& aType); 36 void SetType(const nsAString& aType); 37 38 void GetValues(nsTArray<float>& aValues); 39 void SetValues(const nsTArray<float>& aValues); 40 41 private: 42 RefPtr<SVGPathElement> mSVGPathElement; 43 nsString mCommand; 44 nsTArray<float> mValues; 45 void AppendEndPoint(const StyleEndPoint<StyleCSSFloat>& point); 46 void AppendControlPoint(const StyleCurveControlPoint<StyleCSSFloat>& point); 47 }; 48 49 } // namespace mozilla::dom 50 51 #endif // DOM_SVG_SVGPATHSEGMENT_H_