tor-browser

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

SVGOrientSMILType.h (2066B)


      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 #ifndef DOM_SVG_SVGORIENTSMILTYPE_H_
      8 #define DOM_SVG_SVGORIENTSMILTYPE_H_
      9 
     10 #include "mozilla/SMILType.h"
     11 
     12 /**
     13 * This SMILType class is a special case for the 'orient' attribute on SVG's
     14 * 'marker' element.
     15 *
     16 *   orient = "auto | auto-start-reverse | <angle>"
     17 *
     18 * Unusually, this attribute doesn't have just a single corresponding DOM
     19 * property, but rather is split into two properties: 'orientType' (of type
     20 * DOMSVGAnimatedEnumeration) and 'orientAngle' (of type DOMSVGAnimatedAngle).
     21 * If 'orientType.animVal' is SVG_MARKER_ORIENT_ANGLE, then
     22 * 'orientAngle.animVal' contains the angle that is being used. The lacuna
     23 * value is 0.
     24 */
     25 
     26 namespace mozilla {
     27 
     28 class SMILValue;
     29 
     30 class SVGOrientSMILType : public SMILType {
     31 public:
     32  // Singleton for SMILValue objects to hold onto.
     33  static SVGOrientSMILType sSingleton;
     34 
     35 protected:
     36  // SMILType Methods
     37  // -------------------
     38  void InitValue(SMILValue& aValue) const override;
     39  void DestroyValue(SMILValue&) const override;
     40  nsresult Assign(SMILValue& aDest, const SMILValue& aSrc) const override;
     41  bool IsEqual(const SMILValue& aLeft, const SMILValue& aRight) const override;
     42  nsresult Add(SMILValue& aDest, const SMILValue& aValueToAdd,
     43               uint32_t aCount) const override;
     44  nsresult ComputeDistance(const SMILValue& aFrom, const SMILValue& aTo,
     45                           double& aDistance) const override;
     46  nsresult Interpolate(const SMILValue& aStartVal, const SMILValue& aEndVal,
     47                       double aUnitDistance, SMILValue& aResult) const override;
     48 
     49 private:
     50  // Private constructor: prevent instances beyond my singleton.
     51  constexpr SVGOrientSMILType() = default;
     52 };
     53 
     54 }  // namespace mozilla
     55 
     56 #endif  // DOM_SVG_SVGORIENTSMILTYPE_H_