2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-03-26 08:52:41 -07:00
|
|
|
#ifndef mozilla_dom_SVGRect_h
|
|
|
|
#define mozilla_dom_SVGRect_h
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-03-26 08:53:13 -07:00
|
|
|
#include "mozilla/dom/SVGIRect.h"
|
2014-03-17 19:41:33 -07:00
|
|
|
#include "mozilla/gfx/Rect.h"
|
2013-05-09 10:42:12 -07:00
|
|
|
#include "nsSVGElement.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2007-09-05 16:07:34 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
2013-03-26 08:52:41 -07:00
|
|
|
// SVGRect class
|
2007-09-05 16:07:34 -07:00
|
|
|
|
2013-03-26 08:52:41 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2013-03-26 08:53:13 -07:00
|
|
|
class SVGRect MOZ_FINAL : public SVGIRect
|
2007-09-05 16:07:34 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-08-31 18:08:04 -07:00
|
|
|
explicit SVGRect(nsIContent* aParent, float x=0.0f, float y=0.0f, float w=0.0f,
|
|
|
|
float h=0.0f);
|
2007-09-05 16:07:34 -07:00
|
|
|
|
2013-05-16 11:06:21 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(SVGRect)
|
2007-09-05 16:07:34 -07:00
|
|
|
|
2013-03-26 08:53:13 -07: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;
|
|
|
|
}
|
|
|
|
|
2013-05-16 11:06:21 -07:00
|
|
|
virtual nsIContent* GetParentObject() const
|
|
|
|
{
|
|
|
|
return mParent;
|
|
|
|
}
|
|
|
|
|
2007-09-05 16:07:34 -07:00
|
|
|
protected:
|
2014-06-24 09:36:45 -07:00
|
|
|
~SVGRect() {}
|
|
|
|
|
2013-05-16 11:06:21 -07:00
|
|
|
nsCOMPtr<nsIContent> mParent;
|
2007-09-05 16:07:34 -07:00
|
|
|
float mX, mY, mWidth, mHeight;
|
|
|
|
};
|
|
|
|
|
2013-03-26 08:52:41 -07:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2013-04-18 04:40:09 -07:00
|
|
|
already_AddRefed<mozilla::dom::SVGRect>
|
2013-05-09 10:42:12 -07:00
|
|
|
NS_NewSVGRect(nsIContent* aParent, float x=0.0f, float y=0.0f,
|
|
|
|
float width=0.0f, float height=0.0f);
|
2013-03-26 08:53:13 -07:00
|
|
|
|
2013-04-18 04:40:09 -07:00
|
|
|
already_AddRefed<mozilla::dom::SVGRect>
|
2014-03-17 19:41:33 -07:00
|
|
|
NS_NewSVGRect(nsIContent* aParent, const mozilla::gfx::Rect& rect);
|
2013-03-26 08:53:13 -07:00
|
|
|
|
2013-03-26 08:52:41 -07:00
|
|
|
#endif //mozilla_dom_SVGRect_h
|