2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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/. */
|
2000-04-01 14:38:51 +00:00
|
|
|
|
2013-03-26 15:52:41 +00:00
|
|
|
#ifndef mozilla_dom_SVGRect_h
|
|
|
|
#define mozilla_dom_SVGRect_h
|
2000-04-01 14:38:51 +00:00
|
|
|
|
2013-03-26 15:53:13 +00:00
|
|
|
#include "mozilla/dom/SVGIRect.h"
|
2014-03-18 02:41:33 +00:00
|
|
|
#include "mozilla/gfx/Rect.h"
|
2013-05-09 17:42:12 +00:00
|
|
|
#include "nsSVGElement.h"
|
2007-01-31 16:05:42 +00:00
|
|
|
|
2007-09-05 23:07:34 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
2013-03-26 15:52:41 +00:00
|
|
|
// SVGRect class
|
2007-09-05 23:07:34 +00:00
|
|
|
|
2013-03-26 15:52:41 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-03-26 15:53:13 +00:00
|
|
|
class SVGRect MOZ_FINAL : public SVGIRect
|
2007-09-05 23:07:34 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-09-01 01:08:04 +00:00
|
|
|
explicit SVGRect(nsIContent* aParent, float x=0.0f, float y=0.0f, float w=0.0f,
|
|
|
|
float h=0.0f);
|
2007-09-05 23:07:34 +00:00
|
|
|
|
2013-05-16 18:06:21 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(SVGRect)
|
2007-09-05 23:07:34 +00:00
|
|
|
|
2013-03-26 15:53:13 +00:00
|
|
|
// WebIDL
|
|
|
|
virtual float X() const MOZ_OVERRIDE MOZ_FINAL
|
|
|
|
{
|
|
|
|
return mX;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void SetX(float aX, ErrorResult& aRv) MOZ_FINAL
|
|
|
|
{
|
|
|
|
mX = aX;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual float Y() const MOZ_OVERRIDE MOZ_FINAL
|
|
|
|
{
|
|
|
|
return mY;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void SetY(float aY, ErrorResult& aRv) MOZ_FINAL
|
|
|
|
{
|
|
|
|
mY = aY;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual float Width() const MOZ_OVERRIDE MOZ_FINAL
|
|
|
|
{
|
|
|
|
return mWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void SetWidth(float aWidth, ErrorResult& aRv) MOZ_FINAL
|
|
|
|
{
|
|
|
|
mWidth = aWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual float Height() const MOZ_OVERRIDE MOZ_FINAL
|
|
|
|
{
|
|
|
|
return mHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void SetHeight(float aHeight, ErrorResult& aRv) MOZ_FINAL
|
|
|
|
{
|
|
|
|
mHeight = aHeight;
|
|
|
|
}
|
|
|
|
|
2015-01-02 06:13:59 +00:00
|
|
|
virtual nsIContent* GetParentObject() const MOZ_OVERRIDE
|
2013-05-16 18:06:21 +00:00
|
|
|
{
|
|
|
|
return mParent;
|
|
|
|
}
|
|
|
|
|
2007-09-05 23:07:34 +00:00
|
|
|
protected:
|
2014-06-24 16:36:45 +00:00
|
|
|
~SVGRect() {}
|
|
|
|
|
2013-05-16 18:06:21 +00:00
|
|
|
nsCOMPtr<nsIContent> mParent;
|
2007-09-05 23:07:34 +00:00
|
|
|
float mX, mY, mWidth, mHeight;
|
|
|
|
};
|
|
|
|
|
2013-03-26 15:52:41 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2013-04-18 11:40:09 +00:00
|
|
|
already_AddRefed<mozilla::dom::SVGRect>
|
2013-05-09 17:42:12 +00:00
|
|
|
NS_NewSVGRect(nsIContent* aParent, float x=0.0f, float y=0.0f,
|
|
|
|
float width=0.0f, float height=0.0f);
|
2013-03-26 15:53:13 +00:00
|
|
|
|
2013-04-18 11:40:09 +00:00
|
|
|
already_AddRefed<mozilla::dom::SVGRect>
|
2014-03-18 02:41:33 +00:00
|
|
|
NS_NewSVGRect(nsIContent* aParent, const mozilla::gfx::Rect& rect);
|
2013-03-26 15:53:13 +00:00
|
|
|
|
2013-03-26 15:52:41 +00:00
|
|
|
#endif //mozilla_dom_SVGRect_h
|