2013-01-02 22:17:02 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
#ifndef SVGTransformableElement_h
|
|
|
|
#define SVGTransformableElement_h
|
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-04-14 15:56:34 -07:00
|
|
|
#include "nsSVGAnimatedTransformList.h"
|
2013-02-01 01:55:45 -08:00
|
|
|
#include "nsSVGElement.h"
|
2013-12-26 12:13:57 -08:00
|
|
|
#include "gfxMatrix.h"
|
2013-12-28 13:37:40 -08:00
|
|
|
#include "mozilla/gfx/Matrix.h"
|
2013-01-02 22:17:02 -08:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2013-02-01 01:55:45 -08:00
|
|
|
|
2013-04-14 15:56:34 -07:00
|
|
|
class SVGAnimatedTransformList;
|
2013-02-01 01:55:45 -08:00
|
|
|
class SVGGraphicsElement;
|
|
|
|
class SVGMatrix;
|
2013-03-26 08:53:13 -07:00
|
|
|
class SVGIRect;
|
2014-06-18 17:57:51 -07:00
|
|
|
struct SVGBoundingBoxOptions;
|
2013-02-01 01:55:45 -08:00
|
|
|
|
|
|
|
class SVGTransformableElement : public nsSVGElement
|
2013-01-02 22:17:02 -08:00
|
|
|
{
|
|
|
|
public:
|
2014-08-31 18:08:04 -07:00
|
|
|
explicit SVGTransformableElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2013-02-01 01:55:45 -08:00
|
|
|
: nsSVGElement(aNodeInfo) {}
|
2013-01-02 22:17:02 -08:00
|
|
|
virtual ~SVGTransformableElement() {}
|
|
|
|
|
2014-06-19 19:01:40 -07:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE = 0;
|
2013-03-30 19:27:27 -07:00
|
|
|
|
2013-01-02 22:17:02 -08:00
|
|
|
// WebIDL
|
2013-04-14 15:56:34 -07:00
|
|
|
already_AddRefed<SVGAnimatedTransformList> Transform();
|
2013-02-01 01:55:45 -08:00
|
|
|
nsSVGElement* GetNearestViewportElement();
|
|
|
|
nsSVGElement* GetFarthestViewportElement();
|
2014-05-12 18:24:35 -07:00
|
|
|
already_AddRefed<SVGIRect> GetBBox(const SVGBoundingBoxOptions& aOptions,
|
|
|
|
ErrorResult& rv);
|
2013-02-01 01:55:45 -08:00
|
|
|
already_AddRefed<SVGMatrix> GetCTM();
|
|
|
|
already_AddRefed<SVGMatrix> GetScreenCTM();
|
|
|
|
already_AddRefed<SVGMatrix> GetTransformToElement(SVGGraphicsElement& aElement,
|
|
|
|
ErrorResult& rv);
|
2013-01-05 22:25:54 -08:00
|
|
|
|
|
|
|
// nsIContent interface
|
2013-05-29 13:43:41 -07:00
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
|
2013-01-05 22:25:54 -08:00
|
|
|
|
|
|
|
nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
2013-05-29 13:43:41 -07:00
|
|
|
int32_t aModType) const MOZ_OVERRIDE;
|
2013-01-05 22:25:54 -08:00
|
|
|
|
|
|
|
|
2014-07-30 14:55:38 -07:00
|
|
|
// nsSVGElement overrides
|
2013-01-05 22:25:54 -08:00
|
|
|
virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
|
2013-12-26 12:13:57 -08:00
|
|
|
virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix,
|
2013-05-29 13:43:41 -07:00
|
|
|
TransformTypes aWhich = eAllTransforms) const MOZ_OVERRIDE;
|
2013-12-28 13:37:40 -08:00
|
|
|
virtual const gfx::Matrix* GetAnimateMotionTransform() const MOZ_OVERRIDE;
|
|
|
|
virtual void SetAnimateMotionTransform(const gfx::Matrix* aMatrix) MOZ_OVERRIDE;
|
2013-01-05 22:25:54 -08:00
|
|
|
|
2013-04-14 15:56:34 -07:00
|
|
|
virtual nsSVGAnimatedTransformList*
|
2013-05-29 13:43:41 -07:00
|
|
|
GetAnimatedTransformList(uint32_t aFlags = 0) MOZ_OVERRIDE;
|
|
|
|
virtual nsIAtom* GetTransformListAttrName() const MOZ_OVERRIDE {
|
2013-01-05 22:25:54 -08:00
|
|
|
return nsGkAtoms::transform;
|
|
|
|
}
|
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
virtual bool IsTransformable() MOZ_OVERRIDE { return true; }
|
2013-03-27 18:23:09 -07:00
|
|
|
|
2013-01-05 22:25:54 -08:00
|
|
|
protected:
|
2013-04-14 15:56:34 -07:00
|
|
|
nsAutoPtr<nsSVGAnimatedTransformList> mTransforms;
|
2013-01-05 22:25:54 -08:00
|
|
|
|
|
|
|
// XXX maybe move this to property table, to save space on un-animated elems?
|
2013-12-28 13:37:40 -08:00
|
|
|
nsAutoPtr<gfx::Matrix> mAnimateMotionTransform;
|
2013-01-02 22:17:02 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // SVGTransformableElement_h
|