LCOV - code coverage report
Current view: top level - dom/html - HTMLFrameSetElement.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 18 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef HTMLFrameSetElement_h
       8             : #define HTMLFrameSetElement_h
       9             : 
      10             : #include "mozilla/Attributes.h"
      11             : #include "mozilla/UniquePtr.h"
      12             : #include "nsIDOMHTMLFrameSetElement.h"
      13             : #include "nsGenericHTMLElement.h"
      14             : 
      15             : /**
      16             :  * The nsFramesetUnit enum is used to denote the type of each entry
      17             :  * in the row or column spec.
      18             :  */
      19             : enum nsFramesetUnit {
      20             :   eFramesetUnit_Fixed = 0,
      21             :   eFramesetUnit_Percent,
      22             :   eFramesetUnit_Relative
      23             : };
      24             : 
      25             : /**
      26             :  * The nsFramesetSpec struct is used to hold a single entry in the
      27             :  * row or column spec.
      28             :  */
      29             : struct nsFramesetSpec {
      30             :   nsFramesetUnit mUnit;
      31             :   nscoord        mValue;
      32             : };
      33             : 
      34             : /**
      35             :  * The maximum number of entries allowed in the frame set element row
      36             :  * or column spec.
      37             :  */
      38             : #define NS_MAX_FRAMESET_SPEC_COUNT 16000
      39             : 
      40             : //----------------------------------------------------------------------
      41             : 
      42             : namespace mozilla {
      43             : namespace dom {
      44             : 
      45             : class OnBeforeUnloadEventHandlerNonNull;
      46             : 
      47             : class HTMLFrameSetElement final : public nsGenericHTMLElement,
      48             :                                   public nsIDOMHTMLFrameSetElement
      49             : {
      50             : public:
      51           0 :   explicit HTMLFrameSetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
      52           0 :     : nsGenericHTMLElement(aNodeInfo),
      53             :       mNumRows(0),
      54             :       mNumCols(0),
      55           0 :       mCurrentRowColHint(NS_STYLE_HINT_REFLOW)
      56             :   {
      57           0 :     SetHasWeirdParserInsertionMode();
      58           0 :   }
      59             : 
      60           0 :   NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLFrameSetElement, frameset)
      61             : 
      62             :   // nsISupports
      63             :   NS_DECL_ISUPPORTS_INHERITED
      64             : 
      65             :   // nsIDOMHTMLFrameSetElement
      66             :   NS_DECL_NSIDOMHTMLFRAMESETELEMENT
      67             : 
      68           0 :   void GetCols(DOMString& aCols)
      69             :   {
      70           0 :     GetHTMLAttr(nsGkAtoms::cols, aCols);
      71           0 :   }
      72           0 :   void SetCols(const nsAString& aCols, ErrorResult& aError)
      73             :   {
      74           0 :     SetHTMLAttr(nsGkAtoms::cols, aCols, aError);
      75           0 :   }
      76           0 :   void GetRows(DOMString& aRows)
      77             :   {
      78           0 :     GetHTMLAttr(nsGkAtoms::rows, aRows);
      79           0 :   }
      80           0 :   void SetRows(const nsAString& aRows, ErrorResult& aError)
      81             :   {
      82           0 :     SetHTMLAttr(nsGkAtoms::rows, aRows, aError);
      83           0 :   }
      84             : 
      85             :   virtual bool IsEventAttributeNameInternal(nsIAtom *aName) override;
      86             : 
      87             :   // Event listener stuff; we need to declare only the ones we need to
      88             :   // forward to window that don't come from nsIDOMHTMLFrameSetElement.
      89             : #define EVENT(name_, id_, type_, struct_) /* nothing; handled by the superclass */
      90             : #define WINDOW_EVENT_HELPER(name_, type_)                               \
      91             :   type_* GetOn##name_();                                                \
      92             :   void SetOn##name_(type_* handler);
      93             : #define WINDOW_EVENT(name_, id_, type_, struct_)                        \
      94             :   WINDOW_EVENT_HELPER(name_, EventHandlerNonNull)
      95             : #define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_)                  \
      96             :   WINDOW_EVENT_HELPER(name_, OnBeforeUnloadEventHandlerNonNull)
      97             : #include "mozilla/EventNameList.h" // IWYU pragma: keep
      98             : #undef BEFOREUNLOAD_EVENT
      99             : #undef WINDOW_EVENT
     100             : #undef WINDOW_EVENT_HELPER
     101             : #undef EVENT
     102             : 
     103             :    /**
     104             :     * GetRowSpec is used to get the "rows" spec.
     105             :     * @param out int32_t aNumValues The number of row sizes specified.
     106             :     * @param out nsFramesetSpec* aSpecs The array of size specifications.
     107             :              This is _not_ owned by the caller, but by the nsFrameSetElement
     108             :              implementation.  DO NOT DELETE IT.
     109             :     */
     110             :   nsresult GetRowSpec(int32_t *aNumValues, const nsFramesetSpec** aSpecs);
     111             :    /**
     112             :     * GetColSpec is used to get the "cols" spec
     113             :     * @param out int32_t aNumValues The number of row sizes specified.
     114             :     * @param out nsFramesetSpec* aSpecs The array of size specifications.
     115             :              This is _not_ owned by the caller, but by the nsFrameSetElement
     116             :              implementation.  DO NOT DELETE IT.
     117             :     */
     118             :   nsresult GetColSpec(int32_t *aNumValues, const nsFramesetSpec** aSpecs);
     119             : 
     120             : 
     121             :   virtual bool ParseAttribute(int32_t aNamespaceID,
     122             :                                 nsIAtom* aAttribute,
     123             :                                 const nsAString& aValue,
     124             :                                 nsAttrValue& aResult) override;
     125             :   virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
     126             :                                               int32_t aModType) const override;
     127             : 
     128             :   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
     129             :                          bool aPreallocateChildren) const override;
     130             : 
     131             : protected:
     132             :   virtual ~HTMLFrameSetElement();
     133             : 
     134             :   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
     135             : 
     136             :   virtual nsresult BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName,
     137             :                                  const nsAttrValueOrString* aValue,
     138             :                                  bool aNotify) override;
     139             : 
     140             : private:
     141             :   nsresult ParseRowCol(const nsAString& aValue,
     142             :                        int32_t& aNumSpecs,
     143             :                        UniquePtr<nsFramesetSpec[]>* aSpecs);
     144             : 
     145             :   /**
     146             :    * The number of size specs in our "rows" attr
     147             :    */
     148             :   int32_t          mNumRows;
     149             :   /**
     150             :    * The number of size specs in our "cols" attr
     151             :    */
     152             :   int32_t          mNumCols;
     153             :   /**
     154             :    * The style hint to return for the rows/cols attrs in
     155             :    * GetAttributeChangeHint
     156             :    */
     157             :   nsChangeHint      mCurrentRowColHint;
     158             :   /**
     159             :    * The parsed representation of the "rows" attribute
     160             :    */
     161             :   UniquePtr<nsFramesetSpec[]>  mRowSpecs; // parsed, non-computed dimensions
     162             :   /**
     163             :    * The parsed representation of the "cols" attribute
     164             :    */
     165             :   UniquePtr<nsFramesetSpec[]>  mColSpecs; // parsed, non-computed dimensions
     166             : };
     167             : 
     168             : } // namespace dom
     169             : } // namespace mozilla
     170             : 
     171             : #endif // HTMLFrameSetElement_h

Generated by: LCOV version 1.13