tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SVGFEMergeElement.cpp (2182B)


      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/SVGFEMergeElement.h"
      8 
      9 #include "mozilla/dom/BindContext.h"
     10 #include "mozilla/dom/Document.h"
     11 #include "mozilla/dom/SVGFEMergeElementBinding.h"
     12 #include "mozilla/dom/SVGFEMergeNodeElement.h"
     13 
     14 NS_IMPL_NS_NEW_SVG_ELEMENT(FEMerge)
     15 
     16 using namespace mozilla::gfx;
     17 
     18 namespace mozilla::dom {
     19 
     20 JSObject* SVGFEMergeElement::WrapNode(JSContext* aCx,
     21                                      JS::Handle<JSObject*> aGivenProto) {
     22  return SVGFEMergeElement_Binding::Wrap(aCx, this, aGivenProto);
     23 }
     24 
     25 SVGElement::StringInfo SVGFEMergeElement::sStringInfo[1] = {
     26    {nsGkAtoms::result, kNameSpaceID_None, true}};
     27 
     28 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEMergeElement)
     29 
     30 FilterPrimitiveDescription SVGFEMergeElement::GetPrimitiveDescription(
     31    SVGFilterInstance* aInstance, const IntRect& aFilterSubregion,
     32    const nsTArray<bool>& aInputsAreTainted,
     33    nsTArray<RefPtr<SourceSurface>>& aInputImages) {
     34  return FilterPrimitiveDescription(AsVariant(MergeAttributes()));
     35 }
     36 
     37 void SVGFEMergeElement::GetSourceImageNames(nsTArray<SVGStringInfo>& aSources) {
     38  for (nsIContent* child = nsINode::GetFirstChild(); child;
     39       child = child->GetNextSibling()) {
     40    if (auto* node = SVGFEMergeNodeElement::FromNode(child)) {
     41      aSources.AppendElement(SVGStringInfo(node->GetIn1(), node));
     42    }
     43  }
     44 }
     45 
     46 nsresult SVGFEMergeElement::BindToTree(BindContext& aCtx, nsINode& aParent) {
     47  if (aCtx.InComposedDoc()) {
     48    aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feMerge);
     49  }
     50 
     51  return SVGFEMergeElementBase::BindToTree(aCtx, aParent);
     52 }
     53 
     54 //----------------------------------------------------------------------
     55 // SVGElement methods
     56 
     57 SVGElement::StringAttributesInfo SVGFEMergeElement::GetStringInfo() {
     58  return StringAttributesInfo(mStringAttributes, sStringInfo,
     59                              std::size(sStringInfo));
     60 }
     61 
     62 }  // namespace mozilla::dom