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
|
|
|
|
|
2016-06-07 23:10:18 +03:00
|
|
|
#include "nsAutoPtr.h"
|
2018-12-27 02:46:38 +03:00
|
|
|
#include "SVGAnimatedTransformList.h"
|
2013-12-27 00:13:57 +04:00
|
|
|
#include "gfxMatrix.h"
|
2018-12-27 20:30:38 +03:00
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "mozilla/dom/SVGElement.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
|
|
|
|
2018-12-23 14:08:14 +03:00
|
|
|
class DOMSVGAnimatedTransformList;
|
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
|
|
|
|
2018-12-21 11:58:14 +03:00
|
|
|
class SVGTransformableElement : public SVGElement {
|
2013-01-03 10:17:02 +04:00
|
|
|
public:
|
2018-09-21 23:45:49 +03:00
|
|
|
explicit SVGTransformableElement(already_AddRefed<dom::NodeInfo>&& aNodeInfo)
|
2018-12-21 11:58:14 +03:00
|
|
|
: SVGElement(std::move(aNodeInfo)) {}
|
2013-01-03 10:17:02 +04:00
|
|
|
virtual ~SVGTransformableElement() {}
|
|
|
|
|
2018-08-09 02:58:44 +03:00
|
|
|
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override = 0;
|
2013-03-31 06:27:27 +04:00
|
|
|
|
2013-01-03 10:17:02 +04:00
|
|
|
// WebIDL
|
2018-12-23 14:08:14 +03:00
|
|
|
already_AddRefed<DOMSVGAnimatedTransformList> Transform();
|
2018-12-21 11:58:14 +03:00
|
|
|
SVGElement* GetNearestViewportElement();
|
|
|
|
SVGElement* GetFarthestViewportElement();
|
2018-01-12 07:01:20 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2017-07-06 15:00:35 +03:00
|
|
|
already_AddRefed<SVGIRect> GetBBox(const SVGBoundingBoxOptions& aOptions,
|
2014-05-13 05:24:35 +04:00
|
|
|
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
|
2017-10-03 01:05:19 +03:00
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
|
2013-01-06 10:25:54 +04:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t aModType) const override;
|
2013-01-06 10:25:54 +04:00
|
|
|
|
2018-12-21 11:58:14 +03:00
|
|
|
// SVGElement overrides
|
2017-10-03 01:05:19 +03:00
|
|
|
virtual bool IsEventAttributeNameInternal(nsAtom* aName) override;
|
2013-01-06 10:25:54 +04:00
|
|
|
|
2015-12-03 01:36:23 +03:00
|
|
|
virtual gfxMatrix PrependLocalTransformsTo(
|
|
|
|
const gfxMatrix& aMatrix,
|
|
|
|
SVGTransformTypes aWhich = eAllTransforms) const override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual const gfx::Matrix* GetAnimateMotionTransform() const override;
|
|
|
|
virtual void SetAnimateMotionTransform(const gfx::Matrix* aMatrix) override;
|
2013-01-06 10:25:54 +04:00
|
|
|
|
2018-12-27 02:46:38 +03:00
|
|
|
virtual SVGAnimatedTransformList* GetAnimatedTransformList(
|
2015-03-21 19:28:04 +03:00
|
|
|
uint32_t aFlags = 0) override;
|
2018-03-29 12:45:24 +03:00
|
|
|
virtual nsStaticAtom* 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:
|
2017-02-23 11:35:08 +03:00
|
|
|
/**
|
|
|
|
* Helper for overrides of PrependLocalTransformsTo. If both arguments are
|
|
|
|
* provided they are multiplied in the order in which the arguments appear,
|
|
|
|
* and the result is returned. If neither argument is provided, the identity
|
|
|
|
* matrix is returned. If only one argument is provided its transform is
|
|
|
|
* returned.
|
|
|
|
*/
|
|
|
|
static gfxMatrix GetUserToParentTransform(
|
|
|
|
const gfx::Matrix* aAnimateMotionTransform,
|
2018-12-27 02:46:38 +03:00
|
|
|
const SVGAnimatedTransformList* aTransforms);
|
2017-02-23 11:35:08 +03:00
|
|
|
|
2018-12-27 02:46:38 +03:00
|
|
|
nsAutoPtr<SVGAnimatedTransformList> 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
|