LCOV - code coverage report
Current view: directory - content/xbl/src - nsXBLInsertionPoint.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 40 2 5.0 %
Date: 2012-06-02 Functions: 15 2 13.3 %

       1                 : /* -*- Mode: C++; 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 Communicator client code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Netscape Communications Corporation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 1998
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Original Author: David W. Hyatt (hyatt@netscape.com)
      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                 : #include "nsXBLInsertionPoint.h"
      40                 : #include "nsContentUtils.h"
      41                 : #include "nsXBLBinding.h"
      42                 : 
      43               0 : nsXBLInsertionPoint::nsXBLInsertionPoint(nsIContent* aParentElement,
      44                 :                                          PRUint32 aIndex,
      45                 :                                          nsIContent* aDefaultContent)
      46                 :   : mParentElement(aParentElement),
      47                 :     mIndex(aIndex),
      48               0 :     mDefaultContentTemplate(aDefaultContent)
      49                 : {
      50               0 : }
      51                 : 
      52               0 : nsXBLInsertionPoint::~nsXBLInsertionPoint()
      53                 : {
      54               0 :   if (mDefaultContent) {
      55               0 :     nsXBLBinding::UninstallAnonymousContent(mDefaultContent->OwnerDoc(),
      56               0 :                                             mDefaultContent);
      57                 :   }
      58               0 : }
      59                 : 
      60            1464 : NS_IMPL_CYCLE_COLLECTION_CLASS(nsXBLInsertionPoint)
      61               0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(nsXBLInsertionPoint)
      62               0 :   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mElements)
      63               0 :   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDefaultContentTemplate)
      64               0 :   if (tmp->mDefaultContent) {
      65               0 :     nsXBLBinding::UninstallAnonymousContent(tmp->mDefaultContent->OwnerDoc(),
      66               0 :                                             tmp->mDefaultContent);
      67                 :   }
      68               0 :   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDefaultContent)
      69               0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_END
      70               0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(nsXBLInsertionPoint)
      71               0 :   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mElements)
      72               0 :   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDefaultContentTemplate)
      73               0 :   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDefaultContent)
      74               0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
      75               0 : NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsXBLInsertionPoint, AddRef)
      76               0 : NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsXBLInsertionPoint, Release)
      77                 : 
      78                 : nsIContent*
      79               0 : nsXBLInsertionPoint::GetInsertionParent()
      80                 : {
      81               0 :   return mParentElement;
      82                 : }
      83                 : 
      84                 : nsIContent*
      85               0 : nsXBLInsertionPoint::GetDefaultContent()
      86                 : {
      87               0 :   return mDefaultContent;
      88                 : }
      89                 : 
      90                 : nsIContent*
      91               0 : nsXBLInsertionPoint::GetDefaultContentTemplate()
      92                 : {
      93               0 :   return mDefaultContentTemplate;
      94                 : }
      95                 : 
      96                 : nsIContent*
      97               0 : nsXBLInsertionPoint::ChildAt(PRUint32 aIndex)
      98                 : {
      99               0 :   return mElements.ObjectAt(aIndex);
     100                 : }
     101                 : 
     102                 : bool
     103               0 : nsXBLInsertionPoint::Matches(nsIContent* aContent, PRUint32 aIndex)
     104                 : {
     105               0 :   return (aContent == mParentElement && mIndex != -1 && ((PRInt32)aIndex) == mIndex);
     106                 : }
     107                 : 
     108                 : void
     109               0 : nsXBLInsertionPoint::UnbindDefaultContent()
     110                 : {
     111               0 :   if (!mDefaultContent) {
     112               0 :     return;
     113                 :   }
     114                 : 
     115                 :   // Undo InstallAnonymousContent.
     116               0 :   nsXBLBinding::UninstallAnonymousContent(mDefaultContent->OwnerDoc(),
     117               0 :                                           mDefaultContent);
     118            4392 : }

Generated by: LCOV version 1.7