Merge mozilla-central to autoland on a CLOSED TREE
[gecko.git] / dom / svg / SVGGraphicsElement.h
blob0b4eacc8ec398fd95a30c852b0262a37175b4922
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 bool IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) override;
38 bool IsSVGGraphicsElement() const final { return true; }
40 using nsINode::Clone;
41 // Overrides SVGTests.
42 SVGElement* AsSVGElement() final { return this; }
44 protected:
45 // returns true if focusability has been definitively determined otherwise
46 // false
47 bool IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex);
49 template <typename T>
50 bool IsInLengthInfo(const nsAtom* aAttribute, const T& aLengthInfos) const {
51 for (auto const& e : aLengthInfos) {
52 if (e.mName == aAttribute) {
53 return true;
56 return false;
60 } // namespace mozilla::dom
62 #endif // DOM_SVG_SVGGRAPHICSELEMENT_H_