tor-browser

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

SVGAnimateTransformElement.cpp (2171B)


      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/SVGAnimateTransformElement.h"
      8 
      9 #include "mozilla/dom/SVGAnimateTransformElementBinding.h"
     10 
     11 NS_IMPL_NS_NEW_SVG_ELEMENT(AnimateTransform)
     12 
     13 namespace mozilla::dom {
     14 
     15 JSObject* SVGAnimateTransformElement::WrapNode(
     16    JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
     17  return SVGAnimateTransformElement_Binding::Wrap(aCx, this, aGivenProto);
     18 }
     19 
     20 //----------------------------------------------------------------------
     21 // Implementation
     22 
     23 SVGAnimateTransformElement::SVGAnimateTransformElement(
     24    already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
     25    : SVGAnimationElement(std::move(aNodeInfo)) {}
     26 
     27 bool SVGAnimateTransformElement::ParseAttribute(
     28    int32_t aNamespaceID, nsAtom* aAttribute, const nsAString& aValue,
     29    nsIPrincipal* aMaybeScriptedPrincipal, nsAttrValue& aResult) {
     30  // 'type' is an <animateTransform>-specific attribute, and we'll handle it
     31  // specially.
     32  if (aNamespaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::type) {
     33    aResult.ParseAtom(aValue);
     34    nsAtom* atom = aResult.GetAtomValue();
     35    if (atom != nsGkAtoms::translate && atom != nsGkAtoms::scale &&
     36        atom != nsGkAtoms::rotate && atom != nsGkAtoms::skewX &&
     37        atom != nsGkAtoms::skewY) {
     38      ReportAttributeParseFailure(OwnerDoc(), aAttribute, aValue);
     39    }
     40    return true;
     41  }
     42 
     43  return SVGAnimationElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
     44                                             aMaybeScriptedPrincipal, aResult);
     45 }
     46 
     47 //----------------------------------------------------------------------
     48 // nsINode methods
     49 
     50 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateTransformElement)
     51 
     52 //----------------------------------------------------------------------
     53 
     54 SMILAnimationFunction& SVGAnimateTransformElement::AnimationFunction() {
     55  return mAnimationFunction;
     56 }
     57 
     58 }  // namespace mozilla::dom