SVGEllipseElement.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* -*- Mode: C++; tab-width: 8; 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/. */
  5. #ifndef mozilla_dom_SVGEllipseElement_h
  6. #define mozilla_dom_SVGEllipseElement_h
  7. #include "nsSVGPathGeometryElement.h"
  8. #include "nsSVGLength2.h"
  9. nsresult NS_NewSVGEllipseElement(nsIContent **aResult,
  10. already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
  11. namespace mozilla {
  12. namespace dom {
  13. typedef nsSVGPathGeometryElement SVGEllipseElementBase;
  14. class SVGEllipseElement final : public SVGEllipseElementBase
  15. {
  16. protected:
  17. explicit SVGEllipseElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
  18. virtual JSObject* WrapNode(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
  19. friend nsresult (::NS_NewSVGEllipseElement(nsIContent **aResult,
  20. already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
  21. public:
  22. // nsSVGSVGElement methods:
  23. virtual bool HasValidDimensions() const override;
  24. // nsSVGPathGeometryElement methods:
  25. virtual bool GetGeometryBounds(Rect* aBounds, const StrokeOptions& aStrokeOptions,
  26. const Matrix& aToBoundsSpace,
  27. const Matrix* aToNonScalingStrokeSpace = nullptr) override;
  28. virtual already_AddRefed<Path> BuildPath(PathBuilder* aBuilder) override;
  29. virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
  30. // WebIDL
  31. already_AddRefed<SVGAnimatedLength> Cx();
  32. already_AddRefed<SVGAnimatedLength> Cy();
  33. already_AddRefed<SVGAnimatedLength> Rx();
  34. already_AddRefed<SVGAnimatedLength> Ry();
  35. protected:
  36. virtual LengthAttributesInfo GetLengthInfo() override;
  37. enum { CX, CY, RX, RY };
  38. nsSVGLength2 mLengthAttributes[4];
  39. static LengthInfo sLengthInfo[4];
  40. };
  41. } // namespace dom
  42. } // namespace mozilla
  43. #endif // mozilla_dom_SVGEllipseElement_h