Bug 1881621 - Add colors/color_canvas.html tests to dom/canvas/test/reftest. r=bradwerth
[gecko.git] / dom / svg / SVGGraphicsElement.h
blob610436d394301da1a2059a6491e086ff271628d4
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_SVGGRAPHICSELEMENT_H_
8 #define DOM_SVG_SVGGRAPHICSELEMENT_H_
10 #include "mozilla/dom/SVGTests.h"
11 #include "mozilla/dom/SVGTransformableElement.h"
13 namespace mozilla::dom {
15 using SVGGraphicsElementBase = SVGTransformableElement;
17 class SVGGraphicsElement : public SVGGraphicsElementBase, public SVGTests {
18 protected:
19 explicit SVGGraphicsElement(
20 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
21 ~SVGGraphicsElement() = default;
23 public:
24 // interfaces:
25 NS_DECL_ISUPPORTS_INHERITED
27 NS_IMPL_FROMNODE_HELPER(SVGGraphicsElement, IsSVGGraphicsElement())
29 // WebIDL
30 SVGElement* GetNearestViewportElement();
31 SVGElement* GetFarthestViewportElement();
32 MOZ_CAN_RUN_SCRIPT
33 already_AddRefed<SVGRect> GetBBox(const SVGBoundingBoxOptions&);
34 already_AddRefed<SVGMatrix> GetCTM();
35 already_AddRefed<SVGMatrix> GetScreenCTM();
37 Focusable IsFocusableWithoutStyle(bool aWithMouse) override;
38 bool IsSVGGraphicsElement() const final { return true; }
40 using nsINode::Clone;
41 // Overrides SVGTests.
42 bool PassesConditionalProcessingTests() const final {
43 return SVGTests::PassesConditionalProcessingTests();
45 SVGElement* AsSVGElement() final { return this; }
47 protected:
48 // returns true if focusability has been definitively determined otherwise
49 // false
50 bool IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex);
52 template <typename T>
53 bool IsInLengthInfo(const nsAtom* aAttribute, const T& aLengthInfos) const {
54 for (auto const& e : aLengthInfos) {
55 if (e.mName == aAttribute) {
56 return true;
59 return false;
63 } // namespace mozilla::dom
65 #endif // DOM_SVG_SVGGRAPHICSELEMENT_H_