LCOV - code coverage report
Current view: top level - dom/html - HTMLShadowElement.h (source / functions) Hit Total Coverage
Test: output.info Lines: 3 8 37.5 %
Date: 2017-07-14 16:53:18 Functions: 1 8 12.5 %
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 mozilla_dom_HTMLShadowElement_h__
       8             : #define mozilla_dom_HTMLShadowElement_h__
       9             : 
      10             : #include "nsGenericHTMLElement.h"
      11             : 
      12             : namespace mozilla {
      13             : namespace dom {
      14             : 
      15             : class HTMLShadowElement final : public nsGenericHTMLElement,
      16             :                                 public nsStubMutationObserver
      17             : {
      18             : public:
      19             :   explicit HTMLShadowElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
      20             : 
      21             :   // nsISupports
      22             :   NS_DECL_ISUPPORTS_INHERITED
      23             : 
      24             :   NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
      25             :   NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
      26             :   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
      27             : 
      28           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLShadowElement,
      29             :                                            nsGenericHTMLElement)
      30             : 
      31        5640 :   static HTMLShadowElement* FromContent(nsIContent* aContent)
      32             :   {
      33        5640 :     if (aContent->IsHTMLShadowElement()) {
      34           0 :       return static_cast<HTMLShadowElement*>(aContent);
      35             :     }
      36             : 
      37        5640 :     return nullptr;
      38             :   }
      39             : 
      40           0 :   virtual bool IsHTMLShadowElement() const override { return true; }
      41             : 
      42             :   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
      43             :                          bool aPreallocateChildren) const override;
      44             : 
      45             :   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
      46             :                               nsIContent* aBindingParent,
      47             :                               bool aCompileEventHandlers) override;
      48             : 
      49             :   virtual void UnbindFromTree(bool aDeep = true,
      50             :                               bool aNullParent = true) override;
      51             : 
      52           0 :   bool IsInsertionPoint() { return mIsInsertionPoint; }
      53             : 
      54             :   /**
      55             :    * Sets the ShadowRoot that will be rendered in place of
      56             :    * this shadow insertion point.
      57             :    */
      58             :   void SetProjectedShadow(ShadowRoot* aProjectedShadow);
      59             : 
      60             :   /**
      61             :    * Distributes a single explicit child of the projected ShadowRoot
      62             :    * to relevant insertion points.
      63             :    */
      64             :   void DistributeSingleNode(nsIContent* aContent);
      65             : 
      66             :   /**
      67             :    * Removes a single explicit child of the projected ShadowRoot
      68             :    * from relevant insertion points.
      69             :    */
      70             :   void RemoveDistributedNode(nsIContent* aContent);
      71             : 
      72             :   /**
      73             :    * Distributes all the explicit children of the projected ShadowRoot
      74             :    * to the shadow insertion point in the younger ShadowRoot and
      75             :    * the content insertion point of the parent node's ShadowRoot.
      76             :    */
      77             :   void DistributeAllNodes();
      78             : 
      79             :   // WebIDL methods.
      80           0 :   ShadowRoot* GetOlderShadowRoot() { return mProjectedShadow; }
      81             : 
      82             : protected:
      83             :   virtual ~HTMLShadowElement();
      84             : 
      85             :   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
      86             : 
      87             :   // The ShadowRoot that will be rendered in place of this shadow insertion point.
      88             :   RefPtr<ShadowRoot> mProjectedShadow;
      89             : 
      90             :   bool mIsInsertionPoint;
      91             : };
      92             : 
      93             : } // namespace dom
      94             : } // namespace mozilla
      95             : 
      96             : #endif // mozilla_dom_HTMLShadowElement_h__
      97             : 

Generated by: LCOV version 1.13