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 #include "mozilla/dom/SVGGElement.h"
8 #include "mozilla/dom/SVGGElementBinding.h"
9 
10 NS_IMPL_NS_NEW_SVG_ELEMENT(G)
11 
12 namespace mozilla {
13 namespace dom {
14 
WrapNode(JSContext * aCx,JS::Handle<JSObject * > aGivenProto)15 JSObject* SVGGElement::WrapNode(JSContext* aCx,
16                                 JS::Handle<JSObject*> aGivenProto) {
17   return SVGGElement_Binding::Wrap(aCx, this, aGivenProto);
18 }
19 
20 //----------------------------------------------------------------------
21 // Implementation
22 
SVGGElement(already_AddRefed<mozilla::dom::NodeInfo> && aNodeInfo)23 SVGGElement::SVGGElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
24     : SVGGraphicsElement(std::move(aNodeInfo)) {}
25 
26 //----------------------------------------------------------------------
27 // nsINode methods
28 
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGGElement)29 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGGElement)
30 
31 bool SVGGElement::IsNodeOfType(uint32_t aFlags) const {
32   return !(aFlags & ~eUSE_TARGET);
33 }
34 
35 //----------------------------------------------------------------------
36 // nsIContent methods
37 
NS_IMETHODIMP_(bool)38 NS_IMETHODIMP_(bool)
39 SVGGElement::IsAttributeMapped(const nsAtom* name) const {
40   static const MappedAttributeEntry* const map[] = {sFEFloodMap,
41                                                     sFiltersMap,
42                                                     sFontSpecificationMap,
43                                                     sGradientStopMap,
44                                                     sLightingEffectsMap,
45                                                     sMarkersMap,
46                                                     sTextContentElementsMap,
47                                                     sViewportsMap};
48 
49   return FindAttributeDependence(name, map) ||
50          SVGGraphicsElement::IsAttributeMapped(name);
51 }
52 
53 }  // namespace dom
54 }  // namespace mozilla
55