LCOV - code coverage report
Current view: directory - content/html/content/src - nsHTMLFrameSetElement.h (source / functions) Found Hit Coverage
Test: app.info Lines: 7 0 0.0 %
Date: 2012-06-02 Functions: 98 0 0.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                 :  * Boris Zbarsky <bzbarsky@mit.edu>  (Original author)
      24                 :  * Sebastian Kromp <46b@gulli.com>
      25                 :  *
      26                 :  * Alternatively, the contents of this file may be used under the terms of
      27                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      28                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      29                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      30                 :  * of those above. If you wish to allow use of your version of this file only
      31                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      32                 :  * use your version of this file under the terms of the MPL, indicate your
      33                 :  * decision by deleting the provisions above and replace them with the notice
      34                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      35                 :  * the provisions above, a recipient may use your version of this file under
      36                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      37                 :  *
      38                 :  * ***** END LICENSE BLOCK ***** */
      39                 : 
      40                 : #ifndef nsHTMLFrameSetElement_h
      41                 : #define nsHTMLFrameSetElement_h
      42                 : 
      43                 : #include "nsISupports.h"
      44                 : #include "nsIDOMHTMLFrameSetElement.h"
      45                 : #include "nsIDOMEventTarget.h"
      46                 : #include "nsGenericHTMLElement.h"
      47                 : #include "nsGkAtoms.h"
      48                 : #include "nsStyleConsts.h"
      49                 : #include "nsIHTMLDocument.h"
      50                 : #include "nsIDocument.h"
      51                 : 
      52                 : /**
      53                 :  * The nsFramesetUnit enum is used to denote the type of each entry
      54                 :  * in the row or column spec.
      55                 :  */
      56                 : enum nsFramesetUnit {
      57                 :   eFramesetUnit_Fixed = 0,
      58                 :   eFramesetUnit_Percent,
      59                 :   eFramesetUnit_Relative
      60                 : };
      61                 : 
      62                 : /**
      63                 :  * The nsFramesetSpec struct is used to hold a single entry in the
      64                 :  * row or column spec.
      65                 :  */
      66                 : struct nsFramesetSpec {
      67                 :   nsFramesetUnit mUnit;
      68                 :   nscoord        mValue;
      69                 : };
      70                 : 
      71                 : /**
      72                 :  * The maximum number of entries allowed in the frame set element row
      73                 :  * or column spec.
      74                 :  */
      75                 : #define NS_MAX_FRAMESET_SPEC_COUNT 16000
      76                 : 
      77                 : //----------------------------------------------------------------------
      78                 : 
      79                 : class nsHTMLFrameSetElement : public nsGenericHTMLElement,
      80                 :                               public nsIDOMHTMLFrameSetElement
      81                 : {
      82                 : public:
      83                 :   nsHTMLFrameSetElement(already_AddRefed<nsINodeInfo> aNodeInfo);
      84                 :   virtual ~nsHTMLFrameSetElement();
      85                 : 
      86                 :   // nsISupports
      87                 :   NS_DECL_ISUPPORTS_INHERITED
      88                 : 
      89                 :   // nsIDOMNode
      90               0 :   NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
      91                 : 
      92                 :   // nsIDOMElement
      93               0 :   NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
      94                 : 
      95                 :   // nsIDOMHTMLElement
      96               0 :   NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
      97                 : 
      98                 :   // nsIDOMHTMLFrameSetElement
      99                 :   NS_DECL_NSIDOMHTMLFRAMESETELEMENT
     100                 : 
     101                 :   // Event listener stuff; we need to declare only the ones we need to
     102                 :   // forward to window that don't come from nsIDOMHTMLFrameSetElement.
     103                 : #define EVENT(name_, id_, type_, struct_) /* nothing; handled by the superclass */
     104                 : #define FORWARDED_EVENT(name_, id_, type_, struct_)                     \
     105                 :     NS_IMETHOD GetOn##name_(JSContext *cx, jsval *vp);            \
     106                 :     NS_IMETHOD SetOn##name_(JSContext *cx, const jsval &v);
     107                 : #include "nsEventNameList.h"
     108                 : #undef FORWARDED_EVENT
     109                 : #undef EVENT
     110                 : 
     111                 :   // These override the SetAttr methods in nsGenericHTMLElement (need
     112                 :   // both here to silence compiler warnings).
     113                 :   nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
     114                 :                    const nsAString& aValue, bool aNotify)
     115                 :   {
     116                 :     return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify);
     117                 :   }
     118                 :   virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
     119                 :                            nsIAtom* aPrefix, const nsAString& aValue,
     120                 :                            bool aNotify);
     121                 : 
     122                 :    /**
     123                 :     * GetRowSpec is used to get the "rows" spec.
     124                 :     * @param out PRInt32 aNumValues The number of row sizes specified.
     125                 :     * @param out nsFramesetSpec* aSpecs The array of size specifications.
     126                 :              This is _not_ owned by the caller, but by the nsFrameSetElement
     127                 :              implementation.  DO NOT DELETE IT.
     128                 :     */
     129                 :   nsresult GetRowSpec(PRInt32 *aNumValues, const nsFramesetSpec** aSpecs);
     130                 :    /**
     131                 :     * GetColSpec is used to get the "cols" spec
     132                 :     * @param out PRInt32 aNumValues The number of row sizes specified.
     133                 :     * @param out nsFramesetSpec* aSpecs The array of size specifications.
     134                 :              This is _not_ owned by the caller, but by the nsFrameSetElement
     135                 :              implementation.  DO NOT DELETE IT.
     136                 :     */
     137                 :   nsresult GetColSpec(PRInt32 *aNumValues, const nsFramesetSpec** aSpecs);
     138                 : 
     139                 : 
     140                 :   virtual bool ParseAttribute(PRInt32 aNamespaceID,
     141                 :                                 nsIAtom* aAttribute,
     142                 :                                 const nsAString& aValue,
     143                 :                                 nsAttrValue& aResult);
     144                 :   virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
     145                 :                                               PRInt32 aModType) const;
     146                 : 
     147                 :   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
     148                 :   virtual nsXPCClassInfo* GetClassInfo();
     149               0 :   static nsHTMLFrameSetElement* FromContent(nsIContent *aContent)
     150                 :   {
     151               0 :     if (aContent->IsHTML(nsGkAtoms::frameset))
     152               0 :       return static_cast<nsHTMLFrameSetElement*>(aContent);
     153               0 :     return nsnull;
     154                 :   }
     155                 : 
     156                 : private:
     157                 :   nsresult ParseRowCol(const nsAString& aValue,
     158                 :                        PRInt32&         aNumSpecs,
     159                 :                        nsFramesetSpec** aSpecs);
     160                 : 
     161                 :   /**
     162                 :    * The number of size specs in our "rows" attr
     163                 :    */
     164                 :   PRInt32          mNumRows;
     165                 :   /**
     166                 :    * The number of size specs in our "cols" attr
     167                 :    */
     168                 :   PRInt32          mNumCols;
     169                 :   /**
     170                 :    * The style hint to return for the rows/cols attrs in
     171                 :    * GetAttributeChangeHint
     172                 :    */
     173                 :   nsChangeHint      mCurrentRowColHint;
     174                 :   /**
     175                 :    * The parsed representation of the "rows" attribute
     176                 :    */
     177                 :   nsAutoArrayPtr<nsFramesetSpec>  mRowSpecs; // parsed, non-computed dimensions
     178                 :   /**
     179                 :    * The parsed representation of the "cols" attribute
     180                 :    */
     181                 :   nsAutoArrayPtr<nsFramesetSpec>  mColSpecs; // parsed, non-computed dimensions
     182                 : };
     183                 : 
     184                 : #endif // nsHTMLFrameSetElement_h

Generated by: LCOV version 1.7