LCOV - code coverage report
Current view: top level - dom/html - nsGenericHTMLFrameElement.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 7 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 file,
       5             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef nsGenericHTMLFrameElement_h
       8             : #define nsGenericHTMLFrameElement_h
       9             : 
      10             : #include "mozilla/Attributes.h"
      11             : #include "mozilla/ErrorResult.h"
      12             : #include "mozilla/dom/nsBrowserElement.h"
      13             : 
      14             : #include "nsFrameLoader.h"
      15             : #include "nsGenericHTMLElement.h"
      16             : #include "nsIDOMEventListener.h"
      17             : #include "nsIFrameLoader.h"
      18             : #include "nsIMozBrowserFrame.h"
      19             : 
      20             : class nsXULElement;
      21             : 
      22             : /**
      23             :  * A helper class for frame elements
      24             :  */
      25             : class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
      26             :                                   public nsIFrameLoaderOwner,
      27             :                                   public mozilla::nsBrowserElement,
      28             :                                   public nsIMozBrowserFrame
      29             : {
      30             : public:
      31           0 :   nsGenericHTMLFrameElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
      32             :                             mozilla::dom::FromParser aFromParser)
      33           0 :     : nsGenericHTMLElement(aNodeInfo)
      34             :     , nsBrowserElement()
      35           0 :     , mNetworkCreated(aFromParser == mozilla::dom::FROM_PARSER_NETWORK)
      36             :     , mIsPrerendered(false)
      37             :     , mBrowserFrameListenersRegistered(false)
      38             :     , mFrameLoaderCreationDisallowed(false)
      39           0 :     , mReallyIsBrowser(false)
      40             :   {
      41           0 :   }
      42             : 
      43             :   NS_DECL_ISUPPORTS_INHERITED
      44             : 
      45             :   NS_DECL_NSIFRAMELOADEROWNER
      46             :   NS_DECL_NSIDOMMOZBROWSERFRAME
      47             :   NS_DECL_NSIMOZBROWSERFRAME
      48             : 
      49             :   // nsIContent
      50             :   virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) override;
      51             :   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
      52             :                               nsIContent* aBindingParent,
      53             :                               bool aCompileEventHandlers) override;
      54             :   virtual void UnbindFromTree(bool aDeep = true,
      55             :                               bool aNullParent = true) override;
      56             :   virtual void DestroyContent() override;
      57             : 
      58             :   nsresult CopyInnerTo(mozilla::dom::Element* aDest, bool aPreallocateChildren);
      59             : 
      60             :   virtual int32_t TabIndexDefault() override;
      61             : 
      62           0 :   virtual nsIMozBrowserFrame* GetAsMozBrowserFrame() override { return this; }
      63             : 
      64           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsGenericHTMLFrameElement,
      65             :                                            nsGenericHTMLElement)
      66             : 
      67             :   void SwapFrameLoaders(mozilla::dom::HTMLIFrameElement& aOtherLoaderOwner,
      68             :                         mozilla::ErrorResult& aError);
      69             : 
      70             :   void SwapFrameLoaders(nsXULElement& aOtherLoaderOwner,
      71             :                         mozilla::ErrorResult& aError);
      72             : 
      73             :   void SwapFrameLoaders(nsIFrameLoaderOwner* aOtherLoaderOwner,
      74             :                         mozilla::ErrorResult& rv);
      75             : 
      76             :   void PresetOpenerWindow(mozIDOMWindowProxy* aOpenerWindow,
      77             :                           mozilla::ErrorResult& aRv);
      78             : 
      79             :   static void InitStatics();
      80             :   static bool BrowserFramesEnabled();
      81             : 
      82             :   /**
      83             :    * Helper method to map a HTML 'scrolling' attribute value to a nsIScrollable
      84             :    * enum value.  scrolling="no" (and its synonyms) maps to
      85             :    * nsIScrollable::Scrollbar_Never, and anything else (including nullptr) maps
      86             :    * to nsIScrollable::Scrollbar_Auto.
      87             :    * @param aValue the attribute value to map or nullptr
      88             :    * @return nsIScrollable::Scrollbar_Never or nsIScrollable::Scrollbar_Auto
      89             :    */
      90             :   static int32_t MapScrollingAttribute(const nsAttrValue* aValue);
      91             : 
      92             : protected:
      93             :   virtual ~nsGenericHTMLFrameElement();
      94             : 
      95             :   // This doesn't really ensure a frame loader in all cases, only when
      96             :   // it makes sense.
      97             :   void EnsureFrameLoader();
      98             :   nsresult LoadSrc();
      99             :   nsIDocument* GetContentDocument(nsIPrincipal& aSubjectPrincipal);
     100             :   nsresult GetContentDocument(nsIDOMDocument** aContentDocument);
     101             :   already_AddRefed<nsPIDOMWindowOuter> GetContentWindow();
     102             : 
     103             :   virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
     104             :                                 const nsAttrValue* aValue,
     105             :                                 const nsAttrValue* aOldValue,
     106             :                                 bool aNotify) override;
     107             :   virtual nsresult OnAttrSetButNotChanged(int32_t aNamespaceID, nsIAtom* aName,
     108             :                                           const nsAttrValueOrString& aValue,
     109             :                                           bool aNotify) override;
     110             : 
     111             :   RefPtr<nsFrameLoader> mFrameLoader;
     112             :   nsCOMPtr<nsPIDOMWindowOuter> mOpenerWindow;
     113             : 
     114             :   /**
     115             :    * True when the element is created by the parser using the
     116             :    * NS_FROM_PARSER_NETWORK flag.
     117             :    * If the element is modified, it may lose the flag.
     118             :    */
     119             :   bool mNetworkCreated;
     120             : 
     121             :   bool mIsPrerendered;
     122             :   bool mBrowserFrameListenersRegistered;
     123             :   bool mFrameLoaderCreationDisallowed;
     124             :   bool mReallyIsBrowser;
     125             : 
     126             :   // This flag is only used by <iframe>. See HTMLIFrameElement::
     127             :   // FullscreenFlag() for details. It is placed here so that we
     128             :   // do not bloat any struct.
     129             :   bool mFullscreenFlag = false;
     130             : 
     131             : private:
     132             :   void GetManifestURL(nsAString& aOut);
     133             : 
     134             :   /**
     135             :    * This function is called by AfterSetAttr and OnAttrSetButNotChanged.
     136             :    * It will be called whether the value is being set or unset.
     137             :    *
     138             :    * @param aNamespaceID the namespace of the attr being set
     139             :    * @param aName the localname of the attribute being set
     140             :    * @param aValue the value being set or null if the value is being unset
     141             :    * @param aNotify Whether we plan to notify document observers.
     142             :    */
     143             :   void AfterMaybeChangeAttr(int32_t aNamespaceID, nsIAtom* aName,
     144             :                             const nsAttrValueOrString* aValue, bool aNotify);
     145             : };
     146             : 
     147             : #endif // nsGenericHTMLFrameElement_h

Generated by: LCOV version 1.13