LCOV - code coverage report
Current view: top level - dom/xml - XMLStylesheetProcessingInstruction.h (source / functions) Hit Total Coverage
Test: output.info Lines: 5 13 38.5 %
Date: 2017-07-14 16:53:18 Functions: 2 7 28.6 %
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_XMLStylesheetProcessingInstruction_h
       8             : #define mozilla_dom_XMLStylesheetProcessingInstruction_h
       9             : 
      10             : #include "mozilla/Attributes.h"
      11             : #include "mozilla/dom/ProcessingInstruction.h"
      12             : #include "nsIURI.h"
      13             : #include "nsStyleLinkElement.h"
      14             : 
      15             : namespace mozilla {
      16             : namespace dom {
      17             : 
      18             : class XMLStylesheetProcessingInstruction final
      19             : : public ProcessingInstruction
      20             : , public nsStyleLinkElement
      21             : {
      22             : public:
      23           0 :   XMLStylesheetProcessingInstruction(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
      24             :                                      const nsAString& aData)
      25           0 :     : ProcessingInstruction(Move(aNodeInfo), aData)
      26             :   {
      27           0 :   }
      28             : 
      29           6 :   XMLStylesheetProcessingInstruction(nsNodeInfoManager* aNodeInfoManager,
      30             :                                      const nsAString& aData)
      31          12 :     : ProcessingInstruction(aNodeInfoManager->GetNodeInfo(
      32             :                                        nsGkAtoms::processingInstructionTagName,
      33             :                                        nullptr, kNameSpaceID_None,
      34             :                                        nsIDOMNode::PROCESSING_INSTRUCTION_NODE,
      35          12 :                                        nsGkAtoms::xml_stylesheet), aData)
      36             :   {
      37           6 :   }
      38             : 
      39             :   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
      40             : 
      41             :   // nsISupports
      42             :   NS_DECL_ISUPPORTS_INHERITED
      43             : 
      44             :   // CC
      45           6 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XMLStylesheetProcessingInstruction,
      46             :                                            ProcessingInstruction)
      47             : 
      48             :   // nsIDOMNode
      49             :   virtual void SetNodeValueInternal(const nsAString& aNodeValue,
      50             :                                     mozilla::ErrorResult& aError) override;
      51             : 
      52             :   // nsIContent
      53             :   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
      54             :                               nsIContent* aBindingParent,
      55             :                               bool aCompileEventHandlers) override;
      56             :   virtual void UnbindFromTree(bool aDeep = true,
      57             :                               bool aNullParent = true) override;
      58             : 
      59             :   // nsIStyleSheetLinkingElement
      60             :   virtual void OverrideBaseURI(nsIURI* aNewBaseURI) override;
      61             : 
      62             :   // nsStyleLinkElement
      63             :   NS_IMETHOD GetCharset(nsAString& aCharset) override;
      64             : 
      65           0 :   virtual void SetData(const nsAString& aData, mozilla::ErrorResult& rv) override
      66             :   {
      67           0 :     nsGenericDOMDataNode::SetData(aData, rv);
      68           0 :     if (rv.Failed()) {
      69           0 :       return;
      70             :     }
      71           0 :     UpdateStyleSheetInternal(nullptr, nullptr, true);
      72             :   }
      73             :   using ProcessingInstruction::SetData; // Prevent hiding overloaded virtual function.
      74             : 
      75             : protected:
      76             :   virtual ~XMLStylesheetProcessingInstruction();
      77             : 
      78             :   nsCOMPtr<nsIURI> mOverriddenBaseURI;
      79             : 
      80             :   already_AddRefed<nsIURI> GetStyleSheetURL(bool* aIsInline) override;
      81             :   void GetStyleSheetInfo(nsAString& aTitle,
      82             :                          nsAString& aType,
      83             :                          nsAString& aMedia,
      84             :                          bool* aIsScoped,
      85             :                          bool* aIsAlternate) override;
      86             :   virtual nsGenericDOMDataNode* CloneDataNode(mozilla::dom::NodeInfo *aNodeInfo,
      87             :                                               bool aCloneText) const override;
      88             : };
      89             : 
      90             : } // namespace dom
      91             : } // namespace mozilla
      92             : 
      93             : #endif // mozilla_dom_XMLStylesheetProcessingInstruction_h

Generated by: LCOV version 1.13