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