2015-05-03 12:32:37 -07: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: */
|
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
|
|
|
#include "mozilla/dom/SVGRect.h"
|
2013-05-09 10:42:12 -07:00
|
|
|
#include "nsSVGElement.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-03-17 19:41:33 -07:00
|
|
|
using namespace mozilla::gfx;
|
|
|
|
|
2013-03-26 08:52:41 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// implementation:
|
|
|
|
|
2013-05-09 10:42:12 -07:00
|
|
|
SVGRect::SVGRect(nsIContent* aParent, float x, float y, float w, float h)
|
2013-05-16 11:06:21 -07:00
|
|
|
: SVGIRect(), mParent(aParent), mX(x), mY(y), mWidth(w), mHeight(h)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// nsISupports methods:
|
|
|
|
|
2014-04-29 01:57:00 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(SVGRect, mParent)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-16 11:06:21 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(SVGRect)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(SVGRect)
|
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SVGRect)
|
|
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
2009-02-03 06:42:24 -08:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
2013-03-26 08:52:41 -07:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// Exported creation functions:
|
|
|
|
|
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 aX, float aY, float aWidth,
|
|
|
|
float aHeight)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2013-04-18 04:40:09 -07:00
|
|
|
nsRefPtr<mozilla::dom::SVGRect> rect =
|
2013-05-09 10:42:12 -07:00
|
|
|
new mozilla::dom::SVGRect(aParent, aX, aY, aWidth, aHeight);
|
2013-04-18 04:40:09 -07:00
|
|
|
|
|
|
|
return rect.forget();
|
2007-03-22 10:30:00 -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 Rect& aRect)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2014-03-17 19:41:33 -07:00
|
|
|
return NS_NewSVGRect(aParent, aRect.x, aRect.y,
|
|
|
|
aRect.width, aRect.height);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|