Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/Text.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_Text_h
8
#define mozilla_dom_Text_h
9
10
#include "mozilla/dom/CharacterData.h"
11
#include "mozilla/ErrorResult.h"
12
13
namespace mozilla {
14
namespace dom {
15
16
class Text : public CharacterData
17
{
18
public:
19
  NS_IMPL_FROMNODE_HELPER(Text, IsText())
20
21
  explicit Text(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
22
  : CharacterData(std::move(aNodeInfo))
23
0
  {}
24
25
  // WebIDL API
26
  already_AddRefed<Text> SplitText(uint32_t aOffset, ErrorResult& rv);
27
  void GetWholeText(nsAString& aWholeText, ErrorResult& rv);
28
29
  static already_AddRefed<Text>
30
  Constructor(const GlobalObject& aGlobal,
31
              const nsAString& aData, ErrorResult& aRv);
32
33
  /**
34
   * Method to see if the text node contains data that is useful
35
   * for a translation: i.e., it consists of more than just whitespace,
36
   * digits and punctuation.
37
   */
38
  bool HasTextForTranslation();
39
};
40
41
} // namespace dom
42
} // namespace mozilla
43
44
inline mozilla::dom::Text* nsINode::GetAsText()
45
0
{
46
0
  return IsText() ? AsText() : nullptr;
47
0
}
48
49
inline const mozilla::dom::Text* nsINode::GetAsText() const
50
0
{
51
0
  return IsText() ? AsText() : nullptr;
52
0
}
53
54
inline mozilla::dom::Text* nsINode::AsText()
55
0
{
56
0
  MOZ_ASSERT(IsText());
57
0
  return static_cast<mozilla::dom::Text*>(this);
58
0
}
59
60
inline const mozilla::dom::Text* nsINode::AsText() const
61
0
{
62
0
  MOZ_ASSERT(IsText());
63
0
  return static_cast<const mozilla::dom::Text*>(this);
64
0
}
65
66
#endif // mozilla_dom_Text_h