LCOV - code coverage report
Current view: directory - content/html/content/src - nsHTMLTableElement.h (source / functions) Found Hit Coverage
Test: app.info Lines: 13 1 7.7 %
Date: 2012-06-02 Functions: 102 1 1.0 %

       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                 :  *
      24                 :  * Alternatively, the contents of this file may be used under the terms of
      25                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      26                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      28                 :  * of those above. If you wish to allow use of your version of this file only
      29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      30                 :  * use your version of this file under the terms of the MPL, indicate your
      31                 :  * decision by deleting the provisions above and replace them with the notice
      32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      33                 :  * the provisions above, a recipient may use your version of this file under
      34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      35                 :  *
      36                 :  * ***** END LICENSE BLOCK ***** */
      37                 : #include "nsIDOMHTMLTableElement.h"
      38                 : #include "nsGenericHTMLElement.h"
      39                 : #include "nsMappedAttributes.h"
      40                 : 
      41                 : #define TABLE_ATTRS_DIRTY ((nsMappedAttributes*)0x1)
      42                 : 
      43                 : 
      44                 : class TableRowsCollection;
      45                 : 
      46                 : class nsHTMLTableElement :  public nsGenericHTMLElement,
      47                 :                             public nsIDOMHTMLTableElement
      48                 : {
      49                 : public:
      50                 :   nsHTMLTableElement(already_AddRefed<nsINodeInfo> aNodeInfo);
      51                 :   virtual ~nsHTMLTableElement();
      52                 : 
      53                 :   // nsISupports
      54                 :   NS_DECL_ISUPPORTS_INHERITED
      55                 : 
      56                 :   // nsIDOMNode
      57               0 :   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
      58                 : 
      59                 :   // nsIDOMElement
      60               0 :   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
      61                 : 
      62                 :   // nsIDOMHTMLElement
      63               0 :   NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
      64                 : 
      65                 :   // nsIDOMHTMLTableElement
      66                 :   NS_DECL_NSIDOMHTMLTABLEELEMENT
      67                 : 
      68                 :   virtual bool ParseAttribute(PRInt32 aNamespaceID,
      69                 :                                 nsIAtom* aAttribute,
      70                 :                                 const nsAString& aValue,
      71                 :                                 nsAttrValue& aResult);
      72                 :   virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
      73                 :   NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
      74                 : 
      75                 :   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
      76                 : 
      77                 :   virtual nsXPCClassInfo* GetClassInfo();
      78                 :   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
      79                 :                               nsIContent* aBindingParent,
      80                 :                               bool aCompileEventHandlers);
      81                 :   virtual void UnbindFromTree(bool aDeep = true,
      82                 :                               bool aNullParent = true);
      83                 :   /**
      84                 :    * Called when an attribute is about to be changed
      85                 :    */
      86                 :   virtual nsresult BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
      87                 :                                  const nsAttrValueOrString* aValue,
      88                 :                                  bool aNotify);
      89                 :   /**
      90                 :    * Called when an attribute has just been changed
      91                 :    */
      92                 :   virtual nsresult AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
      93                 :                                 const nsAttrValue* aValue, bool aNotify);
      94                 : 
      95            1464 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLTableElement,
      96                 :                                            nsGenericHTMLElement)
      97                 :   nsMappedAttributes* GetAttributesMappedForCell();
      98               0 :   already_AddRefed<nsIDOMHTMLTableSectionElement> GetTHead() {
      99               0 :     return GetSection(nsGkAtoms::thead);
     100                 :   }
     101               0 :   already_AddRefed<nsIDOMHTMLTableSectionElement> GetTFoot() {
     102               0 :     return GetSection(nsGkAtoms::tfoot);
     103                 :   }
     104                 :   already_AddRefed<nsIDOMHTMLTableCaptionElement> GetCaption();
     105                 :   nsContentList* TBodies();
     106                 : protected:
     107                 :   already_AddRefed<nsIDOMHTMLTableSectionElement> GetSection(nsIAtom *aTag);
     108                 : 
     109                 :   nsRefPtr<nsContentList> mTBodies;
     110                 :   nsRefPtr<TableRowsCollection> mRows;
     111                 :   // Sentinel value of TABLE_ATTRS_DIRTY indicates that this is dirty and needs
     112                 :   // to be recalculated.
     113                 :   nsMappedAttributes *mTableInheritedAttributes;
     114                 :   void BuildInheritedAttributes();
     115               0 :   void ReleaseInheritedAttributes() {
     116               0 :     if (mTableInheritedAttributes &&
     117                 :         mTableInheritedAttributes != TABLE_ATTRS_DIRTY)
     118               0 :       NS_RELEASE(mTableInheritedAttributes);
     119               0 :       mTableInheritedAttributes = TABLE_ATTRS_DIRTY;
     120               0 :   }
     121                 : };
     122                 : 

Generated by: LCOV version 1.7