tor-browser

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

SVGFETileElement.cpp (2722B)


      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/SVGFETileElement.h"
      8 
      9 #include "mozilla/SVGFilterInstance.h"
     10 #include "mozilla/dom/BindContext.h"
     11 #include "mozilla/dom/Document.h"
     12 #include "mozilla/dom/SVGFETileElementBinding.h"
     13 
     14 NS_IMPL_NS_NEW_SVG_ELEMENT(FETile)
     15 
     16 using namespace mozilla::gfx;
     17 
     18 namespace mozilla::dom {
     19 
     20 JSObject* SVGFETileElement::WrapNode(JSContext* aCx,
     21                                     JS::Handle<JSObject*> aGivenProto) {
     22  return SVGFETileElement_Binding::Wrap(aCx, this, aGivenProto);
     23 }
     24 
     25 SVGElement::StringInfo SVGFETileElement::sStringInfo[2] = {
     26    {nsGkAtoms::result, kNameSpaceID_None, true},
     27    {nsGkAtoms::in, kNameSpaceID_None, true}};
     28 
     29 //----------------------------------------------------------------------
     30 // nsINode methods
     31 
     32 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFETileElement)
     33 
     34 already_AddRefed<DOMSVGAnimatedString> SVGFETileElement::In1() {
     35  return mStringAttributes[IN1].ToDOMAnimatedString(this);
     36 }
     37 
     38 void SVGFETileElement::GetSourceImageNames(nsTArray<SVGStringInfo>& aSources) {
     39  aSources.AppendElement(SVGStringInfo(&mStringAttributes[IN1], this));
     40 }
     41 
     42 //----------------------------------------------------------------------
     43 // SVGElement methods
     44 
     45 FilterPrimitiveDescription SVGFETileElement::GetPrimitiveDescription(
     46    SVGFilterInstance* aInstance, const IntRect& aFilterSubregion,
     47    const nsTArray<bool>& aInputsAreTainted,
     48    nsTArray<RefPtr<SourceSurface>>& aInputImages) {
     49  return FilterPrimitiveDescription(AsVariant(TileAttributes()));
     50 }
     51 
     52 bool SVGFETileElement::AttributeAffectsRendering(int32_t aNameSpaceID,
     53                                                 nsAtom* aAttribute) const {
     54  return SVGFETileElementBase::AttributeAffectsRendering(aNameSpaceID,
     55                                                         aAttribute) ||
     56         (aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::in);
     57 }
     58 
     59 //----------------------------------------------------------------------
     60 // SVGElement methods
     61 
     62 SVGElement::StringAttributesInfo SVGFETileElement::GetStringInfo() {
     63  return StringAttributesInfo(mStringAttributes, sStringInfo,
     64                              std::size(sStringInfo));
     65 }
     66 
     67 nsresult SVGFETileElement::BindToTree(BindContext& aCtx, nsINode& aParent) {
     68  if (aCtx.InComposedDoc()) {
     69    aCtx.OwnerDoc().SetUseCounter(eUseCounter_custom_feTile);
     70  }
     71 
     72  return SVGFETileElementBase::BindToTree(aCtx, aParent);
     73 }
     74 
     75 }  // namespace mozilla::dom