tor-browser

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

SVGMotionSMILAttr.cpp (1502B)


      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 /* representation of a dummy attribute targeted by <animateMotion> element */
      8 
      9 #include "SVGMotionSMILAttr.h"
     10 
     11 #include "SVGMotionSMILType.h"
     12 #include "gfx2DGlue.h"
     13 #include "mozilla/SMILValue.h"
     14 #include "mozilla/dom/SVGAnimationElement.h"
     15 #include "mozilla/dom/SVGElement.h"
     16 #include "nsDebug.h"
     17 
     18 namespace mozilla {
     19 
     20 nsresult SVGMotionSMILAttr::ValueFromString(
     21    const nsAString& aStr, const dom::SVGAnimationElement* aSrcElement,
     22    SMILValue& aValue, bool& aPreventCachingOfSandwich) const {
     23  MOZ_ASSERT_UNREACHABLE(
     24      "Shouldn't using SMILAttr::ValueFromString for "
     25      "parsing animateMotion's SMIL values.");
     26  return NS_ERROR_FAILURE;
     27 }
     28 
     29 SMILValue SVGMotionSMILAttr::GetBaseValue() const {
     30  return SMILValue(&SVGMotionSMILType::sSingleton);
     31 }
     32 
     33 void SVGMotionSMILAttr::ClearAnimValue() {
     34  mSVGElement->SetAnimateMotionTransform(nullptr);
     35 }
     36 
     37 nsresult SVGMotionSMILAttr::SetAnimValue(const SMILValue& aValue) {
     38  gfx::Matrix matrix = SVGMotionSMILType::CreateMatrix(aValue);
     39  mSVGElement->SetAnimateMotionTransform(&matrix);
     40  return NS_OK;
     41 }
     42 
     43 const nsIContent* SVGMotionSMILAttr::GetTargetNode() const {
     44  return mSVGElement;
     45 }
     46 
     47 }  // namespace mozilla