LCOV - code coverage report
Current view: directory - objdir/dist/include - nsClientRect.h (source / functions) Found Hit Coverage
Test: app.info Lines: 3 0 0.0 %
Date: 2012-06-02 Functions: 1 0 0.0 %

       1                 : /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is Novell code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Novell Corporation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 2006
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Robert O'Callahan <robert@ocallahan.org>
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      27                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #ifndef NSCLIENTRECT_H_
      40                 : #define NSCLIENTRECT_H_
      41                 : 
      42                 : #include "nsIDOMClientRect.h"
      43                 : #include "nsIDOMClientRectList.h"
      44                 : #include "nsCOMArray.h"
      45                 : #include "nsRect.h"
      46                 : #include "nsCOMPtr.h"
      47                 : #include "nsWrapperCache.h"
      48                 : #include "nsCycleCollectionParticipant.h"
      49                 : 
      50                 : class nsClientRect : public nsIDOMClientRect
      51                 : {
      52                 : public:
      53                 :   NS_DECL_ISUPPORTS
      54                 : 
      55                 :   nsClientRect();
      56                 :   void SetRect(float aX, float aY, float aWidth, float aHeight) {
      57                 :     mX = aX; mY = aY; mWidth = aWidth; mHeight = aHeight;
      58                 :   }
      59                 :   virtual ~nsClientRect() {}
      60                 :   
      61                 :   NS_DECL_NSIDOMCLIENTRECT
      62                 : 
      63                 :   void SetLayoutRect(const nsRect& aLayoutRect);
      64                 : 
      65                 : protected:
      66                 :   float mX, mY, mWidth, mHeight;
      67                 : };
      68                 : 
      69                 : class nsClientRectList MOZ_FINAL : public nsIDOMClientRectList,
      70                 :                                    public nsWrapperCache
      71                 : {
      72                 : public:
      73               0 :   nsClientRectList(nsISupports *aParent) : mParent(aParent)
      74                 :   {
      75               0 :     SetIsProxy();
      76               0 :   }
      77                 : 
      78                 :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      79                 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsClientRectList)
      80                 : 
      81                 :   NS_DECL_NSIDOMCLIENTRECTLIST
      82                 :   
      83                 :   virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
      84                 :                                bool *triedToWrap);
      85                 : 
      86                 :   nsISupports* GetParentObject()
      87                 :   {
      88                 :     return mParent;
      89                 :   }
      90                 : 
      91                 :   void Append(nsIDOMClientRect* aElement) { mArray.AppendObject(aElement); }
      92                 : 
      93                 :   static nsClientRectList* FromSupports(nsISupports* aSupports)
      94                 :   {
      95                 : #ifdef DEBUG
      96                 :     {
      97                 :       nsCOMPtr<nsIDOMClientRectList> list_qi = do_QueryInterface(aSupports);
      98                 : 
      99                 :       // If this assertion fires the QI implementation for the object in
     100                 :       // question doesn't use the nsIDOMClientRectList pointer as the nsISupports
     101                 :       // pointer. That must be fixed, or we'll crash...
     102                 :       NS_ASSERTION(list_qi == static_cast<nsIDOMClientRectList*>(aSupports),
     103                 :                    "Uh, fix QI!");
     104                 :     }
     105                 : #endif
     106                 : 
     107                 :     return static_cast<nsClientRectList*>(aSupports);
     108                 :   }
     109                 : 
     110                 : protected:
     111                 :   virtual ~nsClientRectList() {}
     112                 : 
     113                 :   nsCOMArray<nsIDOMClientRect> mArray;
     114                 :   nsCOMPtr<nsISupports> mParent;
     115                 : };
     116                 : 
     117                 : #endif /*NSCLIENTRECT_H_*/

Generated by: LCOV version 1.7