Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/xml/XMLStylesheetProcessingInstruction.h
Line
Count
Source (jump to first uncovered line)
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/Unused.h"
12
#include "mozilla/dom/ProcessingInstruction.h"
13
#include "nsIURI.h"
14
#include "nsStyleLinkElement.h"
15
16
namespace mozilla {
17
namespace dom {
18
19
class XMLStylesheetProcessingInstruction final
20
  : public ProcessingInstruction
21
{
22
public:
23
  XMLStylesheetProcessingInstruction(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
24
                                     const nsAString& aData)
25
    : ProcessingInstruction(std::move(aNodeInfo), aData)
26
0
  {
27
0
  }
28
29
  XMLStylesheetProcessingInstruction(nsNodeInfoManager* aNodeInfoManager,
30
                                     const nsAString& aData)
31
    : ProcessingInstruction(aNodeInfoManager->GetNodeInfo(
32
                                       nsGkAtoms::processingInstructionTagName,
33
                                       nullptr, kNameSpaceID_None,
34
                                       PROCESSING_INSTRUCTION_NODE,
35
                                       nsGkAtoms::xml_stylesheet), aData)
36
0
  {
37
0
  }
38
39
  // nsISupports
40
  NS_DECL_ISUPPORTS_INHERITED
41
42
  // CC
43
  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XMLStylesheetProcessingInstruction,
44
                                           ProcessingInstruction)
45
46
  // nsINode
47
  virtual void SetNodeValueInternal(const nsAString& aNodeValue,
48
                                    mozilla::ErrorResult& aError) override;
49
50
  // nsIContent
51
  virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
52
                              nsIContent* aBindingParent) override;
53
  virtual void UnbindFromTree(bool aDeep = true,
54
                              bool aNullParent = true) override;
55
56
  // nsIStyleSheetLinkingElement
57
  virtual void OverrideBaseURI(nsIURI* aNewBaseURI) override;
58
59
  // nsStyleLinkElement
60
  void GetCharset(nsAString& aCharset) override;
61
62
  virtual void SetData(const nsAString& aData, mozilla::ErrorResult& rv) override
63
0
  {
64
0
    CharacterData::SetData(aData, rv);
65
0
    if (rv.Failed()) {
66
0
      return;
67
0
    }
68
0
    Unused << UpdateStyleSheetInternal(nullptr, nullptr, ForceUpdate::Yes);
69
0
  }
70
71
protected:
72
  virtual ~XMLStylesheetProcessingInstruction();
73
74
  nsCOMPtr<nsIURI> mOverriddenBaseURI;
75
76
  Maybe<SheetInfo> GetStyleSheetInfo() final;
77
78
  already_AddRefed<CharacterData>
79
    CloneDataNode(mozilla::dom::NodeInfo* aNodeInfo,
80
                  bool aCloneText) const final;
81
};
82
83
} // namespace dom
84
} // namespace mozilla
85
86
#endif // mozilla_dom_XMLStylesheetProcessingInstruction_h