Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #include "mozilla/dom/SVGRect.h"
8 : #include "nsSVGElement.h"
9 :
10 : using namespace mozilla::gfx;
11 :
12 : namespace mozilla {
13 : namespace dom {
14 :
15 : //----------------------------------------------------------------------
16 : // implementation:
17 :
18 0 : SVGRect::SVGRect(nsIContent* aParent, float x, float y, float w, float h)
19 0 : : SVGIRect(), mParent(aParent), mX(x), mY(y), mWidth(w), mHeight(h)
20 : {
21 0 : }
22 :
23 : //----------------------------------------------------------------------
24 : // nsISupports methods:
25 :
26 0 : NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(SVGRect, mParent)
27 :
28 0 : NS_IMPL_CYCLE_COLLECTING_ADDREF(SVGRect)
29 0 : NS_IMPL_CYCLE_COLLECTING_RELEASE(SVGRect)
30 :
31 0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SVGRect)
32 0 : NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
33 0 : NS_INTERFACE_MAP_ENTRY(nsISupports)
34 0 : NS_INTERFACE_MAP_END
35 :
36 : } // namespace dom
37 : } // namespace mozilla
38 :
39 : ////////////////////////////////////////////////////////////////////////
40 : // Exported creation functions:
41 :
42 : already_AddRefed<mozilla::dom::SVGRect>
43 0 : NS_NewSVGRect(nsIContent* aParent, float aX, float aY, float aWidth,
44 : float aHeight)
45 : {
46 : RefPtr<mozilla::dom::SVGRect> rect =
47 0 : new mozilla::dom::SVGRect(aParent, aX, aY, aWidth, aHeight);
48 :
49 0 : return rect.forget();
50 : }
51 :
52 : already_AddRefed<mozilla::dom::SVGRect>
53 0 : NS_NewSVGRect(nsIContent* aParent, const Rect& aRect)
54 : {
55 0 : return NS_NewSVGRect(aParent, aRect.x, aRect.y,
56 0 : aRect.width, aRect.height);
57 : }
58 :
|