SVGGraphicsElement.h (1920B)
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_SVGGRAPHICSELEMENT_H_ 8 #define DOM_SVG_SVGGRAPHICSELEMENT_H_ 9 10 #include "mozilla/dom/SVGTests.h" 11 #include "mozilla/dom/SVGTransformableElement.h" 12 13 namespace mozilla::dom { 14 15 using SVGGraphicsElementBase = SVGTransformableElement; 16 17 class SVGGraphicsElement : public SVGGraphicsElementBase, public SVGTests { 18 protected: 19 explicit SVGGraphicsElement( 20 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 21 ~SVGGraphicsElement() = default; 22 23 public: 24 // interfaces: 25 NS_DECL_ISUPPORTS_INHERITED 26 27 NS_IMPL_FROMNODE_HELPER(SVGGraphicsElement, IsSVGGraphicsElement()) 28 29 // WebIDL 30 MOZ_CAN_RUN_SCRIPT 31 already_AddRefed<SVGRect> GetBBox(const SVGBoundingBoxOptions&); 32 already_AddRefed<SVGMatrix> GetCTM(); 33 already_AddRefed<SVGMatrix> GetScreenCTM(); 34 35 Focusable IsFocusableWithoutStyle(IsFocusableFlags) override; 36 bool IsSVGGraphicsElement() const final { return true; } 37 38 using nsINode::Clone; 39 // Overrides SVGTests. 40 bool PassesConditionalProcessingTests() const final { 41 return SVGTests::PassesConditionalProcessingTests(); 42 } 43 SVGElement* AsSVGElement() final { return this; } 44 45 protected: 46 // returns true if focusability has been definitively determined otherwise 47 // false 48 bool IsSVGFocusable(bool* aIsFocusable, int32_t* aTabIndex); 49 50 template <typename T> 51 bool IsInLengthInfo(const nsAtom* aAttribute, const T& aLengthInfos) const { 52 for (auto const& e : aLengthInfos) { 53 if (e.mName == aAttribute) { 54 return true; 55 } 56 } 57 return false; 58 } 59 }; 60 61 } // namespace mozilla::dom 62 63 #endif // DOM_SVG_SVGGRAPHICSELEMENT_H_