SVGSymbolElement.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "mozilla/dom/SVGSymbolElement.h"
  6. #include "mozilla/dom/SVGSymbolElementBinding.h"
  7. #include "nsContentUtils.h"
  8. NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Symbol)
  9. namespace mozilla {
  10. namespace dom {
  11. JSObject*
  12. SVGSymbolElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
  13. {
  14. return SVGSymbolElementBinding::Wrap(aCx, this, aGivenProto);
  15. }
  16. //----------------------------------------------------------------------
  17. // nsISupports methods
  18. NS_IMPL_ISUPPORTS_INHERITED(SVGSymbolElement, SVGSymbolElementBase,
  19. nsIDOMNode, nsIDOMElement,
  20. nsIDOMSVGElement, mozilla::dom::SVGTests)
  21. //----------------------------------------------------------------------
  22. // Implementation
  23. SVGSymbolElement::SVGSymbolElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
  24. : SVGSymbolElementBase(aNodeInfo)
  25. {
  26. }
  27. SVGSymbolElement::~SVGSymbolElement()
  28. {
  29. }
  30. //----------------------------------------------------------------------
  31. // nsIDOMNode methods
  32. NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGSymbolElement)
  33. //----------------------------------------------------------------------
  34. already_AddRefed<SVGAnimatedRect>
  35. SVGSymbolElement::ViewBox()
  36. {
  37. return mViewBox.ToSVGAnimatedRect(this);
  38. }
  39. already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
  40. SVGSymbolElement::PreserveAspectRatio()
  41. {
  42. return mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(this);
  43. }
  44. //----------------------------------------------------------------------
  45. // nsIContent methods
  46. NS_IMETHODIMP_(bool)
  47. SVGSymbolElement::IsAttributeMapped(const nsIAtom* name) const
  48. {
  49. static const MappedAttributeEntry* const map[] = {
  50. sColorMap,
  51. sFEFloodMap,
  52. sFillStrokeMap,
  53. sFiltersMap,
  54. sFontSpecificationMap,
  55. sGradientStopMap,
  56. sGraphicsMap,
  57. sLightingEffectsMap,
  58. sMarkersMap,
  59. sTextContentElementsMap,
  60. sViewportsMap
  61. };
  62. return FindAttributeDependence(name, map) ||
  63. SVGSymbolElementBase::IsAttributeMapped(name);
  64. }
  65. //----------------------------------------------------------------------
  66. // SVGTests methods
  67. bool
  68. SVGSymbolElement::IsInChromeDoc() const
  69. {
  70. return nsContentUtils::IsChromeDoc(OwnerDoc());
  71. }
  72. //----------------------------------------------------------------------
  73. // nsSVGElement methods
  74. nsSVGViewBox *
  75. SVGSymbolElement::GetViewBox()
  76. {
  77. return &mViewBox;
  78. }
  79. SVGAnimatedPreserveAspectRatio *
  80. SVGSymbolElement::GetPreserveAspectRatio()
  81. {
  82. return &mPreserveAspectRatio;
  83. }
  84. } // namespace dom
  85. } // namespace mozilla