2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-02-19 00:50:59 +03:00
|
|
|
|
|
|
|
#ifndef MOZILLA_SVGORIENTSMILTYPE_H_
|
|
|
|
#define MOZILLA_SVGORIENTSMILTYPE_H_
|
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2010-02-19 00:50:59 +03:00
|
|
|
#include "nsISMILType.h"
|
|
|
|
|
2012-01-26 13:57:21 +04:00
|
|
|
class nsSMILValue;
|
|
|
|
|
2010-02-19 00:50:59 +03:00
|
|
|
/**
|
|
|
|
* This nsISMILType class is a special case for the 'orient' attribute on SVG's
|
|
|
|
* 'marker' element.
|
|
|
|
*
|
2013-07-12 10:39:38 +04:00
|
|
|
* orient = "auto | auto-start-reverse | <angle>"
|
2010-02-19 00:50:59 +03:00
|
|
|
*
|
|
|
|
* Unusually, this attribute doesn't have just a single corresponding DOM
|
|
|
|
* property, but rather is split into two properties: 'orientType' (of type
|
|
|
|
* SVGAnimatedEnumeration) and 'orientAngle' (of type SVGAnimatedAngle). If
|
2013-07-12 10:39:38 +04:00
|
|
|
* 'orientType.animVal' is SVG_MARKER_ORIENT_ANGLE, then
|
2010-02-19 00:50:59 +03:00
|
|
|
* 'orientAngle.animVal' contains the angle that is being used. The lacuna
|
|
|
|
* value is 0.
|
2013-07-12 10:39:38 +04:00
|
|
|
*
|
|
|
|
* The SVG 2 specification does not define a
|
|
|
|
* SVG_MARKER_ORIENT_AUTO_START_REVERSE constant value for orientType to use;
|
|
|
|
* instead, if the attribute is set to "auto-start-reverse",
|
|
|
|
* SVG_MARKER_ORIENT_UNKNOWN is used. Internally, however, we do use a
|
|
|
|
* constant with this name.
|
2010-02-19 00:50:59 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class SVGOrientSMILType : public nsISMILType
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Singleton for nsSMILValue objects to hold onto.
|
|
|
|
static SVGOrientSMILType sSingleton;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// nsISMILType Methods
|
|
|
|
// -------------------
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void Init(nsSMILValue& aValue) const override;
|
|
|
|
virtual void Destroy(nsSMILValue&) const override;
|
|
|
|
virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const override;
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool IsEqual(const nsSMILValue& aLeft,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsSMILValue& aRight) const override;
|
2010-02-19 00:50:59 +03:00
|
|
|
virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
|
2015-03-21 19:28:04 +03:00
|
|
|
uint32_t aCount) const override;
|
2010-02-19 00:50:59 +03:00
|
|
|
virtual nsresult ComputeDistance(const nsSMILValue& aFrom,
|
|
|
|
const nsSMILValue& aTo,
|
2015-03-21 19:28:04 +03:00
|
|
|
double& aDistance) const override;
|
2010-02-19 00:50:59 +03:00
|
|
|
virtual nsresult Interpolate(const nsSMILValue& aStartVal,
|
|
|
|
const nsSMILValue& aEndVal,
|
|
|
|
double aUnitDistance,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsSMILValue& aResult) const override;
|
2010-02-19 00:50:59 +03:00
|
|
|
|
|
|
|
private:
|
2013-08-12 18:13:34 +04:00
|
|
|
// Private constructor: prevent instances beyond my singleton.
|
|
|
|
MOZ_CONSTEXPR SVGOrientSMILType() {}
|
2010-02-19 00:50:59 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // MOZILLA_SVGORIENTSMILTYPE_H_
|