Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/XULPopupElement.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 XULPopupElement_h__
8
#define XULPopupElement_h__
9
10
#include "mozilla/Attributes.h"
11
#include "mozilla/ErrorResult.h"
12
#include "nsCycleCollectionParticipant.h"
13
#include "nsWrapperCache.h"
14
#include "nsString.h"
15
#include "nsXULElement.h"
16
17
struct JSContext;
18
19
namespace mozilla {
20
namespace dom {
21
22
class DOMRect;
23
class Element;
24
class Event;
25
class StringOrOpenPopupOptions;
26
27
nsXULElement*
28
NS_NewXULPopupElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
29
30
class XULPopupElement final : public nsXULElement
31
{
32
private:
33
  nsIFrame* GetFrame(bool aFlushLayout);
34
35
public:
36
  explicit XULPopupElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
37
    : nsXULElement(std::move(aNodeInfo))
38
  {
39
  }
40
41
  void GetLabel(DOMString& aValue) const
42
0
  {
43
0
      GetXULAttr(nsGkAtoms::label, aValue);
44
0
  }
45
  void SetLabel(const nsAString& aValue, ErrorResult& rv)
46
0
  {
47
0
      SetXULAttr(nsGkAtoms::label, aValue, rv);
48
0
  }
49
50
  void GetPosition(DOMString& aValue) const
51
0
  {
52
0
      GetXULAttr(nsGkAtoms::position, aValue);
53
0
  }
54
  void SetPosition(const nsAString& aValue, ErrorResult& rv)
55
0
  {
56
0
      SetXULAttr(nsGkAtoms::position, aValue, rv);
57
0
  }
58
59
  bool AutoPosition();
60
61
  void SetAutoPosition(bool aShouldAutoPosition);
62
63
  void OpenPopup(Element* aAnchorElement,
64
                 const StringOrOpenPopupOptions& aOptions,
65
                 int32_t aXPos,
66
                 int32_t aYPos,
67
                 bool aIsContextMenu, bool aAttributesOverride,
68
                 Event* aTriggerEvent);
69
70
  void OpenPopupAtScreen(int32_t aXPos,
71
                         int32_t aYPos,
72
                         bool aIsContextMenu,
73
                         Event* aTriggerEvent);
74
75
  void OpenPopupAtScreenRect(const nsAString& aPosition,
76
                             int32_t aXPos, int32_t aYPos,
77
                             int32_t aWidth, int32_t aHeight,
78
                             bool aIsContextMenu,
79
                             bool aAttributesOverride,
80
                             Event* aTriggerEvent);
81
82
  void HidePopup(bool aCancel);
83
84
  void GetState(nsString& aState);
85
86
  nsINode* GetTriggerNode() const;
87
88
  Element* GetAnchorNode() const;
89
90
  already_AddRefed<DOMRect> GetOuterScreenRect();
91
92
  void MoveTo(int32_t aLeft, int32_t aTop);
93
94
  void MoveToAnchor(Element* aAnchorElement,
95
                    const nsAString& aPosition,
96
                    int32_t aXPos,
97
                    int32_t aYPos,
98
                    bool aAttributesOverride);
99
100
  void SizeTo(int32_t aWidth, int32_t aHeight);
101
102
  void GetAlignmentPosition(nsString& positionStr);
103
104
  int32_t AlignmentOffset();
105
106
  void SetConstraintRect(DOMRectReadOnly& aRect);
107
108
protected:
109
  virtual ~XULPopupElement()
110
0
  {
111
0
  }
112
113
  JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
114
};
115
116
} // namespace dom
117
} // namespace mozilla
118
119
#endif // XULPopupElement_h