SVGFEMergeElement.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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/SVGFEMergeElement.h"
  6. #include "mozilla/dom/SVGFEMergeElementBinding.h"
  7. #include "mozilla/dom/SVGFEMergeNodeElement.h"
  8. NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEMerge)
  9. using namespace mozilla::gfx;
  10. namespace mozilla {
  11. namespace dom {
  12. JSObject*
  13. SVGFEMergeElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
  14. {
  15. return SVGFEMergeElementBinding::Wrap(aCx, this, aGivenProto);
  16. }
  17. nsSVGElement::StringInfo SVGFEMergeElement::sStringInfo[1] =
  18. {
  19. { &nsGkAtoms::result, kNameSpaceID_None, true }
  20. };
  21. NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEMergeElement)
  22. FilterPrimitiveDescription
  23. SVGFEMergeElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
  24. const IntRect& aFilterSubregion,
  25. const nsTArray<bool>& aInputsAreTainted,
  26. nsTArray<RefPtr<SourceSurface>>& aInputImages)
  27. {
  28. return FilterPrimitiveDescription(PrimitiveType::Merge);
  29. }
  30. void
  31. SVGFEMergeElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
  32. {
  33. for (nsIContent* child = nsINode::GetFirstChild();
  34. child;
  35. child = child->GetNextSibling()) {
  36. if (child->IsSVGElement(nsGkAtoms::feMergeNode)) {
  37. SVGFEMergeNodeElement* node = static_cast<SVGFEMergeNodeElement*>(child);
  38. aSources.AppendElement(nsSVGStringInfo(node->GetIn1(), node));
  39. }
  40. }
  41. }
  42. //----------------------------------------------------------------------
  43. // nsSVGElement methods
  44. nsSVGElement::StringAttributesInfo
  45. SVGFEMergeElement::GetStringInfo()
  46. {
  47. return StringAttributesInfo(mStringAttributes, sStringInfo,
  48. ArrayLength(sStringInfo));
  49. }
  50. } // namespace dom
  51. } // namespace mozilla