Bumping manifests a=b2g-bump
[gecko.git] / dom / base / nsDOMWindowUtils.h
blobb78d658c1e0390e34ffb467e026a042e0957da37
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsDOMWindowUtils_h_
7 #define nsDOMWindowUtils_h_
9 #include "nsWeakReference.h"
11 #include "nsIDOMWindowUtils.h"
12 #include "mozilla/Attributes.h"
13 #include "mozilla/BasicEvents.h"
15 class nsGlobalWindow;
16 class nsIPresShell;
17 class nsIWidget;
18 class nsPresContext;
19 class nsIDocument;
20 class nsView;
21 struct nsPoint;
23 namespace mozilla {
24 namespace layers {
25 class LayerTransactionChild;
29 class nsTranslationNodeList MOZ_FINAL : public nsITranslationNodeList
31 public:
32 nsTranslationNodeList()
34 mNodes.SetCapacity(1000);
35 mNodeIsRoot.SetCapacity(1000);
36 mLength = 0;
39 NS_DECL_ISUPPORTS
40 NS_DECL_NSITRANSLATIONNODELIST
42 void AppendElement(nsIDOMNode* aElement, bool aIsRoot)
44 mNodes.AppendElement(aElement);
45 mNodeIsRoot.AppendElement(aIsRoot);
46 mLength++;
49 private:
50 ~nsTranslationNodeList() {}
52 nsTArray<nsCOMPtr<nsIDOMNode> > mNodes;
53 nsTArray<bool> mNodeIsRoot;
54 uint32_t mLength;
57 class nsDOMWindowUtils MOZ_FINAL : public nsIDOMWindowUtils,
58 public nsSupportsWeakReference
60 public:
61 explicit nsDOMWindowUtils(nsGlobalWindow *aWindow);
62 NS_DECL_ISUPPORTS
63 NS_DECL_NSIDOMWINDOWUTILS
65 protected:
66 ~nsDOMWindowUtils();
68 nsWeakPtr mWindow;
70 // If aOffset is non-null, it gets filled in with the offset of the root
71 // frame of our window to the nearest widget in the app units of our window.
72 // Add this offset to any event offset we're given to make it relative to the
73 // widget returned by GetWidget.
74 nsIWidget* GetWidget(nsPoint* aOffset = nullptr);
75 nsIWidget* GetWidgetForElement(nsIDOMElement* aElement);
77 nsIPresShell* GetPresShell();
78 nsPresContext* GetPresContext();
79 nsIDocument* GetDocument();
80 mozilla::layers::LayerTransactionChild* GetLayerTransaction();
82 nsView* GetViewToDispatchEvent(nsPresContext* presContext, nsIPresShell** presShell);
84 NS_IMETHOD SendMouseEventCommon(const nsAString& aType,
85 float aX,
86 float aY,
87 int32_t aButton,
88 int32_t aClickCount,
89 int32_t aModifiers,
90 bool aIgnoreRootScrollFrame,
91 float aPressure,
92 unsigned short aInputSourceArg,
93 bool aToWindow,
94 bool *aPreventDefault,
95 bool aIsSynthesized);
97 NS_IMETHOD SendPointerEventCommon(const nsAString& aType,
98 float aX,
99 float aY,
100 int32_t aButton,
101 int32_t aClickCount,
102 int32_t aModifiers,
103 bool aIgnoreRootScrollFrame,
104 float aPressure,
105 unsigned short aInputSourceArg,
106 int32_t aPointerId,
107 int32_t aWidth,
108 int32_t aHeight,
109 int32_t aTiltX,
110 int32_t aTiltY,
111 bool aIsPrimary,
112 bool aIsSynthesized,
113 uint8_t aOptionalArgCount,
114 bool aToWindow,
115 bool* aPreventDefault);
117 NS_IMETHOD SendTouchEventCommon(const nsAString& aType,
118 uint32_t* aIdentifiers,
119 int32_t* aXs,
120 int32_t* aYs,
121 uint32_t* aRxs,
122 uint32_t* aRys,
123 float* aRotationAngles,
124 float* aForces,
125 uint32_t aCount,
126 int32_t aModifiers,
127 bool aIgnoreRootScrollFrame,
128 bool aToWindow,
129 bool* aPreventDefault);
131 static mozilla::Modifiers GetWidgetModifiers(int32_t aModifiers);
134 #endif