Bug 1873144 - Disabled test_conformance__textures__misc__texture-npot-video.html...
[gecko.git] / dom / svg / SVGRectElement.h
blobd96ff70223d15ac8cbc9922ec7c17da99f76cb8d
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_SVGRECTELEMENT_H_
8 #define DOM_SVG_SVGRECTELEMENT_H_
10 #include "nsCSSPropertyID.h"
11 #include "SVGAnimatedLength.h"
12 #include "SVGGeometryElement.h"
14 nsresult NS_NewSVGRectElement(
15 nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
17 namespace mozilla {
18 class ComputedStyle;
20 namespace dom {
22 using SVGRectElementBase = SVGGeometryElement;
24 class SVGRectElement final : public SVGRectElementBase {
25 protected:
26 explicit SVGRectElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
27 JSObject* WrapNode(JSContext* cx, JS::Handle<JSObject*> aGivenProto) override;
28 friend nsresult(::NS_NewSVGRectElement(
29 nsIContent** aResult,
30 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
32 public:
33 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
35 // SVGSVGElement methods:
36 bool HasValidDimensions() const override;
38 // SVGGeometryElement methods:
39 bool GetGeometryBounds(
40 Rect* aBounds, const StrokeOptions& aStrokeOptions,
41 const Matrix& aToBoundsSpace,
42 const Matrix* aToNonScalingStrokeSpace = nullptr) override;
43 void GetAsSimplePath(SimplePath* aSimplePath) override;
44 already_AddRefed<Path> BuildPath(PathBuilder* aBuilder = nullptr) override;
45 bool IsClosedLoop() const override { return true; }
47 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
49 static bool IsLengthChangedViaCSS(const ComputedStyle& aNewStyle,
50 const ComputedStyle& aOldStyle);
51 static nsCSSPropertyID GetCSSPropertyIdForAttrEnum(uint8_t aAttrEnum);
53 // WebIDL
54 already_AddRefed<DOMSVGAnimatedLength> X();
55 already_AddRefed<DOMSVGAnimatedLength> Y();
56 already_AddRefed<DOMSVGAnimatedLength> Height();
57 already_AddRefed<DOMSVGAnimatedLength> Width();
58 already_AddRefed<DOMSVGAnimatedLength> Rx();
59 already_AddRefed<DOMSVGAnimatedLength> Ry();
61 protected:
62 LengthAttributesInfo GetLengthInfo() override;
64 enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT, ATTR_RX, ATTR_RY };
65 SVGAnimatedLength mLengthAttributes[6];
66 static LengthInfo sLengthInfo[6];
69 } // namespace dom
70 } // namespace mozilla
72 #endif // DOM_SVG_SVGRECTELEMENT_H_