LCOV - code coverage report
Current view: directory - content/events/src - nsPaintRequest.h (source / functions) Found Hit Coverage
Test: app.info Lines: 19 1 5.3 %
Date: 2012-06-02 Functions: 14 1 7.1 %

       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 Mozilla code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Mozilla Corporation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 2009
      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 NSPAINTREQUEST_H_
      40                 : #define NSPAINTREQUEST_H_
      41                 : 
      42                 : #include "nsIDOMPaintRequest.h"
      43                 : #include "nsIDOMPaintRequestList.h"
      44                 : #include "nsPresContext.h"
      45                 : #include "nsIDOMEvent.h"
      46                 : #include "dombindings.h"
      47                 : 
      48                 : class nsPaintRequest : public nsIDOMPaintRequest
      49                 : {
      50                 : public:
      51                 :   NS_DECL_ISUPPORTS
      52                 :   NS_DECL_NSIDOMPAINTREQUEST
      53                 : 
      54               0 :   nsPaintRequest() { mRequest.mFlags = 0; }
      55                 : 
      56               0 :   void SetRequest(const nsInvalidateRequestList::Request& aRequest)
      57               0 :   { mRequest = aRequest; }
      58                 : 
      59                 : private:
      60               0 :   ~nsPaintRequest() {}
      61                 : 
      62                 :   nsInvalidateRequestList::Request mRequest;
      63                 : };
      64                 : 
      65                 : class nsPaintRequestList MOZ_FINAL : public nsIDOMPaintRequestList,
      66                 :                                      public nsWrapperCache
      67                 : {
      68                 : public:
      69               0 :   nsPaintRequestList(nsIDOMEvent *aParent) : mParent(aParent)
      70                 :   {
      71               0 :     SetIsProxy();
      72               0 :   }
      73                 : 
      74               0 :   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
      75            1464 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsPaintRequestList)
      76                 :   NS_DECL_NSIDOMPAINTREQUESTLIST
      77                 :   
      78               0 :   virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
      79                 :                                bool *triedToWrap)
      80                 :   {
      81                 :     return mozilla::dom::binding::PaintRequestList::create(cx, scope, this,
      82               0 :                                                            triedToWrap);
      83                 :   }
      84                 : 
      85               0 :   nsISupports* GetParentObject()
      86                 :   {
      87               0 :     return mParent;
      88                 :   }
      89                 : 
      90               0 :   void Append(nsIDOMPaintRequest* aElement) { mArray.AppendObject(aElement); }
      91                 : 
      92               0 :   static nsPaintRequestList* FromSupports(nsISupports* aSupports)
      93                 :   {
      94                 : #ifdef DEBUG
      95                 :     {
      96               0 :       nsCOMPtr<nsIDOMPaintRequestList> list_qi = do_QueryInterface(aSupports);
      97                 : 
      98                 :       // If this assertion fires the QI implementation for the object in
      99                 :       // question doesn't use the nsIDOMClientRectList pointer as the nsISupports
     100                 :       // pointer. That must be fixed, or we'll crash...
     101               0 :       NS_ASSERTION(list_qi == static_cast<nsIDOMPaintRequestList*>(aSupports),
     102                 :                    "Uh, fix QI!");
     103                 :     }
     104                 : #endif
     105                 : 
     106               0 :     return static_cast<nsPaintRequestList*>(aSupports);
     107                 :   }
     108                 : 
     109                 : private:
     110               0 :   ~nsPaintRequestList() {}
     111                 : 
     112                 :   nsCOMArray<nsIDOMPaintRequest> mArray;
     113                 :   nsCOMPtr<nsIDOMEvent> mParent;
     114                 : };
     115                 : 
     116                 : #endif /*NSPAINTREQUEST_H_*/

Generated by: LCOV version 1.7